PDA

View Full Version : get only the trasnform node...


egf
10-12-2005, 07:30 PM
I abandonment. the head me hurts

Any can tell me the trik for can select only the transform nodes from the geometry. not the cameras, and not the shapes.

string $object[]=`ls -dag`;//this get the all :(

string $object[]=`ls -g`;//this only get the shape :(

string $object[]=`ls -tr`;//this get the the trasform but include the cameras :(


thanks .

Robert Bateman
10-13-2005, 11:08 AM
ls -type transform;

for all nodes derived from transform

or

ls -exactType transform;

for only transforms (ie, ignores joints, ik handles etc)

mhovland
10-13-2005, 01:26 PM
You will have to use your selection that includes cameras, and then create a new array without the cameras.

Loop through your selection array and test each member using the nodeType command,

I will post an example when I get in to work.

Robert Bateman
10-13-2005, 02:49 PM
sorry mis-read first time around.....


global proc string[] getXforms(string $fromType) {
$items = `ls -type $fromType`;
string $xforms[];
for( $i in $items ) {
$parents = `listRelatives -p $i`;
for($p in $parents) $xforms[size($xforms)]=$p;
}
return $xforms;
}


so now to get all transforms for a mesh you can do...

select -r `getXforms "mesh"`;

I guess for all dag objects excluding cameras you could do...



global proc string[] getXforms2() {
$items = `ls -dag`;
string $xforms[];
for( $i in $items ) {
if( "camera" != `nodeType $i`) {
$parents = `listRelatives -p $i`;
for($p in $parents) $xforms[size($xforms)]=$p;
}
}
return $xforms;
}

mhovland
10-13-2005, 04:48 PM
Rob beat me to the code, and his is cooler than what I would have posted anyway.

egf
10-13-2005, 06:33 PM
thanks, but if you run this code you geting a surprise,

//side is a dag camera you can test when front, top.
if("camera" == `nodeType side`) {print "Iam a camera node";}

else

{

if ("transform" == `nodeType side`) {print "Iam a transform node";}

};


any way thaks. I find a whorearound :).

Robert Bateman
10-14-2005, 02:26 PM
what suprise would that be? A camera is only a shape that is parented under a transform (the same as every other dag object in Maya), so yes "side" is a transform which places the camera "sideShape" in the world. What's suprising about that? or have i missed something?

egf
10-15-2005, 11:45 AM
My fault sorry
thaks

CGTalk Moderation
10-15-2005, 11:45 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.