Maya Training

Introduction to Hard Surface Modeling

Maya Training

Interiors and Furniture Vol 1 & 2 - Modeling & Cloth

Maya Training

Shading, Lighting and Rendering the Bedroom in MR

Maya Training

Robot volume one - Modeling with animation in mind

Maya Training

Spach-Alspaugh House the complete courseware

Maya Training

Burt The Cartoon Dinosaur Vol 01 - Modeling

New Maya Training

Robot Volume 02 - Hybrid Rigging
You are here > Home > SimplyMaya Community Forums
Loading

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!


Go Back   Simply Maya User Community - Maya Tutorials > Animation > Mel Scripts & Programming
Register FAQ Members List Calendar Mark Forums Read

Reply
 
Thread Tools
Old 20-08-2003, 04:56 PM   #1
vern
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question 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
vern is offline   Reply With Quote
Old 20-08-2003, 05:33 PM   #2
mtmckinley
The Maya Mountain
 
mtmckinley's Avatar
 
Join Date: Aug 2002
Location: Seattle, WA
Posts: 8,245
Thanks: 1
Thanked 25 Times in 25 Posts
Default

what about the Outliner? Window > Outliner
__________________
-Mike
www.mtmckinley.net
The Maya Toolbelt
mtmckinley is offline   Reply With Quote
Old 20-08-2003, 05:36 PM   #3
dannyngan
Registered User
 
dannyngan's Avatar
 
Join Date: Dec 2002
Location: Seattle, WA
Posts: 1,154
Thanks: 0
Thanked 1 Time in 1 Post
Default

You should look up the "ls" command in the MEL command reference.
__________________
Danny Ngan
Animator | Amaze Entertainment
my website | my blog | my job
dannyngan is offline   Reply With Quote
Old 26-08-2003, 01:21 PM   #4
vern
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
vern is offline   Reply With Quote
Old 30-08-2003, 08:42 PM   #5
dannyngan
Registered User
 
dannyngan's Avatar
 
Join Date: Dec 2002
Location: Seattle, WA
Posts: 1,154
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
dannyngan is offline   Reply With Quote
Old 01-09-2003, 06:12 PM   #6
vern
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
vern is offline   Reply With Quote
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem solving many dynamic objects in a pile? rohiniduggal Dynamics & Special Effects 3 14-01-2011 07:26 PM
Maya Hair/Polygon Error ingram_no.7 Members Lounge 13 10-12-2010 11:27 AM
LayoutTools for Maya 2011 is here... ctbram Members Lounge 1 06-12-2010 11:32 PM
Strange Problem - Unable to change attributes for multiple objects anthonysw3 Technical Issues 4 04-12-2010 11:56 PM
MEL headache!! happymat27 Mel Scripts & Programming 1 03-12-2010 04:41 PM

Thread Tools





A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2015 SimplyMaya - vBulletin® Copyright © 2000-2015, Jelsoft Enterprises Ltd.