How do I assign a mel script to an attribute?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 02 February 2008   #1
How do I assign a mel script to an attribute?

I want to add this attubute to a control and when that attribute is changed to a particular value I want to execute a particular mel code. Can anybody tell me how to do that? or is there a better way than what I am thinking? Thanks.
__________________
[ myRiggingBLOG ]
[ myAnimBLOG ]
[ myWebsite ]
"Life is animation and we are our own animators." -i
 
Old 02 February 2008   #2
scriptJob is the way to go.
e.g : scriptJob -attributeChange mySphere.ty warnMe;
(warnMe is the function you want to call)
 
Old 02 February 2008   #3
Thanks I will go through scriptJob. Thanks a lot again.
__________________
[ myRiggingBLOG ]
[ myAnimBLOG ]
[ myWebsite ]
"Life is animation and we are our own animators." -i
 
Old 02 February 2008   #4
I have one more question. After I attach a script with the attribute, will it stay with it all the time? I mean everytime I run that maya file that attribute still have that script attached to it?
__________________
[ myRiggingBLOG ]
[ myAnimBLOG ]
[ myWebsite ]
"Life is animation and we are our own animators." -i
 
Old 02 February 2008   #5
It seems that the attribute will not retain the scriptJob attached to it. Is there a way to run the scriptJob when i open my file? Is there a way to associate script with a particular file so that when I open only my file it will execute the mel script?
__________________
[ myRiggingBLOG ]
[ myAnimBLOG ]
[ myWebsite ]
"Life is animation and we are our own animators." -i
 
Old 02 February 2008   #6
hi theflash,

yes, the scriptjob is retained only this ur current maya session.

Open your scene and put a script node and tell the scriptnode to fire itself before the scene is open and then in the script node you can have the command to make a scriptjob which can be attached to the obj's attribute.

scriptNode -st 1 -beforeScript "scriptJob -attributeChange mySphere.ty warnMee;";

this shud be run everytime ur scene is opened and your scriptjob shud be re-created every time
__________________
|| Loka samastaa sukhino bhavantu ||
ash
 
Old 02 February 2008   #7
Thanks man. That is going to be very helpful. I will give it a shot.
__________________
[ myRiggingBLOG ]
[ myAnimBLOG ]
[ myWebsite ]
"Life is animation and we are our own animators." -i
 
Old 02 February 2008   #8
Thread automatically closed

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.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:25 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.