Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Selection Interface

The SelectionInterface can be used to provide selection functions. Selection works as follows. OpenFlipper basically contains the SelectionBasePlugin which offers some graphical tools (such as selection sphere, lasso tools, etc.) that can be used for selecting entities.

Now each object type (poly/triangle meshes, skeletons, splines, whatever) has to implement its own selection functionality. Say we wanted to implement selection for poly/tri mesh objects. For this purpose we derive a plugin from SelectionInterface and create a new selection environment via the addSelectionEnvironment() signal, naming it e.g. "Mesh Object Selection".

After having created the necessary selection environment, we have to register our specific data type, that is tell the SelectionBase plugin which data types will be handled (selected) by our plugin. In the example from above we would register DATA_POLY_MESH as well as DATA_TRIANGLE_MESH. We do this by calling the signal registerType(). Now we have to determine which primitive type should be selectable. For poly/tri meshes we would determine vertices, edges, halfedges and faces to be selectable. This is performed via emission of the signal addPrimitiveType().

We can then choose which of the default selection tools should be available for this environment. We could, for example, request the toggle, flood fill and the sphere selection tool by calling the signals showToggleSelectionMode(), and so on. Additionally, it's possible to create custom selection tools that can be completely different from the default ones.

After having requested the desired selection tools, each time a selection tool has been used, the appropriate slot is called for further processing, that is the actual selection of the primitives.

SelectionInterface also provides means to add operations for a specific primitive type (such as, for example, "Clear Vertex Selection" or "Select All Vertices" for vertex selections). We can tell SelectionBase to add there operations by emitting addSelectionOperations(). Each time an operation button has been clicked, slot slotSelectionOperation() is called.

The overall idea is to separate the UI and control elements from actual implementations of selection functionality for a specific data type. So, in general SelectionBase manages all UI control elements and and the rendering of the selection tools whereas the specific type selection plugins manage the real selection of their entities as well as scripting functions.