Hey guys,
I'm having a weird problem with a code. Actually code itself runs and works well.
But when I try to put it in a procedure, it says "undeclared variable" about a variable that I only declare and use in that procedure.
Here is the code:
(it is the $selVerts variable in tokenize row that it says undeclared. and also the $each in for loop. To mention again; there's no problem without procedure.)
proc $ToVerts() {
string $selVerts[] = `ls -sl -fl`;
string $cl[] = `newCluster " -relative -envelope 1"`;
select -cl;
string $jnt = `joint`;
string $ptCnsJnt[] = `pointConstraint $cl $jnt`;
string $findPtCns[] = `listRelatives -type pointConstraint $jnt`;
float $jointX = `getAttr ($jnt + ".translateX")`;
float $jointY = `getAttr ($jnt + ".translateY")`;
float $jointZ = `getAttr ($jnt + ".translateZ")`;
select $findPtCns[0] $cl[0] $jnt; doDelete;
string $num[];
$numoftokens = `tokenize $selVerts[0] "." $num`;
xform -ws -piv $jointX $jointY $jointZ $num[0];
select -cl;
for ($each in $selVerts)
{
select -add $each;
}
}
I'm new to proedures, and couldn't find why this is happening.
Thank you in advance.
Replies
Thank you Rabbid_Cheeze and passerby