Introduction to Maya - Modeling Fundamentals Vol 1
This course will look at the fundamentals of modeling in Maya with an emphasis on creating good topology. We'll look at what makes a good model in Maya and why objects are modeled in the way they are.
# 1 20-08-2003 , 03:56 PM
Registered User
Join Date: Aug 2003
Posts: 3

How can I list all objects in a Maya scene in a roll-down list with MEL?

Hi,

I am making a GUI with MEL and I want to list all objects in the Maya scene (both selected and unselected) when the GUI open. Right now I am just writing my own labels to choose from, but I would like to generate the list from the scene. How can I get hold of all objects in scene to this list?

optionMenuGrp -label "Objects";

menuItem -label "Sphere";
menuItem -label "Ball";
menuItem -label "Cube";

THANKS,

veronica

# 2 20-08-2003 , 04:33 PM
mtmckinley's Avatar
The Maya Mountain
Join Date: Aug 2002
Location: Seattle, WA
Posts: 8,245
what about the Outliner? Window > Outliner

# 3 20-08-2003 , 04:36 PM
dannyngan's Avatar
Registered User
Join Date: Dec 2002
Location: Seattle, WA
Posts: 1,154
You should look up the "ls" command in the MEL command reference.


Danny Ngan
Animator | Amaze Entertainment
my website | my blog | my job
# 4 26-08-2003 , 12:21 PM
Registered User
Join Date: Aug 2003
Posts: 3

Still problem with listing objects! Help appreciated!

Hi,

Thank for the help about using the ls command. I can understand that I can obtain all objects in the scene with this one now. But I have still a problem with how to list it in my optionMenuGrp. Can anyone help me with this?

// List all objects in the scene
string $allObjects[];
$allObjects = `ls`;
optionMenuGrp -label "Objects";
menuItem -label $allObjects;

I guess the step were I put the string as one of the labels in the optionMenuGrp is were I do the wrong thing. Can I use this command at all to list the objects in the scene in this list?

I can run the script but the result in the list becomes only "time1" even though I have created a sphere in the scene.

# 5 30-08-2003 , 07:42 PM
dannyngan's Avatar
Registered User
Join Date: Dec 2002
Location: Seattle, WA
Posts: 1,154
It's possible that you may not be able to use a string array as a single menuItem. You might have to create a separate menuItem for each entry in the array. I haven't tried this myself though. Give it a shot and see what happens! user added image


Danny Ngan
Animator | Amaze Entertainment
my website | my blog | my job
# 6 01-09-2003 , 05:12 PM
Registered User
Join Date: Aug 2003
Posts: 3
Hi,

This is one SOLUTION of the problem:

// List all objects in the scene
string $allObjects[];
string $tempName;
$allObjects = `ls -g`;
optionMenuGrp -label "Objects";
for ($tempName in $allObjects)
{
menuItem -label $tempName;
}


It seemed to work for me, thanks for help. If anyone knows how to select an object in the scene depending on which one is selected from this please write a post. I think I will have to use the select command in combination with the changeCommand flag for the optionMenuGrp, but I am not sure. user added image

/veronica

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads