If else switch : )


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 ;
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 ?



why don`t you have your custom attributes connected to a parentConstraint node via driven keys? Works better for animation.


lol. it worked : )



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.