PDA

View Full Version : trouble with tic marks


booboo4ever
01-20-2013, 08:33 PM
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

gmask
01-21-2013, 01:05 AM
The group command returns a string not a string array

booboo4ever
01-21-2013, 01:11 AM
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!

booboo4ever
01-21-2013, 01:25 AM
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.

gmask
01-21-2013, 01:28 AM
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.


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.

CGTalk Moderation
01-21-2013, 01:29 AM
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.