Hey Tim,

1. I know how to create my own custom menu at launch via userSetup.py, but
> I'm having trouble understanding how I would do this instead via a
> distributed plugin. The docs I've been looking at for custom commands, for
> example, are clear about what's necessary for Maya to recognize a
> registered command, but I don't see how to 'register' a custom menu. I
> tried to cheat my way around it by placing my buildMenu() code inside my
> custom command's initializePlugin() function, but that failed. I've seen
> one or two partial examples of a *registerUI()* method I can call, but I
> can't find any solid documentation on this. Anyway... just looking for some
> tips there on moving my custom menu out of the userSetup and into a shared
> plugin on the network.


How I've done it in the past is I put the menu creation in the
plugin's initializePlugin, and the menu deletion in the
plugin's uninitializePlugin.  In C++ it looks something like:

MString cmd = "ChaDeformationsMenu(\"mainDeformationsMenu\");";
        cmd+= "menuItem -p \"mainDeformationsMenu\" -divider true
\"tbIMMenuDivider\";";
cmd+= "menuItem -p \"mainDeformationsMenu\" -l \"tbImageMultiplier\" -c
(\"deformer -type tbImageMultiplier\") \"tbImageMultiplierMenuItem\";";
// cmd+= "menuItem -p \"mainDeformationsMenu\" -l \"tbSurfaceTension\" -c
(\"deformer -type tbSurfaceTension\") \"tbSurfaceTensionMenuItem\";";
MGlobal::executeCommandOnIdle(cmd);

That is an odd one because I was actually adding onto Maya's deformation
menu.  This will obviously be different depending on what you'd like to do.
 Inside of the uninitializePlugin it looks like:

MGlobal::executeCommandOnIdle("deleteUI -mi \"tbIMMenuDivider\"
\"tbImageMultiplierMenuItem\" \"tbSurfaceTensionMenuItem\";");

In Python you wouldn't need to call the C++ methods.


2. Is it possible to have a custom plugin auto-load without requiring the
> user to explicitly check the option to auto-load it in the Plugin Manager?


You would need to do this in a startup script or in a custom "plugin
manager" which would also run via a startup script.  This is really the
only way to accomplish something like this.  Once a user has loaded a
plugin once, they can have it set to auto-load in the future...One other
way (not sure how kosher this is) is to modify the user's auto-load
preferences the first time they load your plugin...I've never actually done
that before.

3. Maya 2015 seems to take much longer than 2014 to shutdown. Is it just me
> or is something really different here?


Haven't used 2015 yet so not sure about this one...

Hope this helps!


On Mon, Apr 21, 2014 at 11:49 AM, Tim Crowson <[email protected]> wrote:

> I've got another set of questions here as I try to wrap my head around how
> Maya does things. I'm sure these are fairly mundane things in the end...
>
> 1. I know how to create my own custom menu at launch via userSetup.py, but
> I'm having trouble understanding how I would do this instead via a
> distributed plugin. The docs I've been looking at for custom commands, for
> example, are clear about what's necessary for Maya to recognize a
> registered command, but I don't see how to 'register' a custom menu. I
> tried to cheat my way around it by placing my buildMenu() code inside my
> custom command's initializePlugin() function, but that failed. I've seen
> one or two partial examples of a *registerUI()* method I can call, but I
> can't find any solid documentation on this. Anyway... just looking for some
> tips there on moving my custom menu out of the userSetup and into a shared
> plugin on the network.
>
> 2. Is it possible to have a custom plugin auto-load without requiring the
> user to explicitly check the option to auto-load it in the Plugin Manager?
>
> 3. Maya 2015 seems to take much longer than 2014 to shutdown. Is it just
> me or is something really different here?
>
> Thanks again for any help!
>
> -Tim Crowson
> Magnetic Dreams
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/CAPh%3D1bm6PAx37afDQOEx_s%2BLpdLMCApauAxnW1960REdmcBvJA%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAPh%3D1bm6PAx37afDQOEx_s%2BLpdLMCApauAxnW1960REdmcBvJA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
-tony

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAJhmvsTvOHFeq4bwZqAMcrs_c5iCPDiD7aVZ7f41qHhRRiC3_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to