40 import maya.api.OpenMaya
as om
44 The presence of this function tells Maya that the plugin produces, and
45 expects to be passed, objects created using the Maya Python API 2.0.
51 class PyWhatIsCmd(om.MPxCommand):
52 kPluginCmdName =
"pyWhatIs"
55 om.MPxCommand.__init__(self)
62 selectList = om.MGlobal.getActiveSelectionList()
63 depFn = om.MFnDependencyNode()
65 for i
in range(selectList.length()):
66 node = selectList.getDependNode(i)
70 types = om.MGlobal.getFunctionSetList(node)
72 print "Name: %s" % depFn.name()
73 print "Type: %s" % node.apiTypeStr
74 sys.stdout.write(
"Function Sets: " )
75 sys.stdout.write(
", ".join(types) +
'\n')
79 def initializePlugin(plugin):
80 pluginFn = om.MFnPlugin(plugin)
82 pluginFn.registerCommand(
83 PyWhatIsCmd.kPluginCmdName, PyWhatIsCmd.cmdCreator
87 "Failed to register command: %s\n" % PyWhatIsCmd.kPluginCmdName
92 def uninitializePlugin(plugin):
93 pluginFn = om.MFnPlugin(plugin)
95 pluginFn.deregisterCommand(PyWhatIsCmd.kPluginCmdName)
98 "Failed to unregister command: %s\n" % PyWhatIsCmd.kPluginCmdName