View Full Version : If else switch : )


lvl3bomb
09 September 2008, 01:14 PM
hello !
Alright, I'm trying to create an attribute that holds a mel expression.
Now Im VERY VERY new to mel so... I'm quite sure I'm doing something wrong with the syntax or the entire algorithm is wrong : )

I got a control curve that is constrained to a group of bones. I want to add an attribute to that control curve and when its switched on, that control curve gets parented to another control curve, and when the attribute is switched off, the control curve reverts to its original statues.
What I did so far is create a boolean attribute.
I then right clicked and went into expression editor where I added this if-switch:

if (cc_r_hand01.FK_Mode_Sticky == 1)
{
select -r cc_r_hand01 ;
select -tgl bn_r_wrist01 ;
parent;
}
else
{
select -r cc_r_hand01 ;
parent -w;
}


where cc_r_hand01.FK_Mode_Sticky is the actual control curve and its boolean attribute...

Well... it didnt work : )
My guess is that switching the attribute on and off using 1,0 doesnt really execute this expression.... any ideas ?

Thanks!

Buexe
09 September 2008, 07:00 PM
why don`t you have your custom attributes connected to a parentConstraint node via driven keys? Works better for animation.

lvl3bomb
09 September 2008, 07:14 PM
lol. it worked : )

Thanks.

CGTalk Moderation
09 September 2008, 07:14 PM
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.


1