Notifications
Clear all

[Closed] Controller Condition issue

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:

4 Replies

Would something like this work?

if not (isKindOf $.pos.controller path_constraint) do messageBox "Apply Path Constraint"
1 Reply
(@ar-man)
Joined: 2 years ago

Posts: 0

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

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.

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.