Adverti horiz upsell

MenuEditor 0.0.1 for Maya (maya script)

You can easily create menus for any objects in a scene! Very simple and powerfull!

License
Button download
107 Downloads

Compatibility

  • 2016, 2015, 2014, 2013, 2012, 2011, 2010, 9.x, 2009, 2008, 8.x

Operating Systems

  • Windows

History

Created:08/10/2010
Last Modified:10/27/2021
File Size: 22.2 KB

Keywords

maya, menu, GUI

Q/A

Maya 2016

Date:03/17/2017
Submitted by: Antonio Govela Antonio Govela
Hi, I can't get it to work in Maya 2016. Please help.
Thanks!
 

Replies to this question:

  • Alexander Zagoruyko

    Alexander Zagoruyko said over 5 years ago:

    Hello!
    Thers is the simpliest way to get the script to work in any Maya versions:
    1. Open dagMenuProc.mel
    2. Find the following line: "if (`popupMenu -e -exists $parent`) {". It must be somewhere in dagMenuProc function.
    3. Just bellow the next line (that is "setParent -m $parent;") insert the following MEL commands:
    //-------------------------------------------------
    if (`attributeExists "menu" $object`){
    string $names[] = parseNames($object); // {namespace,shortName}
    menuItem -l ("[ "+$object+" ]") -bld true -en true;
    string $menu = `getAttr ($object+".menu")`; // get a menu
    $menu = `encodeString $menu`; // convert " to \"
    $menu = substituteAllStrings($menu,"<SELF>",$object); // replace <SELF> to real name
    $menu = substituteAllStrings($menu,"<NAMESPACE>",$names[0]); // replace namespace
    python("exec(\"code="+$menu+"\");menu=Menu(code);menu.buildIn(\""+$parent+"\")");
    return;
    }//if
    //-----------------------------------------------------
     
    4. So you should get something like this:
    ....
    if (`popupMenu -e -exists $parent`) {
    setParent -m $parent;
    INSERTED_MEL_COMMANDS
    string  $currContext = `currentCtx`;
    ....
    The main idea is to put our code into popupMenu showing.
     
    5. Also you must define functions parseNames and substituteAllStrings:

    global proc string[] parseNames(string $obj){
    string $buffer[];
    string $namespace = "";
    int $num = `tokenize $obj ":" $buffer`;
    string $shortName = $buffer[$num-1];
    if ($num>1)
    for ($i=0;$i<$num-1;$i++) $namespace += $buffer[$i] + ":";
    return {$namespace,$shortName};
    } // parseNames

    global proc string substituteAllStrings(string $str,string $oldStr,string $newStr){
    string $subst = `substitute $oldStr $str $newStr`;
    if ($subst == $str) return $str;
    else return substituteAllStrings($subst,$oldStr,$newStr);
    } // substituteAllStrings

    I put these functions just above dagMenuProc function definition.
     
    6. Save dagMenuProc.mel and reload Maya

    Another way: give me your email and I'll send you Maya 2016 dagMenuProc. I've had it prepared.

Post a reply: