freeze transforms?


#1

Hi all,

I can’t seem to find any way in the API for Softimage 2010 to freeze the transforms on an object. I can freeze the modeling operators like so (in C#):

GetXSI().ExecuteCommand( “FreezeObj”, new object[] { obj.Name } );

But this doesn’t freeze the transforms applied in local kinematics. I can do it in the user interface just by clicking Transform->Freeze All Transforms, (which creates a Center operator,) but how can I do this via the API?

Thank you for any input.

Kevin


#2

Ok, I figured it out, although it is a bit roundabout.

Freezing transforms, as I knew, actually creates a Center operator. It seems the only way to freeze transforms is to manually create that Center operator. To create the operator:

var centerOp = (Operator)GetXSI().ExecuteCommand( “ApplyOperator”, new object[] { “CenterManip”, obj.Name } );

Then we need to set its parameters. As a shortcut to gain access to them:

var opParams = centerOp.Parameters;

If you actually want to duplicate the behaviour of “Freeze All Transforms” you’d have to access the local kinematics and take the transform parameters out of that and put them into the Center operator and then reset them in local kinematics. A bit tricky due to rotation order.

In my case I only wanted to apply specific transforms, so, for instance, to scale 10x in the Z direction:

opParams[“sclz”].set_Value( null, 10 );

Cheers,
Kevin


#3

Even though I know a thing about scripting, thanks a lot for sharing with the rest of us, the solution you found.


#4

For future reference:
If you want to freeze the transforms of an object, it’s basically equivalent to multiplying the points for its transform, then resetting the transform to 0.
This requires a frozen stack in run-once form, or you can write and apply it at any point in operator form.

The operation is trivial:
for each point in the mesh:
multiply pointposition vector by kine.global.transform
set kine.global.transform to an ID transform

This is the equivalent of freezing transforms, and fundamentally what the centre operator does.


#5

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.