PDA

View Full Version : Attr controling a MEL comand


gonzovas
07-10-2008, 12:41 AM
Hi folks; am with this doubt in my head. How can a Attr of an object make run one or more scripts? For example i got a locator and i create it an attr to control the ik-fk switch (so i need a mel script that i already wrote) and i want that when the attr's locator are in 1 value make run the script Fk to IK, and when the attr's locator are in 0 value make run the script Ik to FK. I hope you can undertand what am trying to do here :curious:

BenBarker
07-10-2008, 01:20 AM
Generally that kind of thing is avoided for speed reason. Rather than having processes constantly ask "should I run? should I run? should I run?" it's faster to tell them "run now" once.

By that logic you should have a seperate script that you run once that flips the attribute on the locator and runs your switch script. Then you can make a shelf button, hotkey, or whatever you prefer to execute it.

NaughtyNathan
07-10-2008, 08:52 AM
you can use a scriptJob to trigger on "AttributeChange". basically the script job will fiire off a proc whenever the locator attribute changes. presumably this proc will then check if the value is 0 or 1 and fire off the appropriate routine.

look at scriptJob in the docs for full details

:nathaN

CGTalk Moderation
07-10-2008, 08:52 AM
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.