PDA

View Full Version : Get objects in scene


Cthulhu
11-19-2009, 02:53 PM
Hey,

I am trying to do a pretty basic script which just lists my objects in the scene like the Outliner.

The thing is, I have no idea how get the correct objects, because the "ls" command lists all kind of stuff that I do not want.

Example:

I have a camera. In the Outliner, it is listed as "camera1"

now, when I do a "ls -cameras", the result is "cameraShape1", which is not what i wanted.

What can I do to get the same results as shown in the Outliner?

Thanks for your help!

safakoner
11-19-2009, 04:38 PM
ls -sl
-sl for selection

Cthulhu
11-19-2009, 04:49 PM
Well.. thanks, but this would be too easy ;)

I do not want to just list the selected objects, but all objects in the scene..

I found a way now, not very clean, but it seems to work.

I get a complete list with ls -dag, then another list with ls -shapes and subtract it from the first list, now I have a list of all objects which matches the list in the Outliner.

Emil3d
11-19-2009, 06:19 PM
By default the Outliner shows only the transformable nodes plus the default light and object sets, however using its menus you can change what kind of objects it will show.
I'm not sure if there is a mel command that can tell what is currently Outliner set to show.

To list all transform nodes in a scene you can use:
ls -tr;

in the Script Editor type:
help ls;
and Maya will show you a list with all flags

CGTalk Moderation
11-19-2009, 06:19 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.