luizeliasvfx
12-24-2012, 01:54 AM
Hello,
I have an MPxManipulatorNode attached to a MPxContext,
in my context doPress() function I get some value
and I want to be able to pass that value to the MPxManipulatorNode
so I can draw something with it, but I can't find a way to pass that value to the manip.
I've tried to add an attribute to the MPxManipulatorNode:
def manipInitialize():
nAttr = OpenMaya.MFnNumericAttribute()
manip.someValue = nAttr.create( "someValue", "sv", OpenMaya.MFnNumericData.kFloat)
manip.addAttribute(manip.someValue)
and inside my context I set it:
depNode = OpenMaya.MFnDependencyNode(manipObject)
plug = depNode.findPlug('someValue',0)
plug.setFloat(20.0)
but when I try to retrieve this value inside my manipulatorNode draw function:
fnThisNode = OpenMaya.MFnDependencyNode(self.thisMObject())
value = OpenMaya.MPlug(self.thisMObject(), fnThisNode.attribute("someValue")).asFloat()
I get this error:
# Warning: Node type 'TdependNode' is abstract. Cannot create. #
any ideas why?
or a different way to do that??
many thanks!
I have an MPxManipulatorNode attached to a MPxContext,
in my context doPress() function I get some value
and I want to be able to pass that value to the MPxManipulatorNode
so I can draw something with it, but I can't find a way to pass that value to the manip.
I've tried to add an attribute to the MPxManipulatorNode:
def manipInitialize():
nAttr = OpenMaya.MFnNumericAttribute()
manip.someValue = nAttr.create( "someValue", "sv", OpenMaya.MFnNumericData.kFloat)
manip.addAttribute(manip.someValue)
and inside my context I set it:
depNode = OpenMaya.MFnDependencyNode(manipObject)
plug = depNode.findPlug('someValue',0)
plug.setFloat(20.0)
but when I try to retrieve this value inside my manipulatorNode draw function:
fnThisNode = OpenMaya.MFnDependencyNode(self.thisMObject())
value = OpenMaya.MPlug(self.thisMObject(), fnThisNode.attribute("someValue")).asFloat()
I get this error:
# Warning: Node type 'TdependNode' is abstract. Cannot create. #
any ideas why?
or a different way to do that??
many thanks!
