PDA

View Full Version : Query skinClusters


MikeRhone
12-09-2003, 05:05 AM
I was wondering if anyone knows how to select all `skinClusters` affecting a piece of geometry and how to assign them to a variable. I've been pulling my hair out trying to figure this one out.

So far I have:


//lists the history affecting a piece of geometry, outputs all history, including the skinClusters:

string $currentHis[] = `listHistory CurrentGeometry`;


//lists all skin clusters in the scene

string $currentSkinCluster = `selectedNodes -typ skinCluster`;

I don't know how to use the first command to only accept skinCluster nodes. It doesn allow for a -typ flag. Are there any suggestions?

Mike R

dwalden74
12-09-2003, 07:35 AM
I did it like this:
{
string $selection[] = `ls -sl`;
if (! `size($selection)`)
error "Nothing selected.";
string $shapeNode[] = `listRelatives -s $selection[0]`;
string $allSkinClusters[] = `ls -type skinCluster`;
string $geometries[];
string $skinCluster;
for ($c in $allSkinClusters)
{
$geometries = `skinCluster -q -g $c`;
if ($geometries[0] == $shapeNode[0])
{
$skinCluster = $c;
}
}
print $c;
}


You could do the same with listHistory however:

string $selection[] = `ls -sl`;
string $skinClusters[];
int $i = 0;
for ($s in $selection)
{
string $currentHis[] = `listHistory $s`;
for ($c in $currentHis)
{
if (`nodeType $c` == skinCluster)

}

}

dwalden74
12-09-2003, 07:40 AM
Oops... damn Tab key sent my message prematurely... anyway it would look like this:

{
string $selection[] = `ls -sl`;
string $skinClusters[];
int $i = 0;
for ($s in $selection)
{
string $currentHis[] = `listHistory $s`;
for ($c in $currentHis)
{
if (`nodeType $c` == "skinCluster")
{
$skinClusters[$i] = $c;
$i++;
}
}
}
for ($s in $skinClusters);
print ($s + "\n");
}

MikeRhone
12-09-2003, 09:16 PM
Thanks Dwalden!

2 answers, and both work perfectly! Thanks!

Mike R

MikeRhone
12-11-2003, 04:29 AM
Crap. Ok. I cant seem to get this to work if I have more than one skin cluster in the scene.

My test:

Grabbed a 2 bone chain, bound it to a cylinder

made a second one and bound it

Used the script on either arm geometry seperately, and it always returned the second skinCluster.

Any ideas? Im not quite experienced enough to figure out exactly how your code figues itself out jsut yet.

Mike R

dwalden74
12-11-2003, 07:51 AM
Oops sorry, here´s the correct syntax to do that:

{
string $selection[] = `ls -sl`;
string $skinClusters[];
int $i = 0;
for ($s in $selection)
{
string $currentHis[] = `listHistory $s`;
for ($c in $currentHis)
{
if (`nodeType $c` == "skinCluster")
{
$skinClusters[$i] = $c;
$i++;
}
}
}
print $skinClusters;
}

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