Sub-object Coordinate Systems:

3DS Max Plug-In SDK

Sub-Object Coordinate Systems:

See Also: Class BaseObject, Class Control, Class SubObjAxisCallback.

When a modifier or controller is in a sub-object selection level, it has the ability to define the meaning of some of MAX's reference coordinate systems. MAX's reference coordinate system has two parts: The reference coordinate system drop down list and the center button. These are described below:

1 The reference coordinate system drop down list. This lets the user select the orientation of the reference coordinate system. While the user is in a sub-object selection state, 'local' refers to the local coordinate system of the currently selected sub-object element and 'parent' refers to the node's local coordinate system.

What a sub-object's local coordinate system means is up to the modifier or controller. For example, Bend (and in fact, any modifier using SimpleMod as a base class) define local to mean the coordinate system of the gizmo. The Edit Mesh modifier defines local to mean different things for face and vertex selection levels. For face, the modifier constructs a coordinate system where the Z axis is parallel to the face's normal and X lies somewhere in the world XY plane perpendicular to Z. The Y axis is then given by X and Z. For vertices, a similar thing is done -- the vertex normal used for smoothing is used to define the Z axis. X and Y are constructed the same way as above.

2 The center button. This button allows the user to choose the position of the center of the reference coordinate system. It has 3 options: Center of the selection set, Center of the reference coordinate system, and Pivot point. If the reference drop down list is set to local and the center button is set to center of the reference coordinate system, then the modifier or controller defines the position of the center when it constructs the local coordinate system. For center of selection and pivot point, it is up to the modifier or controller to decide what these mean. The Edit Mesh modifier defines center of the selection set to be the average of all vertices referenced by selected faces and the pivot point to be the center of a face cluster.

When the user is in a sub-object selection level, the system needs to get the reference coordinate system definition from the current modifier or controller being edited so that it can display the axes. Two methods (from BaseObject or Control) allow the system to do this:

GetSubObjectCenters(SubObjAxisCallback *cb,TimeValue t,INode *node)

This method specifies the position of the center. The plug-in enumerates its centers and calls the callback cb once for each.

GetSubObjectTMs(SubObjAxisCallback *cb,TimeValue t,INode *node)

This method returns the axis system of the reference coordinate system. The plug-in enumerates its TMs and calls the callback cb once for each.