CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 10-20-2005, 01:42 PM   #1
Nenox
Frequenter
 
Nenox's Avatar
Sune Kempf
IO Interactive
Copenhagen, Denmark
 
Join Date: Feb 2003
Posts: 178
Problem with using`$variable` i procedure!?

Hi. I have a small problem!

I want to make an array that contains the names of objects, whose .message attribute is connected to a multiMessageAttribute. These names MUST be full path names(long), since multiple nodes in the scene have the same name.

I can do this with the following code and that works just fine:

Code:
string $charName = "biped_charNode.bindJointsMM"; string $listConnections = "ls -l `listConnections -destination false -source true $charName`"; string $ctrlJointsName[] = `eval $listConnections`;


The problem comes when want to use the code inside a global proc eg:

Code:
global proc skListConnections(string $charName){ string $listConnections = "ls -l `listConnections -destination false -source true $charName`"; string $ctrlJointsName[] = `eval $listConnections`; }


This does not work! I get the error: $charNAme is an undefined variable..

It does however work, if I allready defined $charName in the maya script editor, prior to running the proc. (Outside the proc). But I need to call the proc from another proc, so this is not an option. :-)

Any surgestions??

:-) Sune
__________________
--- rigging blog ---
www.sunekempf.com/blog

Last edited by Nenox : 10-20-2005 at 02:33 PM.
 
Old 10-20-2005, 02:44 PM   #2
NolanSW
No Coffee=Grumpy Rigger
 
NolanSW's Avatar
portfolio
Sean
Character TeeDee
2k Games
USA
 
Join Date: Apr 2003
Posts: 498
slight mod
Code:
global proc skListConnections(string $charName){ string $listConnections = "ls -l `listConnections -destination false -source true " + $charName + "`"; string $ctrlJointsName[] = `eval $listConnections`; }


The variable has to be outside the qoutes.
 
Old 10-20-2005, 03:08 PM   #3
Nenox
Frequenter
 
Nenox's Avatar
Sune Kempf
IO Interactive
Copenhagen, Denmark
 
Join Date: Feb 2003
Posts: 178
Nice.

That was a little too obvious.. :-|

The actual script line now reads:

Code:
string $listConnections = "ls -l `listConnections -destination false -source true " + $charName + "_characterNode.ctrlSkeleton`";


Thanks a lot!
__________________
--- rigging blog ---
www.sunekempf.com/blog
 
Old 10-20-2005, 10:20 PM   #4
NolanSW
No Coffee=Grumpy Rigger
 
NolanSW's Avatar
portfolio
Sean
Character TeeDee
2k Games
USA
 
Join Date: Apr 2003
Posts: 498
Sure thing.
 
Old 10-20-2005, 10:20 PM   #5
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,480
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 03:34 AM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.