PDA

View Full Version : listAttr -locked??


JFFORTIN
01-09-2005, 04:04 AM
hi guys its pretty late and odnt know what to do with that
i want my script to constraint a skeleton to another and if there is some attr who are lock to pass over so
for the listing and constraint its fine but its to get the list of all the atr who are lock is a little problem i dont know why but it doenst work

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

string $first[] = `ls -sl -dag -type joint $sel[0]`;

string $last[] = `ls -sl -dag -type joint $sel[1]`;

string $attrs[]={".tx",".ty",".tz",".rx",".ry",".rz",".sx",".sy",".sz",".v"};



for ($j = 0; $j < size($last); $j++)

{

string $GetLock = ` listAttr -locked ($last[$j] + $attrs) `;

}
thx for help

seven6ty
01-09-2005, 09:16 AM
for ($j = 0; $j < size($last); $j++)

...Should be:

for ($j = 0; $j < `size $last`; $j++)

...Off the top of my head, that's one error, I'd think.

Edit: Also, your for loop should be based off the size of your $attr variable, instead of your $last variable.

macaroniKazoo
01-09-2005, 09:00 PM
hi guys its pretty late and odnt know what to do with that
i want my script to constraint a skeleton to another and if there is some attr who are lock to pass over so
for the listing and constraint its fine but its to get the list of all the atr who are lock is a little problem i dont know why but it doenst work

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

string $first[] = `ls -sl -dag -type joint $sel[0]`;

string $last[] = `ls -sl -dag -type joint $sel[1]`;

string $attrs[]={".tx",".ty",".tz",".rx",".ry",".rz",".sx",".sy",".sz",".v"};



for ($j = 0; $j < size($last); $j++)

{

string $GetLock = ` listAttr -locked ($last[$j] + $attrs) `;

}
thx for help
listAttr returns an array, not a string. so change the line in the loop to:

string $GetLock[] = ` listAttr -locked ($last[$j] + $attrs) `;

seven6ty: his syntax is fine. you can use either
for ($j = 0; $j < size($last); $j++)

OR

for ($j = 0; $j < `size $last`; $j++)

they're just two different ways of calling a function.

JFFORTIN
01-10-2005, 12:12 AM
ok now i can get my attr who are lock but the thing is my script doenst understand whick joint is lock or not it only show me those attribute who are lock
so i need to get who is lock and if he is lock only orientConstraint and if he is not lock point and OrientConstraint





global proc connectSkeleton()
{
string $sel[] = `ls -sl`;
string $first[] = `ls -sl -dag -type joint $sel[0]`;
string $last[] = `ls -sl -dag -type joint $sel[1]`;
string $attrs[]={".tx",".ty",".tz",".rx",".ry",".rz",".sx",".sy",".sz",".v"};
string $GetLock[] = ` listAttr -locked $last`;
if (`size $GetLock` > 0)
{
for ($i = 0; $i < size($first); $i++)
{
for ($x = 0; $x < size($last); $x++)
{
orientConstraint $first[$i] $last[$i];
pointConstraint $first[$i] $last[$i];
}
}
}
else
{
for ($i = 0; $i < size($first); $i++)
{
for ($x = 0; $x < size($last); $x++)
{
orientConstraint $first[$i] $last[$i];
}
}
}
}

CGTalk Moderation
01-20-2006, 09:00 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.