|
Hi all,
I am new at mel scripting and i don’t know many things about mel so i would like your help.
I want to write an expression that will link the translate attributes tX, tY, tZ of 30 locators with the low bound attribute of a sine deformer.
I wrote this and its working, for just one locator:
string $sel[] = `ls -sl`;
for($tmp in $sel){
expression -s ("if (("+$tmp+".translateX !=0) || ("+$tmp+".translateY !=0) || ("+$tmp+".translateZ != 0)) “ +
“sine1.lowBound = -0.8 ;” +
“ else “ +
“sine1.lowBound = -0.4; “);
};
The issue is that is not working when i am trying to connect all of them with the sine’s attribute and i get this error:
// Error: Attribute already controlled by an expression, keyframe, or other connection: sine1.lowBound //
i really need some help with this thank you in advance.
|
|
|
|
A plug has one input. One “link per attribute” in other words.
Create a proc that will return a true or false and use that in the expression:
if (`isIdentity`)
sine1.lowBound = -0.8 ;
else
sine1.lowBound = -0.4;
the proc can then loop over the locators and figure out if they’re where you want them or not and modify the return value as necessary.
|
|
|