Scripting the Transform panel buttons


The state of the buttons on the Transform panel are saved in the 3D_TRANSFO_REFERENTIAL_CHANGED preference, which is a bitfield.

So, for example, to enable the Ref manipulation mode, you would do this:

SetUserPref(
	"3D_TRANSFO_REFERENTIAL_CHANGED",
	GetUserPref("3D_TRANSFO_REFERENTIAL_CHANGED") | 3 );

This would turn on the Ref mode, and leave the COG, Prop, and Sym options untouched.

If you simply did this:

SetUserPref( "3D_TRANSFO_REFERENTIAL_CHANGED", 3 );

that would reset the COG and Sym options.

Turn on COG:

SetUserPref(
 	"3D_TRANSFO_REFERENTIAL_CHANGED",
 	GetUserPref("3D_TRANSFO_REFERENTIAL_CHANGED") | 16 );

Turn off COG:

SetUserPref(
 	"3D_TRANSFO_REFERENTIAL_CHANGED",
 	GetUserPref("3D_TRANSFO_REFERENTIAL_CHANGED") & ~16 );

Another example:

// Turn off all
SetUserPref( "3D_TRANSFO_REFERENTIAL_CHANGED", 0 );

// Turn on Local and COG
SetUserPref(
 	"3D_TRANSFO_REFERENTIAL_CHANGED",
 	GetUserPref("3D_TRANSFO_REFERENTIAL_CHANGED") | (16 | 2) );

You can use Alt+NumPad numbers to see what gets logged when the different buttons are selected.
The SDK documentation also includes a page for the Manipulation Mode Values.

3 thoughts on “Scripting the Transform panel buttons

  1. I’m just looking at doing something with this. Good timing 🙂

    So is there a way of setting what type the Reference mode is referring to? I.e. a point, edge, polygon, or object, etc. and which specific component or scene object to use as the reference? I couldn’t see a way of doing it.

    Thanks,
    Andy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s