PDA

View Full Version : Freeze Transformation & API


Infernalspawn
04-18-2006, 07:34 PM
Hi,

i have a problem, i want to get the transformations as vector or as Matrix of an object that has been tortured with Freeze Transformation. but how ?

a normal does not work as expected
mdagPath.inclusiveMatrix()
just returns stupid values.

so i used the MFnTransform object to get these informations through


mfnTrans.rotatePivotTransform()
mfnTrans.rotatePivot()
mfnTrans.scalePivotTransform()
mfnTrans.scalePivot()

but all of these functions returned the same stupid and uncorrect position.

the pivotposition i find in the Attribute editor is the one i need, but i need the informations via api, also should this solution be able to be used with and without freeze transformations.

so if anybody has a idea, please help me.

thx in advance

Infernalspawn

Robert Bateman
04-18-2006, 10:13 PM
It largely depends on wha you mean by freezing, do you mean removing scale, rotation, translation, orients, pivots etc?

The values that MDagPath::inclusiveMatrix() returns are not wrong, however they are entirely dependant on the path you have created, and are querying the result of. for example, given the joint chain,

joint1 -> joint2-> joint3

i could initialise a path to joint3 like so :


MObject joint1,joint2,joint3; // assumes they've been initialised

MDagPath path;
path.push( joint3 );

MMatrix local = path.inclusiveMatrix(); // returns the matrix for joint3,
// basically the local space matrix

path.pop();
path.push(joint1);
path.push(joint2);
path.push(joint3);

path.inclusiveMatrix(); // returns the combined matrix of joint1->joint2->joint3
// ie, world space.



The same also applies to all MFnDagNode derived functions sets (all shapes & transforms). ie, the MFnMesh and MFnTransform classes allow you to query stuff in world space. If you've initialised the function sets from an MObject, they'll always return local space. If you initialise from a dag path, world space means the matrix represented by the path.

The pivot values returned from the function set are always in local space. To get the world space pivot, multiply the pivot vector by the world space matrix. In this case though, i think you might actually just be after the world space translate value of the transform?

CGTalk Moderation
04-18-2006, 10:13 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.