Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   connecting attributes (https://simplymaya.com/forum/showthread.php?t=23986)

Falott 27-11-2006 02:22 PM

connecting attributes
 
hi,

I dont get the right syntax for this little script for linking custom attributes. I have a locator with added attributes - schalA...schalH. I need to connect the schalA to 35 object´s zRotation. please view my script and lend a helping hand


for ($i = 0; $i <= 35; ++$i)
{
$object_a = "schalA_" + $i;
eval select -r $object_a;


$object_b = "locator1" ;
eval select -add $object_b;

//commando
connectAttr -f "object_b" + ".rotateZ" object_a.rotateZ;



}


the schal_objects are deep down a hierarchy. hope that´s not the problem.


thx in advance

enhzflep 27-11-2006 02:32 PM

Hello.

Just wondering, 'ave you tried replacing the line

"connectAttr -f object_b object_a.rotateZ;"

with

"connectAttr -f $object_b $object_a.rotateZ;"

I reckon you're prob is a missing dollar sign (whatever the name for that is in the syntax).

I'm guessin they're variables you've defined in the mel code from the way you refference them. Since execution's making it past the other two refferences to them, I reckon that's your prob.

Simon

Falott 27-11-2006 02:43 PM

for ($i = 0; $i <= 35; ++$i)
{
$object_a = "schalA_" + $i;
eval select -r $object_a;


$object_b = "locator1" ;
eval select -add $object_b;

//commando
eval("connectAttr -f locator1.schalA schalA_" + $i + ".rotateZ");


}

Falott 27-11-2006 02:52 PM

thx for your help enhzflep,



this is working now




for ($i = 0; $i <= 16; ++$i)
{
$object_a = "schalB_" + $i;


$object_b = "locator1" ;
eval select -add $object_b;

//commando
eval("connectAttr -f locator1.schalB schalB_" + $i + ".rotateZ;");


}

Alan 23-12-2006 04:07 AM

you don't need all those eval statements:

for ($i = 0; $i <= 16; ++$i)
{
$object_a = ("schalB_" + $i);


$object_b = "locator1" ;
select -add $object_b;

//commando
connectAttr -f "locator1.schalB" ($object_a + ".rotateZ");


}

this will work better

:ninja:
A

Falott 23-12-2006 04:33 AM

thx for reply Pure!


All times are GMT. The time now is 04:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018