Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / MEL / Adding a dynamic menu to hotbox zone marking menu ..is it possible?
  RSS 2.0 ATOM  

Adding a dynamic menu to hotbox zone marking menu ..is it possible?
Rate this thread
 
63878
 
Permlink of this thread  
avatar
  • Total Posts: 1
  • Joined: 09 November 2011 06:22 AM

Hi there,
I’m trying to add a list of my scene’s perspective cameras to my hotbox.  This has been a feature I’ve always wished Maya could have...and so I’m venturing down dark twisted roads....bleh.

I can get it to list out a menu, but I have to keep executing my script to update it. 
I’d also love it if I could get it to show just below the existing Hotbox -Center zone’s marking menu. 

Not sure if you can add something dynamically created there...yes?no?maybe?help?

Here’s what I have so far....I’ve taken code from maya scripts folder.

Any and all help is greatly appreciated!

Thanks

$panelz = `getPanel -withFocus`;
global 
proc buildPerspLookthruHBMenustring $parentstring $panelz)
{
    $panelz 
= `getPanel -withFocus`;
    
string $panelzType = `getPanel -to $panelz`;
    if (
$panelzType == "modelPanel")
    
{
        
print $panelz;
        
string $cameras[] = `listCameras -perspective`;
        
string $Ocameras[] = `listCameras -orthographic`;
    
        
// Rebuild menu
        //
    
        
setParent -m $parent;
    
        
menu --deleteAllItems $parent;
    
        
python("from maya.app.stereo import stereoCameraRig");
        for (
$camera in $cameras)
        
{
     
// Prune out any children of camera rigs. Non camera
     // rigs only have 1 camera.
     //
     
int $isMono python("stereoCameraRig.rigRoot('"+$camera+"') == ''");
     if (
$isMono)
     
{
     menuItem 
-l $camera -command
     
("lookThroughModelPanel "+$camera+" "+$panelz);
     
}
     
        }
            python
("from maya.app.stereo import stereoCameraRig");
        for (
$Ocamera in $Ocameras)
        
{
     
// Prune out any children of camera rigs. Non camera
     // rigs only have 1 camera.
     //
     
int $isMono python("stereoCameraRig.rigRoot('"+$Ocamera+"') == ''");
     if (
$isMono)
     
{
     menuItem 
-l $Ocamera -command
     
("lookThroughModelPanel "+$Ocamera+" "+$panelz);
     
}
     } 
    }     
}


buildPerspLookthruHBMenu
("MayaWindow|HotboxCenter1"$panelz);


Replies: 0