View Full Version : error in my list selection script

08 August 2005, 01:11 PM

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");
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[]. //



08 August 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.


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;

08 August 2005, 09:20 AM
thank you john_homer!

you were right ofcourse, When I restarted maya it worked. gahh 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.


CGTalk Moderation
08 August 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.