PDA

View Full Version : Python API noob problem..


morphine596
03-26-2010, 06:56 AM
Hey everyone

I was writing a python node to calculate the distance between 2 points. Well, that is done but I cannot seem to understand why it is crashing Maya.

I have attached my code as a txt file. Can anyone point out where I am going wrong ?

after Loading the plugin.. you can create 3 joints in the viewport.. with default naming.. and run the following lines to create the node and make some basic connections needed..

createNode stretchNode;
connectAttr -f joint1.message stretchNode1.joint1;
connectAttr -f joint2.message stretchNode1.joint2;
connectAttr -f joint3.message stretchNode1.joint3;


the script editor prints out the distance between joint1 and joint3 and so does the 'dist' attr on the stretchNode.. but it does not update with the change in position of the joints. something like the distanceBetween utility node. and if i change a value on the node like the 'onoff' attr to 0 or 1 then maya crashes.

I know there is something that I dont understand here. Can anybody help ?

Thanks a lot.

morphine596
03-26-2010, 01:26 PM
anyone, any clue ??

Friska
03-26-2010, 03:12 PM
Hi,

I had just a quick look at it. You are using message attributes and they will not tell the node to update if the node that owns the message attribute updates. Message attributes don't really do much. They're just there to show that a relationship between nodes exists. It's better to use a TypedAttribute or if you just care about the transforms of the nodes, a float3 NumericAttribute. Just pipe in the translation of the joints into that and your node should update whenever the joints move.

Hope this helps :)

morphine596
03-27-2010, 04:54 AM
aah.. I will try changing the attribute type. But why is Maya crashing ??

theflash
03-27-2010, 12:32 PM
message attributes dont really hold values so I wonder what datablock will return. Did you try checking status return values?

CGTalk Moderation
03-27-2010, 12:32 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.