SimplyMaya Forums

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

Home / forum / Animation / Mel Scripts & Programming / How can I list all objects in a Maya scene in a roll-down list with MEL?
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 20-08-2003, 03: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, 04: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, 04: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, 12: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, 07: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, 05: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
New Thread

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

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 06:26 PM
Maya Hair/Polygon Error ingram_no.7 Members Lounge 13 10-12-2010 10:27 AM
LayoutTools for Maya 2011 is here... ctbram Members Lounge 1 06-12-2010 10:32 PM
Strange Problem - Unable to change attributes for multiple objects anthonysw3 Technical Issues 4 04-12-2010 10:56 PM
MEL headache!! happymat27 Mel Scripts & Programming 1 03-12-2010 03:41 PM

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.