Hi Tim,

Maya has a feature called "Modules" and it's a pretty clean way to isolate your 
content and distribute it.  It doesn't have the encapsulation of an Addon but 
it is very similar in other ways.

Steps:

1)      Set a custom MAYA_MODULE_PATH or use the default: C:\Program 
Files\Autodesk\Maya2014\modules.

2)      Place a text file in that folder with the following syntax: + 
ModuleName ModuleVersion ModulePath.  Ex. + TimPlugin 1.00 
C:\MayaPlugins\TimPlugin.  This is kinda like the Addon .xml file.

3)      In the TimPlugin folder use the standard Maya folder conventions like 
"scripts", "plug-ins" or "icons" and populate with your files. This is kinda 
like the Addon "Application" and "Data" folders.

Ultimately you could set this up like a XSI Workgroup and add in your modules.  
Of course it doesn't have the same class or style as what we're used to in XSI 
but it is pretty painless.  See more here: 
http://around-the-corner.typepad.com/adn/2012/07/distributing-files-on-maya-maya-modules.html
 BTW - That site has some nice information and is a good resource.

As for what 's required for a Maya plugin to be a python plugin - nothing so 
different. It gets initialized/uninitialized (Load/Unload), can't really think 
of anything offhand that's going to throw you.

Regarding your menu - try using cmds.evalDeferred like this: 
cmds.evalDeferred("buildMenu()")

userSetup.py get's called early in the loading process and the UI isn't ready.  
Personally I never use it.  I use the Maya.env to do a lot of setup stuff and 
use the userSetup.mel file to initialize stuff (you can run python in that file 
as well).

Hope that helps,

-Nick Breslow


From: softimage-boun...@listproc.autodesk.com 
[mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Tim Crowson
Sent: Thursday, April 17, 2014 9:31 AM
To: softimage@listproc.autodesk.com
Subject: Any recommended tutorials/training on building Maya plugins in Python?

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...
--



Tim Crowson
Lead CG Artist

Magnetic Dreams, Inc.
2525 Lebanon Pike, Bldg C, Suite 101, Nashville, TN 37214
Ph  615.885.6801 | Fax  615.889.4768 | 
www.magneticdreams.com<http://www.magneticdreams.com>
tim.crow...@magneticdreams.com<mailto:tim.crow...@magneticdreams.com>




Reply via email to