pymel.api.plugins.PyNodeMethod¶
digraph inheritanced8b217a1e6 { rankdir=TB; ranksep=0.15; nodesep=0.15; size="8.0, 12.0"; "PyNodeMethod" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="#pymel.api.plugins.PyNodeMethod",style="setlinewidth(0.5)",tooltip="Used as a decorator, placed on methods on a plugin node class, to signal",height=0.25,shape=box,fontsize=8]; }
- 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!