Hey Tim, I was just curious if you needed the overhead of a full on Maya plugin, and not calling you out in anyway :)!! I know you are new to the Maya thing so that's why I pointed it out. I typically only go the plugin route when I need to create custom Maya nodes, otherwise I just stick to simple python modules that are made available in the python path. There isn't a wrong way to do it, but as you mentioned before in a previous email, making sure everything is loaded that's needed is another hurdle that could be avoided by simply making sure your python code is available to be imported.
As far as unloading goes, not sure why you would need to unload something like a ShotSetup command, but I see where having used Workgroups in Soft could lead one to gravitate towards using plugins. Most everything you'd need to do is most likely available via the python API (events, callbacks, UI, etc) without having to create a proper Maya plugin. Also using python modules should help keep everything tidy and in one place. These are just my opinions! What you are doing is definitely not wrong, just may be unnecessary depending on your end goals. On Tue, Apr 22, 2014 at 10:46 AM, Tim Crowson <[email protected]> wrote: > Oh I dunno... to have it self-contained and neat I guess... something we > can unload if necessary. To be honest I'm so new to dev work in Maya I'm > totally open for suggestions. > > > On Tue, Apr 22, 2014 at 9:41 AM, Tony Barbieri <[email protected]> wrote: > >> Ah ok. I thought it was just a python callable, not a full on maya >> registered command. I'm just curious, why go through the trouble of >> developing a full on Maya plugin to do Shot setup? >> >> >> On Tue, Apr 22, 2014 at 10:31 AM, Tim Crowson <[email protected]> wrote: >> >>> It's a Maya registered command. >>> >>> But I got it working now... using: >>> *cmds.menuItem(p=shotsMenu, l='Shot Setup', c=cmds.ShotSetup)* >>> instead of: >>> >>> *cmds.menuItem(p=shotsMenu, l='Shot Setup', c=ShotSetup)* >>> >>> Which makes sense in hindsight... >>> >>> >>> >>> On Tue, Apr 22, 2014 at 9:26 AM, Tony Barbieri <[email protected]>wrote: >>> >>>> Np! :). >>>> >>>> As long as the ShotSetup command is available in the scope where you >>>> are creating the menu item it should work. When you say command, is this a >>>> Maya plugin registered command or just a simple python callable? >>>> >>>> >>>> On Tue, Apr 22, 2014 at 10:21 AM, Tim Crowson <[email protected]>wrote: >>>> >>>>> "Tony", sorry.... >>>>> >>>>> >>>>> On Tue, Apr 22, 2014 at 9:21 AM, Tim Crowson <[email protected]>wrote: >>>>> >>>>>> Thanks Toni, I actually tried that at one point and get the same >>>>>> error, except that the error happens when the menu tries to initialize. >>>>>> But >>>>>> I'm confident my command is working correctly. Perhaps it has to do with >>>>>> the order in which things get loaded? Maybe my menu plugin is being >>>>>> loaded >>>>>> before Maya loads the command plugin? >>>>>> >>>>>> -Tim >>>>>> >>>>>> >>>>>> On Tue, Apr 22, 2014 at 9:12 AM, Tony Barbieri <[email protected]>wrote: >>>>>> >>>>>>> Hey Tim, >>>>>>> >>>>>>> Rather than passing a string to to the command argument, pass a >>>>>>> reference to the method itself: >>>>>>> >>>>>>> *mds.menuItem(p=shotsMenu, l='Shot Setup', c=ShotSetup)* >>>>>>> >>>>>>> This is a big difference between Maya's menu system and Softimages. >>>>>>> It also removes the requirement for the methods/functions to be >>>>>>> available >>>>>>> in the global scope which tripped me up when I began working with >>>>>>> Softimage's menu system. >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Tue, Apr 22, 2014 at 9:48 AM, Tim Crowson <[email protected]>wrote: >>>>>>> >>>>>>>> Sorry to keep pestering... >>>>>>>> >>>>>>>> I've got a custom command that I'm wanting to fire via a menuItem >>>>>>>> in a custom menu. The command runs fine when called via maya.cmds. But >>>>>>>> so >>>>>>>> far my menuItem insists on throwing a 'not defined' error for the >>>>>>>> command >>>>>>>> flag. Am I following the correct syntax for command flags in Python >>>>>>>> here? >>>>>>>> >>>>>>>> My command is *ShotSetup()*. >>>>>>>> >>>>>>>> My menuItem code is: >>>>>>>> *mds.menuItem(p=shotsMenu, l='Shot Setup', c="ShotSetup()")* >>>>>>>> >>>>>>>> The menu initializes correctly, but when I run that menu item, I >>>>>>>> get the following error: >>>>>>>> >>>>>>>> *# Error: name 'ShotSetup' is not defined* >>>>>>>> *# Traceback (most recent call last):* >>>>>>>> *# File "<maya console>", line 1, in <module>* >>>>>>>> *# NameError: name 'ShotSetup' is not defined # * >>>>>>>> >>>>>>>> >>>>>>>> -Tim >>>>>>>> >>>>>>>> -- >>>>>>>> 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%3D1bmnYOThTfWPvz2ZC80AFHZAy9BZSCB9pbBXM9jEUYVxOQ%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAPh%3D1bmnYOThTfWPvz2ZC80AFHZAy9BZSCB9pbBXM9jEUYVxOQ%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/CAJhmvsTDrX6iCXaC5bG2DT%2ByfoanHHJ9Nc2jeW9g5de_59xDSw%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAJhmvsTDrX6iCXaC5bG2DT%2ByfoanHHJ9Nc2jeW9g5de_59xDSw%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>>> . >>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>> >>>>>> >>>>>> >>>>> -- >>>>> 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%3D1bnDaq0xAuixzvVxk1uujYAmGZsuqCjQQK__6ZQMUtvfCg%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAPh%3D1bnDaq0xAuixzvVxk1uujYAmGZsuqCjQQK__6ZQMUtvfCg%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/CAJhmvsQ9R_sKwHT2nit61m%3D-0C9ts9W_-JjntZ9vpQyD2JdYKw%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAJhmvsQ9R_sKwHT2nit61m%3D-0C9ts9W_-JjntZ9vpQyD2JdYKw%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >>> 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%3D1bkfLLDMMYQkB%2Bff6YH-bMtv7om6TG7LA9c76PC8iQ8myA%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAPh%3D1bkfLLDMMYQkB%2Bff6YH-bMtv7om6TG7LA9c76PC8iQ8myA%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/CAJhmvsScJ9Vn2-zteXyzKyrm2iiOV-5g%2Bw3rWcbGeYydNL7DjQ%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAJhmvsScJ9Vn2-zteXyzKyrm2iiOV-5g%2Bw3rWcbGeYydNL7DjQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- > 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%3D1bnrBCkUw7yRXZtA7GaGogYehGRPooTp9jHG3v6iiyw4Ew%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAPh%3D1bnrBCkUw7yRXZtA7GaGogYehGRPooTp9jHG3v6iiyw4Ew%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/CAJhmvsRYf8p%3DckXCy3pwHZLvjzT5_1nWHR4g6qscD6-k4kYKng%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
