how do you get a node's type using the api? essentially, i'm looking for the api equivalent of the mel nodeType command. for custom nodes, MObject.apiType() and MObject.apiTypeStr() are not returning what i would expect. for example, i loaded the scripted plugin rockingTransform. when the plugin registers the new transform node it specifies a node type and a type id
CODE
kRockingTransformPluginName = "spRockingTransform"
kRockingTransformNodeName = "spRockingTransformNode"
kRockingTransformNodeID = OpenMaya.MTypeId(0x87014)
kRockingTransformMatrixID = OpenMaya.MTypeId(0x87015)
.....
def initializePlugin(mobject):
mplugin = OpenMayaMPx.MFnPlugin(mobject)
try:
mplugin.registerTransform( kRockingTransformPluginName, kRockingTransformNodeID, \
nodeCreator, nodeInitializer, matrixCreator, kRockingTransformMatrixID )
except:
sys.stderr.write( "Failed to register transform: %s\n" % kRockingTransformPluginName )
raise
but once the plugin is loaded and i create a spRockingTransform object, it is not returning the types registered through the MFnPlugin:
CODE
import maya.cmds as cmds
import maya.OpenMaya as OpenMaya
def toMObject (nodeName):
""" Get the API MObject given the name of an existing node """
sel = OpenMaya.MSelectionList()
obj = OpenMaya.MObject()
sel.add( nodeName )
sel.getDependNode( 0, obj )
return obj
x = cmds.createNode( 'spRockingTransform' )
obj = toMObject( x )
print obj.apiType(), obj.apiTypeStr()
#Result: 886 kPluginTransformNode
what i'd like to get is 'spRockingTransform' and 0x87014 (which is 552980 ).
thanks in advance.
-chad