CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 02-25-2008, 03:08 AM   #1
theflash
trying to visualize 'i'
 
theflash's Avatar
Maulik Kataria
Geeky Artist
Bergen, Norway
 
Join Date: Feb 2006
Posts: 801
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-25-2008, 03:27 AM   #2
r4inm4ker
triangle noodle maker
 
r4inm4ker's Avatar
portfolio
Jefri Haryono
Taipei, Taiwan
 
Join Date: Oct 2006
Posts: 369
scriptJob is the way to go.
e.g : scriptJob -attributeChange mySphere.ty warnMe;
(warnMe is the function you want to call)
 
Old 02-25-2008, 03:47 AM   #3
theflash
trying to visualize 'i'
 
theflash's Avatar
Maulik Kataria
Geeky Artist
Bergen, Norway
 
Join Date: Feb 2006
Posts: 801
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-25-2008, 04:55 AM   #4
theflash
trying to visualize 'i'
 
theflash's Avatar
Maulik Kataria
Geeky Artist
Bergen, Norway
 
Join Date: Feb 2006
Posts: 801
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-25-2008, 05:50 AM   #5
theflash
trying to visualize 'i'
 
theflash's Avatar
Maulik Kataria
Geeky Artist
Bergen, Norway
 
Join Date: Feb 2006
Posts: 801
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-25-2008, 06:51 AM   #6
ashishdantu
CG talk crawler...
 
ashishdantu's Avatar
portfolio
ashishdantu
3D Tech Artist
Singapore, India
 
Join Date: Apr 2002
Posts: 603
Send a message via Yahoo to ashishdantu
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-25-2008, 08:54 PM   #7
theflash
trying to visualize 'i'
 
theflash's Avatar
Maulik Kataria
Geeky Artist
Bergen, Norway
 
Join Date: Feb 2006
Posts: 801
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-25-2008, 08:54 PM   #8
CGTalk Moderation
Expert
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,478
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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 02:47 PM.


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