scripted/pyHelloWorldCmd.py
19 import maya.api.OpenMaya
as om
23 The presence of this function tells Maya that the plugin produces, and
24 expects to be passed, objects created using the Maya Python API 2.0.
30 class PyHelloWorldCmd(om.MPxCommand):
31 kPluginCmdName =
"pyHelloWorld"
34 om.MPxCommand.__init__(self)
38 return PyHelloWorldCmd()
45 def initializePlugin(plugin):
46 pluginFn = om.MFnPlugin(plugin)
48 pluginFn.registerCommand(
49 PyHelloWorldCmd.kPluginCmdName, PyHelloWorldCmd.cmdCreator
53 "Failed to register command: %s\n" % PyHelloWorldCmd.kPluginCmdName
59 def uninitializePlugin(plugin):
60 pluginFn = om.MFnPlugin(plugin)
62 pluginFn.deregisterCommand(PyHelloWorldCmd.kPluginCmdName)
65 "Failed to unregister command: %s\n" % PyHelloWorldCmd.kPluginCmdName