This seems to be a really straight forward example located here: http://pymel.googlecode.com/svn/trunk/examples/customClasses.py
It outlines how to subclass, and what class methods must be provided. I believe the use of the id attribute is for the validation test function, in order to determine if the incoming object type is the right kind. In this case they use the joint id attribute from the original Joint class to check. If its a joint then allow this subclass to be returned. Technically you could perform any test you see fit as long as you stick to the api to do it and not pymel calls. On Oct 31, 2011, at 7:51 PM, Justin <[email protected]> wrote: > Hey all, It's been a super long time since I've been on this list! > > I was wondering if I could get a quick example on how to accomplish a simple > wrapping of a pymel node as described here: > http://code.google.com/p/pymel/issues/detail?id=62 > > allow users to add their own methods to any node. users can now easily import > pymel and then subclass nodes to do what they like, but perhaps there's a way > to register these user subclass modules to be loaded by pymel, such that they > are found within the pymel namespace. > > > > import pymel.core as pm > > # Load plugin > pm.loadPlugin('pointless') > > # Print Node Type > print pm.nt.PointlessViewer > > How would I subclass this and add my own methods? > > class PointlessViewerNode(pm.nt.PointlessViewer): > def myMethod(self): > # Do something with my node > pass > > Do I have to follow the example under pymel.examples.customClasses.py? Where > an extra attribute is added, ie cls._PointlessClassID? I'm not sure I need > this extra attribute, I just want to add additional methods to the existing > pymel node returned when creating nodes. > > viewer = pm.createNode('pointlessViewer') > viewer.myMethod() > > > Thanks, > Justin > > > > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
