pymel.api.plugins.PyNodeMethod¶
- class PyNodeMethod(func, name=None)¶
Used as a decorator, placed on methods on a plugin node class, to signal that these methods should be placed on to PyNode objects constructed for the resulting depend nodes.
>>> class FriendlyNode(DependNode): ... _typeId = om.MTypeId(654748) ... @PyNodeMethod ... def introduce(self): ... print "Hi, I'm an instance of a MyNode PyNode - my name is %s!" % self.name() >>> FriendlyNode.register() >>> import pymel.core as pm >>> frank = pm.createNode('FriendlyNode', name='Frank') >>> frank.introduce() Hi, I'm an instance of a MyNode PyNode - my name is Frank!