'For' loop .....Problem???????

'For' loop .....Problem???????

Anonymous
Not applicable
333 Views
2 Replies
Message 1 of 3

'For' loop .....Problem???????

Anonymous
Not applicable
Hi, I have a little bit problem with for loops
Im having 5joints spine IK chain.

when I run following code it give error

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

my simple code is
/////////////////////////////////////////////////////////////////////////
string $ikHandle []=`ls -sl`;
string $ikBone []=`ikHandle -q -jl $ikHandle`;

string $mdScale =`shadingNode -asUtility multiplyDivide`;

for ($eachBone in $ikBone)
{
connectAttr -force ($mdScale + ".outputX") ($ikBone + ".scaleX")
}
///////////////////////////////////////////////////////////////////////////

I just want to connect outputX of multiplyDivide node to each bone in a loop

But Maya gives me this error!!

Can anybody please solve my problem?
0 Likes
334 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
You concatenating $ikBone and ".scaleX" whee you should have used $eachBone

this works:


string $ikHandle[] = `ls -sl`;
string $ikBone[] = `ikHandle -q -jl $ikHandle`;
string $mdScale = `shadingNode -asUtility multiplyDivide`;
string $eachBone;
for ($eachBone in $ikBone) {
connectAttr -force ($mdScale + ".outputX") ($eachBone + ".scaleX")
}
0 Likes
Message 3 of 3

Anonymous
Not applicable
oooh!! god! that was so easy!!

Thanks you!! U finalize my stretchy Spline IK script.
0 Likes