PDA

View Full Version : Mel question


ginodauri
09-08-2008, 04:15 AM
hi

Is this possible to do in mel and how:if i select some existing node(example curve) in scene to change some attributes.

If i select first node to change attributefrom 0 to 1.

Select second node to change attribute from 1 to 0.

Sorry for bad english,

morobuse1979
09-08-2008, 07:10 PM
Hi....

basically I think what you are talking about is scriptJob...

I don't really like scriptJobs since they can get heavy and unreliable at times but still... you asked... i try to answer :)

for the sake of demonstration create a new scene and 3 pCubes...

paste the following code in the script editor...



global proc testCon ()
{
string $selObjs[] = `ls -sl`;
if ($selObjs[0] == "pCube1")
{
setAttr "pCube3.scaleY" 5;
}
else if ($selObjs[0] == "pCube2")
{
setAttr "pCube3.scaleY" 1;

}
}


int $jobNum = `scriptJob -e "SelectionChanged" "testCon" -protected`;

what this will basically give you is that when u select pcube1, pcube3 scales 5 on Y and if u select pcube2 then it will scale back to 1...

you can use this to drive attributes or other stuff...

ginodauri
09-09-2008, 08:06 AM
Thanks...

I just start learning mel,i thought to do something like this with Ik/Fk switching.

I will see what can i do...

ewerybody
09-09-2008, 09:02 AM
attach your scriptjobs to a UI-Window If you can! So the scriptjob won't run if you don't have your tool opened and you don't have to deal with that obscure jobIDs.

or another tip: Bundle your selection changed jobs: If you have multiple stuff running on selectionChange: handle it all in one job instead of multiple.

CGTalk Moderation
09-09-2008, 09:02 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.