Selection Operation - Overview
Selection Operations allow mesh operation edits to be limited to specific points, edges and polygons. Before a procedural edit is performed, the selection operation is evaluated for each element on the mesh, and the result is stored in a mark mode on the mesh that can be evaluated by the mesh operation. The Selection Operation evaluation is multi-threaded, and can use any rules they want to determine if a specific element should be modified by the procedural edit.
LXxMETHOD( LxResult, SetMesh) ( LXtObjectID self, LXtObjectID mesh);
Before the selection operation is evaluated per element, this function is called to inform the selection operation which mesh that is currently being evaluated. The selection operation can cache this COM interface for easy access to the mesh during evaluation.
LXxMETHOD( LxResult, SetTransform) ( LXtObjectID self, LXtMatrix4 xfrm);
Elements on the mesh being evaluated will be in local space, however, for selection operations that read element positions, it may be more convenient for the positions to be in world space. This function is called before the selection operation is evaluated, providing the selection operation with the transform of the mesh that is being evaluated. The transform matrix should be cached, so it can be used to transform element positions into world space.
LXxMETHOD( LxResult, TestPoint) ( LXtObjectID self, LXtPointID point); LXxMETHOD( LxResult, TestEdge) ( LXtObjectID self, LXtEdgeID edge); LXxMETHOD( LxResult, TestPolygon) ( LXtObjectID self, LXtPolygonID polygon);
The Test functions test individual elements to see if they should be selected. The element pointer is passed in, and the function should return either LXe_TRUE or LXe_FALSE if the element is selected. The implementation of these functions must be thread safe, as meshes that contain more than 100 elements are evaluated from multiple threads.
The selection operation item provides a selection to the procedural system. It encapsulates channels that can be evaluated to determine the current selection state. This item will be evaluated prior to a procedural edit to determine which elements should be operated on. Selection Operation items all derive from a common type. This type is extremely basic and has no transforms or position in 3D space. The default channels define enable state and the output channel to which the ILxSelectionOperationID is written.
#define LXsITYPE_SELOP "selectionoperation" #define LXsICHAN_SELOP_ENABLE "enable" #define LXsICHAN_SELOP_OBJ "selopobj"
Along with Mesh Operations and Tool Operations, Selection Operations should specify the types of selection they support. This combination of selection types on both the selection operation and the mesh operation helps determine which selection operations can be used with which mesh operations.
Supported selection types are defined using the following server tag. The server is expected to provide a comma separated list of selection types. The server should implement the Test functions for any element type they support. Any other value will be treated as supporting all selection types.
#define LXsPMODEL_SELECTIONTYPES "selectionoperation" #define LXsSELOP_TYPE_VERTEX "VERX" #define LXsSELOP_TYPE_EDGE "EDGE" #define LXsSELOP_TYPE_POLYGON "POLY"
Similar to the Mesh Operation and Tool Operation, the Selection Operation item can provide a creation command that will be executed to handle its creation. This allows things like dialogs to be created to ask the user for input, or to create graph connections on creation. To define a creation command, the following server tag should be added to the selection operation server or item type, the value of the tag should be the command to execute.
#define LXsPKG_MESHOP_CREATECMD "meshop.create"