CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 01-20-2013, 09:33 PM   #1
booboo4ever
Frequenter
Vincent R. DeLay
USA
 
Join Date: Aug 2002
Posts: 159
trouble with tic marks

hello all,

i am kind of a noob at MEL maybe.

i often like to capture items as variables when i create them so i can rename them etc, even if i do not know what Maya may have named them. so i use syntax like the following

string $group_name[] = `group -em`;
rename $group_name[0] "character_group";

but i find lately in 2013 (unless it was happening before and i am just crazy) that sometimes using and array causes errors and instead i have to use the syntax as follows

string $group_name = `group -em`;
rename $group_name "character_group";

so in the first sample, i need to use an array or 2013 throws an error. in the second sample, i have to just use a string variable or 2013 throws an error. i have tried to make sense of it, but i cannot figure out why one or the other method will work and why. it is simple enough to change one method to the other if it fails, but it is kind of driving me nuts.

thanks so much for any help
__________________
http://www.vincentdelay.com

" . . . the essential in life is invisible to the eye, one can only see rightly with the heart." (The Little Prince)
 
Old 01-21-2013, 02:05 AM   #2
gmask
Obfuscator
 
gmask's Avatar
gmask
Power Sitting
Topanga, USA
 
Join Date: Oct 2002
Posts: 6,937
The group command returns a string not a string array
__________________
blah blah blah
 
Old 01-21-2013, 02:11 AM   #3
booboo4ever
Frequenter
Vincent R. DeLay
USA
 
Join Date: Aug 2002
Posts: 159
ok, maybe that is it. i just seemed to remember before when i was ever capturing something in this way inside of tic marks that i always had to capture it as an array. i just seem to get inconsistant results. like if i make a curve i would do the following

string $control_circlex[] = `circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 1 -d 3 -ut 0 -tol 0.01 -s 16 -ch 1`;
rename $control_circlex[0] "global_mover";

so a group returns a string, but a circle curve returns an array? kind of odd if you ask me, i would think they both return strings.

thanks for your reply!
__________________
http://www.vincentdelay.com

" . . . the essential in life is invisible to the eye, one can only see rightly with the heart." (The Little Prince)
 
Old 01-21-2013, 02:25 AM   #4
booboo4ever
Frequenter
Vincent R. DeLay
USA
 
Join Date: Aug 2002
Posts: 159
looking through the documentation it confirms what you said about return value. i must have just been crazy all this time lol always thinking arrays.

thanks again.
__________________
http://www.vincentdelay.com

" . . . the essential in life is invisible to the eye, one can only see rightly with the heart." (The Little Prince)
 
Old 01-21-2013, 02:28 AM   #5
gmask
Obfuscator
 
gmask's Avatar
gmask
Power Sitting
Topanga, USA
 
Join Date: Oct 2002
Posts: 6,937
Quote:
Originally Posted by booboo4ever
ok, maybe that is it. i just seemed to remember before when i was ever capturing something in this way inside of tic marks that i always had to capture it as an array.


The accent mark does not determine whether or not a command returns an array or not.


Quote:
Originally Posted by booboo4ever
i just seem to get inconsistant results. like if i make a curve i would do the following ...

so a group returns a string, but a circle curve returns an array? kind of odd if you ask me, i would think they both return strings.


Some commands return more information than others. The group command only needs to return the name of the group it created.

According to the help files the curve command also returns a string and not an array.

I'm not certain but mel might allow you to assign a string to string array when you declare the string array and assign it at the same time as you are doing but it would definitely throw an error if you tried to assign an array to a string.
__________________
blah blah blah
 
Old 01-21-2013, 02:29 AM   #6
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
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 07:01 PM.


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