PDA

View Full Version : Find groups in a scene


isamuraiqat
03-14-2007, 11:30 AM
hello ppl! ive been working on a script and i need to find the groups in that scene.. just the groups.. and group node is modified as a "transform" node not as a "group".. so the only thing i know is that its a transform node that doesnt have a shape node.. thought maybe i cld look around that but i cant seem 2 find a way to define the relative(thru listRelatives) as "shape".. cause its defined as "mesh " or "nurbsCurve" and i cant find a way 2 return the shape node as "shape".. sorry 4 the complications but if anyone has an idea plz lemme know... thnx

Segmoria
03-14-2007, 03:20 PM
I can't think of a more direct way atm, but yes you could try going through all the tranform nodes in your scene to see if they have any shape nodes as children, which in that case would mean that they are groups. Just use something like the following:

string $allTransform[] = `ls -transforms`;
for ($i in $allTransform)
{
if ((size(`listRelatives -shapes ($i)`)) == 0)
{
print ("\nGroup: " + $i);
}
}

Don't forget, polygon meshes, nurbs curves and surfaces are all "shape" type nodes.
Hope this helps!

isamuraiqat
03-14-2007, 08:18 PM
ya had this in mind.. but i wanted sth kinda fool proof.. thnx a lot anyway

Robert Bateman
03-15-2007, 10:42 AM
That's as good as you'll get unless you tag the transforms with some dynamic attr (ie, "is_group")

CGTalk Moderation
03-15-2007, 10:42 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.