compute() runs on all dirty plugs, so you probably want to make sure it's
running on Node.joint like this:
def compute(self,plug, data):
# get joint rotation and rotate order
thisNode = Node.thisMObject(self)
if plug == Node.joint and plug.isConnected():
array = OpenMaya.MPlugArray()
plug.connectedTo(array,1,0)
mobject = array[0].node()
fnTransform = OpenMaya.MFnTransform(mobject)
rotateOrder = fnTransform.rotationOrder()
print "rotate order is: ",rotateOrder
data.setClean( plug )
also, notice that plug is passed into compute() so you don't need the
following line in there:
plug = OpenMaya.MPlug(thisNode,Node.joint)
On Tuesday, August 14, 2012 5:29:28 AM UTC-7, luiz elias wrote:
>
> Hi all!,
>
> I have done a simple node and I want to have as input a rotation
> and use MPlug to extract the rotation order from the node that is conneted
> to this plug.
> it is working fine if I connect a scale to the input but if I connect a
> rotation I got this:
> // Error: RuntimeError: (kInvalidParameter): Object is incompatible with
> this method // :(
>
> here is the code: http://pastebin.ubuntu.com/1146733/
>
> does anybody have a idea why it is not working with rotations? =)
>
> thanks!
>
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe