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.

Messing around with vertex colors


Using Get Nearby Points to average vertex colors

Here’s a screenshot of the ICE tree.
In the first branch, I get the vertex colors (via the NodeLocation attribute) of the nearby points, and store them in an attribute.

Then I get the saved vertex colors and do a simple Array Average on the RGB components, to give me a Color per Sample value that I can put back into the Color at Vertices (CAV) property.