PDA

View Full Version : error in my list selection script


bananamation
08-18-2005, 01:11 PM
hello,

I am writing this code but gets an error. I am trying to connect a control to each selected joint.

string $selAll[] = `ls -sl `;

for($sel in $selAll)
{

group -n ($sel + "Ctrl_G");
delete `parentConstraint $sel ($sel + "Ctrl_G")`;
circle -n ($sel + "Ctrl");

parent ($sel + "Ctrl") ($sel + "Ctrl_G");
select ($sel + "Ctrl");
FreezeTransformations;
orientConstraint ($sel + "Ctrl") $sel;

}


can anyone give me a hint on whats wrong in the code!

the error I am getting is:

// Error: Illegal operation "+" on data of type string[]. //

thanks

-jan

john_homer
08-18-2005, 09:00 PM
I think you must have previously declared $sel as an array..
I changed it to $current and it works fine, would have worked without changing a thing for you if you restarted maya first...

i would also recommend using "makeIdentity" rather than FreezeTransforms... you have more control and dont have to select the object..

see below.

.j


string $currentAll[] = `ls -sl `;
for($current in $currentAll)
{
group -n ($current + "Ctrl_G");
delete `parentConstraint $current ($current + "Ctrl_G")`;
circle -n ($current + "Ctrl");
parent ($current + "Ctrl") ($current + "Ctrl_G");
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 ($current + "Ctrl");
orientConstraint ($current + "Ctrl") $current;
}

bananamation
08-19-2005, 09:20 AM
thank you john_homer!

you were right ofcourse, When I restarted maya it worked. gahh ...do I feel stupid!! I am gonna try that makeIdentity thing also, many thanks.

I am trying to learn Mel-scripting, just bought the book " the art of rigging" from cgToolkit, itīs a really god book, that I can recommend to all MEL-beginners. I have just figured out how much time you can actually save by knowing some MEL.

-jan

CGTalk Moderation
08-19-2005, 09:20 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.