View Full Version : Dynamic popupMenu

James Jackson
04 April 2003, 02:32 AM
Hi I was wondering if there is a way to take the list of perspective cameras in a scene

string $perspCameras[] = `listCameras -p`;

and have a dynamic popupMenu that takes all there names and calls on the lookthru command?

I would like to add it to the hotbox persp camera popupMenu.
Does this make scene?

I am reading the awesome book "Mel Scripting for Maya Animators" by Mark Wilkins. Great book Mark!
I am not all the way threw it but want to test my skills...see if I can think ahead of the book. ;)

So if anyone can help me off in the right direction I would be great full.


04 April 2003, 05:43 PM
Does this make scene?

Sure it does! In fact, Ive written a script that does exactly this. If you want, send me a personal message with your e-mail address and I can send the script to you.


James Jackson
04 April 2003, 06:35 PM
lol, scene!

oops ;)

PM sent


04 April 2003, 07:46 PM
In case anyone elses is wondering, the trick is to use the -postMenuCommand to fill the menu at the moment it pops up (and delete the menuItems from the last time it was used. Like this:

// Put this where youre creating the menu, after creating a button or whatever.
$popupMenu = `popupMenu`;
popupMenu -e -postMenuCommand ("buildMenu " + $popupMenu + ) $popupMenu;

// then use this proc to empty and then fill the menu
global proc buildMenu (string $menu,)
popupMenu -e -deleteAllItems $menu;
setParent -menu $menu;
menuItem -l "Hello";

CGTalk Moderation
01 January 2006, 12:00 AM
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.