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

Reply via email to