39 from builtins
import range
41 import maya.api.OpenMaya
as om
45 The presence of this function tells Maya that the plugin produces, and
46 expects to be passed, objects created using the Maya Python API 2.0.
52 class PyWhatIsCmd(om.MPxCommand):
53 kPluginCmdName =
"pyWhatIs"
56 om.MPxCommand.__init__(self)
63 selectList = om.MGlobal.getActiveSelectionList()
64 depFn = om.MFnDependencyNode()
66 for i
in range(selectList.length()):
67 node = selectList.getDependNode(i)
71 types = om.MGlobal.getFunctionSetList(node)
73 print(
"Name: %s" % depFn.name())
74 print(
"Type: %s" % node.apiTypeStr)
75 sys.stdout.write(
"Function Sets: " )
76 sys.stdout.write(
", ".join(types) +
'\n')
80 def initializePlugin(plugin):
81 pluginFn = om.MFnPlugin(plugin)
83 pluginFn.registerCommand(
84 PyWhatIsCmd.kPluginCmdName, PyWhatIsCmd.cmdCreator
88 "Failed to register command: %s\n" % PyWhatIsCmd.kPluginCmdName
93 def uninitializePlugin(plugin):
94 pluginFn = om.MFnPlugin(plugin)
96 pluginFn.deregisterCommand(PyWhatIsCmd.kPluginCmdName)
99 "Failed to unregister command: %s\n" % PyWhatIsCmd.kPluginCmdName