Dynamic popupMenu


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. :wink:

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



Does this make scene?

Sure it does! In fact, I´ve 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.



lol, scene!

oops :wink:

PM sent



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";


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.