SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.


SM Forums / Maya Questions / Programming / How can I list all objects in a Maya scene in a roll-down list with MEL?

Programming MEL Scripts, Expressions & Programming Related Topics

Join the conversation. Reply to post
 
Thread Tools
20-08-2003, 03:56 PM   #1
vern
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
  Reply with quote
20-08-2003, 04:33 PM   #2
mtmckinley
The Maya Mountain
 
mtmckinley's Avatar
 
Join Date: Aug 2002
Location: Seattle, WA
Posts: 8,245
what about the Outliner? Window > Outliner
__________________
-Mike
www.mtmckinley.net
The Maya Toolbelt
  Reply with quote
20-08-2003, 04:36 PM   #3
dannyngan
Registered User
 
dannyngan's Avatar
 
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
  Reply with quote
26-08-2003, 12:21 PM   #4
vern
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.
  Reply with quote
30-08-2003, 07:42 PM   #5
dannyngan
Registered User
 
dannyngan's Avatar
 
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!
__________________
Danny Ngan
Animator | Amaze Entertainment
my website | my blog | my job
  Reply with quote
01-09-2003, 05:12 PM   #6
vern
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.

/veronica
  Reply with quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Project] Maya Skinning Tool MEL Ideacraft Programming 0 29-05-2016 01:44 PM
moving objects in Maya problems Rurlinn101 Maya Technical Issues 3 03-03-2013 06:05 PM
Maya moves objects in all directions Lesk Maya Technical Issues 3 30-05-2012 08:29 PM
trouble starting maya 2009 Typh Maya Technical Issues 2 03-01-2010 08:33 AM
Is anyone using MEL? dannyngan Programming 40 29-01-2003 10:21 PM