SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Animation / Mel Scripts & Programming / connecting attributes
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 27-11-2006, 01:22 PM   #1
Falott
Registered User
 
Falott's Avatar
 
Join Date: Jan 2005
Location: vienna
Posts: 1,095
Thanks: 3
Thanked 20 Times in 18 Posts
Default 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 01:25 PM.
Falott is offline   Reply With Quote
Old 27-11-2006, 01:32 PM   #2
enhzflep
Subscriber
 
enhzflep's Avatar
 
Join Date: Oct 2006
Location: Melbourne
Posts: 313
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
enhzflep is offline   Reply With Quote
Old 27-11-2006, 01:43 PM   #3
Falott
Registered User
 
Falott's Avatar
 
Join Date: Jan 2005
Location: vienna
Posts: 1,095
Thanks: 3
Thanked 20 Times in 18 Posts
Default

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.
Falott is offline   Reply With Quote
Old 27-11-2006, 01:52 PM   #4
Falott
Registered User
 
Falott's Avatar
 
Join Date: Jan 2005
Location: vienna
Posts: 1,095
Thanks: 3
Thanked 20 Times in 18 Posts
Default

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.
Falott is offline   Reply With Quote
Old 23-12-2006, 03:07 AM   #5
Alan
Moderator
 
Alan's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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


A
__________________
Technical Director - Framestore

Currently working on: Your Highness

IMDB
Alan is offline   Reply With Quote
Old 23-12-2006, 03:33 AM   #6
Falott
Registered User
 
Falott's Avatar
 
Join Date: Jan 2005
Location: vienna
Posts: 1,095
Thanks: 3
Thanked 20 Times in 18 Posts
Default

thx for reply Pure!
__________________
everything starts and ends in the right place at the right time.
Falott is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange Problem - Unable to change attributes for multiple objects anthonysw3 Technical Issues 4 04-12-2010 10:56 PM

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.