PDA

View Full Version : querying selection type



sanfx
03-20-2009, 01:35 AM
I am trying to query the selection type of the objects in selection with the code below , i do get the right result but when i execute it second time but at first it says its transform.


string $sel[]=`ls -selection`;
pickWalk -d down;
for ($each in $sel)
{

string $nodeType = nodeType( $each );
print $nodeType;
print "\n";
}

please help...

chrisg
03-20-2009, 08:52 AM
Hi sanfx,

You need to put the pickWalk -d down; line above the string declaration. As you have it now, you are taking a 'picture' of all the nodes, then moving down the selection, then printing the node type of all the nodes in that earlier picture, not the current selection.

It's like this. If Holder1 = "A" and Holder2 = "B", if you say Holder1 = Holder2, then both would be "B". If you then said Holder2 = "C", Holder1 would still be "B".

string $sel[]=`ls -selection`; //This grabs all the transform nodes.
pickWalk -d down; //Now, in the workspace, you get the nodes you want, but never put them back in the $sel variable.

for ($each in $sel) // for each node in the transform nodes you grabbed earlier.

Hope this helps!

sanfx
03-20-2009, 12:30 PM
otherwise is this the way you will do to find out if the objects in selection are either mesh or nurbSurface ?


pickWalk -d down;
string $sel[]=`ls -selection`;
for ($each in $sel)
{
string $nodeType = nodeType( $each );
print $nodeType;
print "\n";
}