scripted/pyHelloWorldCmd.py
2 To use, make sure that pyHelloWorldCmd.py is in your MAYA_PLUG_IN_PATH
6 maya.cmds.loadPlugin("pyHelloWorldCmd.py")
7 maya.cmds.pyHelloWorld()
11 import maya.api.OpenMaya
as om
15 The presence of this function tells Maya that the plugin produces, and
16 expects to be passed, objects created using the Maya Python API 2.0.
22 class PyHelloWorldCmd(om.MPxCommand):
23 kPluginCmdName =
"pyHelloWorld"
26 om.MPxCommand.__init__(self)
30 return PyHelloWorldCmd()
37 def initializePlugin(plugin):
38 pluginFn = om.MFnPlugin(plugin)
40 pluginFn.registerCommand(
41 PyHelloWorldCmd.kPluginCmdName, PyHelloWorldCmd.cmdCreator
45 "Failed to register command: %s\n" % PyHelloWorldCmd.kPluginCmdName
51 def uninitializePlugin(plugin):
52 pluginFn = om.MFnPlugin(plugin)
54 pluginFn.deregisterCommand(PyHelloWorldCmd.kPluginCmdName)
57 "Failed to unregister command: %s\n" % PyHelloWorldCmd.kPluginCmdName