Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Windows 10, Maya 2020.2
custom node gets a warning when loading:
# Warning: Unrecognized node type 'NumberToStringNode'; preserving node information during this session. #
and my custom node is considered an "unknown" node.
I really don't understand why. this is my code:
import maya.api.OpenMaya as om # Maya Python API 2.0
# tell Maya use Python API 2.0
# Both methods have the same result.
# maya_useNewAPI = True # (Maya 2019+)
def maya_useNewAPI():
pass
# nodes # ------------------------------------
# NumberToString
class NumberToStringNode(om.MPxNode):
TYPE_NAME = "NumberToString"
TYPE_ID = om.MTypeId(0x0007F7F8)
def __init__(self):
super(NumberToStringNode, self).__init__()
@classmethod
def creator(cls):
return NumberToStringNode()
@classmethod
def initialize(cls):
pass
# plugin ------------------------------------------------
# Initialize the plug-in #
def initializePlugin(plugin):
vendor = "myName"
version = "0.0.1"
plugin_fn = om.MFnPlugin(plugin, vendor, version)
# register nodes
try:
plugin_fn.registerNode(
NumberToStringNode.TYPE_NAME,
NumberToStringNode.TYPE_ID,
NumberToStringNode.creator,
NumberToStringNode.initialize,
om.MPxNode.kDependNode)
except:
om.MGlobal.displayError("Failed to register node: {0}".format(NumberToStringNode.TYPE_NAME))
print("hello maya")
# Uninitialize the plug-in #
def uninitializePlugin(plugin):
plugin_fn = om.MFnPlugin(plugin)
# deregister nodes
try:
plugin_fn.deregisterNode(NumberToStringNode.TYPE_ID)
except:
om.MGlobal.displayError("Failed to deregister node: {0}".format(NumberToStringNode.TYPE_NAME))
Solved! Go to Solution.