Manipulators and Draggers

The strong points of Open Inventor are the ease of creating 3D user interfaces. Manipulators and Draggers are objects for user interaction like a scrollbar or button in a 2D user interface. A Dragger use user input via the mouse to visualize the change and to provide the change for other objects in the scene graph. This has to be programmed explicitly compared to a Manipulator. A Manipulator is in principle a dragger plus an object (e.g., Transform Node) which is part of a scene graph.

Dragger

The output of a dragger needs to be given to the scene graph via connections (and might pass some engines) or via a callback function which is controlled by the application.
Display Graph
Dragger Dragger

In our example we connect a SoScale node with SoScale1Dragger.

Constrained Dragger

A dragger can be constrained by a callback function (e.g. addChangeValueCB) or an engine.
Display Graph
Dragger Dragger

In our example we plug between the dragger and the scaling node a calculator which constrains the size in x direction. The expression for the calculator is: oA= (A[0]<1.2) ? A : vec3f(1.2,A[1],A[2])

Manipulator

A Manipulator is an interactive version of a node (transformation, light, ..). This will be more clear by looking at the class hierarchy. So is for example SoTransformManip a sub class of SoTransform.
Display Graph
Manipulator ExampleManipulator Example

The Manipulator example shows the SoTransformerManip node, which allows to change size, transformation and rotation.

Constrained Manipulator

A Manipulator can be easily constrained by attaching a callback function to the connected Dragger.

Manipulator
Constrained Example

The Manipulator is constrained in size by using following callback function: void valueChangedCB(void *user, SoDragger *inDragger) { // we need access to the fields SoTransformerDragger *dragger = (SoTransformerDragger *) inDragger; // constrain in X direction if (dragger->scaleFactor.getValue()[0] > MAXSIZE) dragger->scaleFactor.setValue(MAXSIZE, dragger->scaleFactor.getValue()[1], dragger->scaleFactor.getValue()[2]); else if (dragger->scaleFactor.getValue()[0] < MINSIZE) dragger->scaleFactor.setValue(MINSIZE, dragger->scaleFactor.getValue()[1], dragger->scaleFactor.getValue()[2]); } The executable is also available (compiled with OI 2.1.1, so you need the latest run-time libraries).
Jens Herder