There's nothing wrong with setting an attribute in the compute method.
Since you have access to the datablock there you can do something simple
like:

hOutput = data.outputValue(self.MYATTR)
hOutput.setFloat(newValue)
hOutput.setClean()

On Wed, Jan 28, 2009 at 8:33 AM, npuckett <[email protected]> wrote:

>
> Ok,
> So I'm working on a plugin at the moment and I have found out (see:
> someone with more experience with this than me told me..) that I need
> to set the value to an attribute on the node I'm creating directly
> rather than using a compute.  What I need some help with is the
> general syntax of how to do this sort of thing. For example:
>
> class testNode(omMPx.MPxNode):
>    # input and output variables
>    MYATTR = om.MObject()
>
>
> def someFunction()
>        ...do some stuff
>        ...set the value of MYATTR on testNode during runtime
>
>
> def nodeInit():
>    numAttr = om.MFnNumericAttribute()
>    testNode.MYATTR = numAttr.create
> ("myAttr","my",om.MFnNumericData.kFloat,0.0)
>    numAttr.setStorable(1)
>    numAttr.setWritable(1)
>
>    testNode.addAttribute(testNode.MYATTR)
>
>
> I hope that explains it enough and thanks for any help that can point
> me in the right direction
> >
>


-- 
www.chadvernon.com

--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---

Reply via email to