2 To use, make sure that pyWhatIsCmd.py is in your MAYA_PLUG_IN_PATH
6 maya.cmds.loadPlugin("pyWhatIsCmd.py")
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 PyWhatIsCmd(om.MPxCommand):
23 kPluginCmdName =
"pyWhatIs"
26 om.MPxCommand.__init__(self)
33 selectList = om.MGlobal.getActiveSelectionList()
34 depFn = om.MFnDependencyNode()
36 for i
in range(selectList.length()):
37 node = selectList.getDependNode(i)
41 types = om.MGlobal.getFunctionSetList(node)
43 print "Name: %s" % depFn.name()
44 print "Type: %s" % node.apiTypeStr
45 sys.stdout.write(
"Function Sets: " )
46 sys.stdout.write(
", ".join(types) +
'\n')
50 def initializePlugin(plugin):
51 pluginFn = om.MFnPlugin(plugin)
53 pluginFn.registerCommand(
54 PyWhatIsCmd.kPluginCmdName, PyWhatIsCmd.cmdCreator
58 "Failed to register command: %s\n" % PyWhatIsCmd.kPluginCmdName
63 def uninitializePlugin(plugin):
64 pluginFn = om.MFnPlugin(plugin)
66 pluginFn.deregisterCommand(PyWhatIsCmd.kPluginCmdName)
69 "Failed to unregister command: %s\n" % PyWhatIsCmd.kPluginCmdName