It sounds like factories.registerVirtualClass should do what you need... I guess you already saw the example, so that should explain how it's used. The only word of warning is that we consider it an 'experimental' feature - I've used it before, and it worked, but I haven't used it recently, or ever really tested it extensively.
That said, though, we'd love for more people to try it out, and put it through it's paces. - Paul On Thu, Jul 1, 2010 at 9:49 AM, thirstydevil <[email protected]> wrote: > Salute. > > Here at eurocom we've been debating how to design our python package > with development with pymel in mind. > > As we're becoming better OO python programmers we're using pymel more > and more. Leaving our old MEL libraries behind and slowly converting > or writing our pipeline in python with pymel. > > We've created our own package that use's pymel. The design of that > package is something that we've been debating recently in our > department. One of the main discussions is how to extend a pymel base > class without sub-classing. Because:- Where do we subclass in our > package design or even should we subclass? What do we do when we want > our subclass to always be returned by pymel? > > One of our more senior programmers has suggested a extension system > for pymel where by a PyNode would bind extension methods to it's > respective PyNode class from an extensions module. > > def isSelected(self): > import maya.cmds as cmds > return self.longName() in cmds.ls(sl=True,l=True) > > A = pCore.selected()[0] > meth = types.MethodType(isSelected, A, A.__class__) > A.isSelected = meth > A.isSelected() > > I like the idea and was wondering how other's have integrated PyMel > into their studio Libs and how they handle their package design with > pymel in mind. As sometime the line between our pipeline package and > extending pymel is blurred. Which is why the pymel extension system > came to mind. > > Looking at the customClasses example I was wondering if we can already > do this with the factories module? > > -Dave > > > -- > http://groups.google.com/group/python_inside_maya -- http://groups.google.com/group/python_inside_maya
