Thanks guys! As for my issue with adding the menu, I was able to get some help over on the Maya-Python list.
-Tim

On 4/17/2014 11:29 AM, Andy Jones wrote:
You can pass a string command to maya.utils.executeDeferred like this:

maya.utils.executeDeferred("allIWantToDoIsBuildAMenu('FFS')")

I guess that will run your code when Maya finally goes idle or something. There may also be some trickery you can do that will force Maya to evaluate the main menu early.

Just don't try to parent a menu to 'renderView' because apparently that never exists, and when it does, it's volatile. So maybe you could do it with some kind of callback... I think maybe it's the same for other volatile windows, but I haven't really tried.

http://help.autodesk.com/cloudhelp/2015/ENU/Maya-Tech-Docs/CommandsPython/callbacks.html

Apparently there's a callback specifically for adding render passes to the render view menu, but not for adding menu items to it in general? Very odd. The Maya callbacks kind of seem like a random assortment of hooks asked for by various studios at various times.

Best of luck!



On Thu, Apr 17, 2014 at 6:30 AM, Tim Crowson <[email protected] <mailto:[email protected]>> wrote:


    And no this isn't the only place I'm asking this :-)

    I'm getting into the Maya API and I need to port some of our tools
    over from Soft. Google gives me all kinds of interesting links,
    but I'm curious to know from people here who have done dev work
    for both Soft and Maya (there's so many of you, I know right?) if
    you can recommend resources for learning how to create a proper
    Python-based plugin in Maya. Basically, what's the equivalent to
    the XSI Addon or the self-installing plugin? Stuff like that. I
    think I can figure out the deployment side of things. I'm just
    wondering what's required for a Python plugin to be a python
    plugin in Maya. Would be nice to have /Ye Olde SDK Wizarde/ around....


    And on another note....

    I know this isn't a Maya list.... but since I'm here and you've
    read this far... here's something on the weird chance you might
    know... I've been messing around in Maya 2015 with my userSetup.py
    to have a custom menu pop up in the menu bar at launch. But the
    userSetup.py file seems get run /prior to/ the Maya Window being
    initialized, so it fails to add my menu because it can't get the
    main window to which it needs to add the menu. The main window is
    simply returned as a NoneType object. The function looks something
    like this...

    /def buildMenu()://
    //    ptr = mui.MQtUtil.mainWindow()  # at launch this returns None//?
    //    mayaWindow = shiboken.wrapInstance(long(ptr), QtGui.QWidget)//
    //
    //    mainMenu = cmds.menu('MyMenu', p=mayaWindow, l='My Menu')//
    //    cmds.menuItem(p=mainMenu, d=True, dl='Some Divider')//
    //    cmds.menuItem(p=mainMenu, l='Some Tool')/

    The error comes from /wrapInstance(long(ptr))/, because ptr is
    being returned as /None/.

    Anyway, on the off-chance...

--

Reply via email to