thanks got it working. my main problem though now is it prints the
callback on loading the file with my plugin.
is there some way of only making the callback happen after the load. the
main perpose of the callback is to have it recalculate my arrays into
one averaged array so it only need to happen after its loaded or when
one of the arrays change.
john
On 09/05/2011 04:16 PM, Jan Berger wrote:
I second Chad Vernon`s comment and suggest using the
setDependentsDirty method for this purpose.
At 03:20 04.09.2011, you wrote:
Try using myNode.thisMObject() instead of OpenMaya.MObject(), thus
removing the need to have a myMojbect at all....
Also, the callback function needs to have and only have the arguments
found in MNodeMessage::MAttr2PlugFunction. If *args
isn't that, then it isn't going to work...
On Sep 3, 5:10 pm, johnvdz <[email protected]> wrote:
> thanks guys.
>
> this is basically what i have.
>
> class myNode(OpenMayaMPx.MPxDeformerNode ):
> myMobject=OpenMaya.MObject()
> def __init__(self):
> OpenMayaMPx.MPxDeformerNode.__init__( self )
> def postConstructor(self):
>
> attrChangedCBId=OpenMaya.MNodeMessage.addAttributeChangedCallback(
> myNode.myMobject, myNode.attrChangedCallback, self)
> def attrChangedCallback(*args):
> print 'this node callback is working'
>
> however i generally get a
>
> # RuntimeError: (kInvalidParameter): Unexpected Internal Failure //
> this is in the post constructor.
>
> not sure if i have implemented it wrong
>
> john
>
> On 09/04/2011 05:44 AM, Chad Vernon wrote:
>
>
>
>
>
>
>
> > You can also use setDependentsDirty to check when things change.
>
> > On Sat, Sep 3, 2011 at 12:33 PM, notanymike <[email protected]
> > <mailto:[email protected]>> wrote:
>
> > In c++ I usually install it in MPxNode's postConstructor
method and
> > remove it in it's ~MPxNode method
>
> > However I don't know what the "~" equivalent to Python is...
>
> > On Sep 3, 7:49 am, johnvdz <[email protected]
> > <mailto:[email protected]>> wrote:
> > > hi all,
>
> > > i'm really scratching my head here. anyone know of an example
> > out there
> > > for attributeCallbacks
> > (MNodeMessage.addAttributeChangedCallback) within
> > > a deformer or mpxnode.
>
> > > not sure if i should be putting this in the __init__ func or in
> > its own
> > > custom constructor.
>
> > > I'm not really sure about what its passing how to deal with what it
> > > passes so any examples would be great. Google search doesn't
> > bring up
> > > much python stuff.
>
> > > i need to be able to pass some message to update for the node to
> > > recalculate an array of values.
>
> > > thanks in advance
>
> > > john
>
> > --
> > 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
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe
Jan Berger
[email protected] :: www.janberger.de <http://www.janberger.de/>
--
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