Re: [Maya-Python] Re: Subclassing and VirtualClass questions

2012-11-02 Thread Ian Jones
You can also do your attribute setup (and establish what you need for the isVirtual test then just call virtualized = pm.PyNode(newNode) and continue on from there: @classmethod def _postCreateVirtual(cls, newNode): """ This is called before creation, pymel/cmds allowed.""" ne

Re: [Maya-Python] Re: Subclassing and VirtualClass questions

2012-10-23 Thread Morgan
Hey Paul, thanks for the reply. I tried overriding the __init__ method but I get an error saying that special methods aren't allowed for virtual classes. My conclusion is that I think I'm trying to use virtual classes a bit differently than they were intended. A friend of mine suggested that I

Re: [Maya-Python] Re: Subclassing and VirtualClass questions

2012-10-22 Thread Paul Molodowitch
Ah, I see what you meant now... sorry. I think I forgot myself how the virtual node creation process worked... =/ Anyway, yes, you're right 'newNode' will not yet be an instance of your new virtual class. However, you can still call methods of your new class - just pass in the node explicitly: M

Re: [Maya-Python] Re: Subclassing and VirtualClass questions

2012-10-19 Thread Morgan
Right, all the pymel methods are available, but in that example, if I add a method to CustomJointBase called customMethod and then try to call that within _postCreateVirtual like so: newNode.customMethod() I get an error because I newNode isn't an instance of my new virtual class: # AttributeEr

Re: [Maya-Python] Re: Subclassing and VirtualClass questions

2012-10-19 Thread Paul Molodowitch
Nope, it's an instance of the class, and you can use it exactly as you would self. Check the example file at: https://github.com/LumaPictures/pymel/blob/master/examples/customClasses.py In it's _postCreateVirtual, it adds an attribute, and calls it's .attr method... - Paul On Fri, Oct 19, 2012

Re: [Maya-Python] Re: Subclassing and VirtualClass questions

2012-10-19 Thread Morgan
But that new node is different from self because it's just a node, not an instance of the class, so although you can act on the node directly, you can't call any of the custom methods or set member variables, I don't think On Saturday, October 20, 2012 7:33:39 AM UTC+13, elrond79 wrote: > >

Re: [Maya-Python] Re: Subclassing and VirtualClass questions

2012-10-19 Thread Paul Molodowitch
Morgan - though _postCreateVirtual is indeed a classmethod, when it is called by pymel's mechanics, it is always passed in the "newNode" as the first argument (after the classmethod-automatically-created 'cls' arg, of course). So you can use this arg just as you would "self" in a "normal" instance

Re: [Maya-Python] Re: Subclassing and VirtualClass questions

2012-10-19 Thread Seth Gibson
I should add that all the work Jason and I did was based on work I did with Ian, so definitely shoot him some code and see what you can't work out there... On Fri, Oct 19, 2012 at 3:58 AM, Morgan wrote: > Hey guys thanks. Jason your site has been my primary source of information > on this, thank

[Maya-Python] Re: Subclassing and VirtualClass questions

2012-10-19 Thread Morgan
Hey guys thanks. Jason your site has been my primary source of information on this, thanks for that. Unless I am just misunderstanding something, I see the problem being that because _postCreateVirtual and all these methods are classmethods, you don't really have access to the actual python obj

Re: [Maya-Python] Re: Subclassing and VirtualClass questions

2012-10-17 Thread Count Zer0
Yeah. For sure. Perhaps you could pm me with some help on branching pymel. -jason On Wednesday, October 17, 2012 10:14:00 AM UTC-7, elrond79 wrote: > > Hey count zero - would you consider doing that work on a pymel branch? Or, > at least, share it with me, so I could see if it could be incorpora

Re: [Maya-Python] Re: Subclassing and VirtualClass questions

2012-10-17 Thread Paul Molodowitch
Hey count zero - would you consider doing that work on a pymel branch? Or, at least, share it with me, so I could see if it could be incorporated into the main pymel HiKCharacterNode class? On Wed, Oct 17, 2012 at 10:04 AM, Count Zer0 wrote: > Did you check the work Seth and I did?: > > http://w

[Maya-Python] Re: Subclassing and VirtualClass questions

2012-10-17 Thread Count Zer0
Did you check the work Seth and I did?: http://www.jason-parks.com/artoftech/?p=225 What "things" could you not do in your __init__ method. Doesn't _postCreateVirtual essentially replace the __init__ method? We've used this technique successfully on a couple of classes so far. Though we haven'