View Full Version : looking for the syntax to select all objects in scene.

02 February 2008, 02:50 AM
i tried typing.

select -all;
ls -sl;
// Result: layersFilter objectTypeFilter69 defaultRenderLayerFilter objectNameFilter4 renderLayerFilter objectTypeFilter70 objectScriptFilter10 renderingSetsFilter objectTypeFilter71 relationshipPanel1LeftAttrFilter relationshipPanel1RightAttrFilter polyCube1 deleteComponent1 polySplitRing1 polySplitRing2 polyExtrudeEdge1 polyExtrudeEdge2 polyExtrudeEdge3 jBrick0 jBrick1 jBrick2 jBrick3 jBrick4 jBrick5 jBrick6 jBrick7 jBrick8 jBrick9 //

im looking for a result more like.

// Result: jBrick0 jBrick1 jBrick2 jBrick3 jBrick4 jBrick5 jBrick6 jBrick7 jBrick8 jBrick9 //

it seems to be selecting all the nodes in the scene. instead of just the objects i want selected.

02 February 2008, 05:55 AM
does this get you closer to what you want:

select `ls -dag`;

it's hard to tell from your example, but i'm assuming that the brick objects are shapes or transforms or something like that, which makes them DAG objects, while the other objects that you don't want are not DAG objects.

keep in mind that if you want to get a list of objects, use the ls command with the appropriate flags instead of going through the select command. it is much slower to do this:

select -all;
string $objs[] = `ls -sl`;

than it is to do this:

string $objs[] = `ls`;

but both achieve the same thing.


02 February 2008, 06:09 AM
I'm assuming you want just the geometry in the scene? There are a few ways you can do this, here are a couple...

//This way is quite handy because you can add different types to the ls command.
//In this example I can get all the meshes and nurbsCurves in the scene.
string $getMeshes[] = `ls -dag -ni -type mesh -type nurbsCurves`;
string $getTransform[] = `listRelatives -p $getMeshes`;

//or you can do it this way...
//This is a little more simple in that the geometry tag will grab all geometry within a scene.
//The tags that listTransforms recognises are the same as the ls command.
listTransforms -geometry;

02 February 2008, 04:00 PM
u guys rock!! everythings working.. Thank you.

CGTalk Moderation
02 February 2008, 04: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.