redpawfx
Wondering how to do this...

have an API field node I'm writing,

and I want to get the  worldMatrix of it  to mult out its translation/rotation/scale
to put it in  local space so I can do some calcs  on  data in its local space in relation to the particles in world space.

in the compute()  I'm trying to

MDataHandle  worldMatrixHandle = block.inputValue(mWorldMatrix, &status);
MMatrix wMatrix = worldMatrixHandle.asMatrix();

and then I print out the values in the matrix but they are always  all  zero..
even when the node  is  translated to  a position in space.

when i execute the mel call   getAttr  node.worldMatrix;   it returns the correct value..

not sure what I'm doing wrong.
any help?

thanks in advance.

-johnc

Quote 0 0
pshipkov
That's strange.
Can you try with MPlug ?

MObject oWldMat = MPlug(thisMObject(), mWorldMatrix).asMObject();
MMatrix m = MFnMatrixData(oWldMat).matrix();
cout<<m<<endl;

Quote 0 0
redpawfx
strange indeed Peter, Thanks for your quick reply, 

Your way results in a constant  identity matrix vs  all zeros,  which is slightly better?  :confused:  but still not matching the  mel  output of the actual  transform  values...   I wonder if its not getting  forced to update somehow? but one would think that by calling the mel version that would be enough to update it?  Because its a  field node, it doesent technically have a transform so  the worldmatrix attr doesen't show up in the  attribute editor,  I wonder if that has something to do with it as well?

I think I may just try to  call the mel command  with MGlobal for now as its starting to hold me up..  and its only needed once per frame.

any other ideas,  I'd be  glad to hear em,    I tried all the  ways I found in the devkit too and none of them worked either.

thanks
-johnc

Quote 0 0
pshipkov
I never really tried to do what you are doing there, but will do some checking - what Maya version you use ?
Quote 0 0
redpawfx
Hi, 
right now,  trying this on  Linux  2011 right now, but  also can try  2012 at some point.
thanks for checking it out for me.  I appreciate it :-)

-john


Quote 0 0

Add a Website Forum to your website.