PDA

View Full Version : Controller Condition issue


AR-MAN
03-28-2012, 01:35 PM
I created a plugin, to which I want to add a simple if condition, but it's not working on MAX 2012.

Here's my script:

if $.pos.controller != path_constraint then messageBox "Apply Path Constraint";

In both cases, when I have a path_constraint applied to my position controller or not he's sending me the message "Apply Path Constraint". :banghead:

Raytracer05
03-28-2012, 01:49 PM
Would something like this work?
if not (isKindOf $.pos.controller path_constraint) do messageBox "Apply Path Constraint"

AR-MAN
03-28-2012, 03:12 PM
Would something like this work?
if not (isKindOf $.pos.controller path_constraint) do messageBox "Apply Path Constraint"

Thank you very much, Yeah that works :bounce: :beer:
What the isKindOf do ?

MrPingouin
03-28-2012, 03:34 PM
isKindOf compares the class of the first parameter to the second parameter, and returns true if they're the same.

Another way to write it would have been :

if (classof $.pos.controller == path_constraint) then messageBox "Apply Path Constraint"

isKindOf kinda uses classOf to return its value.

Raytracer05
03-28-2012, 03:52 PM
isKindOf also compares the second parameter with the superClass of the first so:
isKindOf $ light would return true if you have any kind light selected.

CGTalk Moderation
03-28-2012, 03:52 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.