Introduction to Maya - Modeling Fundamentals Vol 1
This course will look at the fundamentals of modeling in Maya with an emphasis on creating good topology. We'll look at what makes a good model in Maya and why objects are modeled in the way they are.
# 1 27-11-2006 , 02:22 PM
Falott's Avatar
Registered User
Join Date: Jan 2005
Location: vienna
Posts: 1,095

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


everything starts and ends in the right place at the right time.

Last edited by Falott; 27-11-2006 at 02:25 PM.
# 2 27-11-2006 , 02:32 PM
enhzflep's Avatar
Subscriber
Join Date: Oct 2006
Location: Melbourne
Posts: 313
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

# 3 27-11-2006 , 02:43 PM
Falott's Avatar
Registered User
Join Date: Jan 2005
Location: vienna
Posts: 1,095
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");


}


everything starts and ends in the right place at the right time.
# 4 27-11-2006 , 02:52 PM
Falott's Avatar
Registered User
Join Date: Jan 2005
Location: vienna
Posts: 1,095
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;");


}


everything starts and ends in the right place at the right time.
# 5 23-12-2006 , 04:07 AM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
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

user added image
A


Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 6 23-12-2006 , 04:33 AM
Falott's Avatar
Registered User
Join Date: Jan 2005
Location: vienna
Posts: 1,095
thx for reply Pure!


everything starts and ends in the right place at the right time.
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads