Open Inventor Reference
|
Striped ball you can rotate or scale uniformly by dragging with the mouse. More...
#include <Inventor/draggers/SoTrackballDragger.h>
Public Member Functions | |
SoTrackballDragger () | |
Constructor. | |
SbBool | isAnimationEnabled () |
void | setAnimationEnabled (SbBool newVal) |
If the mouse is moving while you release it, the trackball will continue to spin afterwards. | |
Static Public Member Functions | |
static void | initClass () |
initialize the class | |
Public Attributes | |
SoSFRotation | rotation |
SoSFVec3f | scaleFactor |
Protected Member Functions | |
void | dragStart () |
These really do the work during startCB, motionCB, and finishCB. | |
void | drag () |
void | dragFinish () |
void | setAllPartsActive (SbBool onOrOff) |
virtual SbBool | setUpConnections (SbBool onOff, SbBool doItAlways=FALSE) |
detach/attach any sensors, callbacks, and/or field connections. | |
virtual void | setDefaultOnNonWritingFields () |
Called by the SoBaseKit::write() method. | |
virtual | ~SoTrackballDragger () |
Static Protected Member Functions | |
static void | startCB (void *, SoDragger *) |
Callbacks for drag start, motion, and finish. | |
static void | motionCB (void *, SoDragger *) |
static void | finishCB (void *, SoDragger *) |
static void | fieldSensorCB (void *, SoSensor *) |
static void | valueChangedCB (void *, SoDragger *) |
static void | metaKeyChangeCB (void *, SoDragger *) |
Callback for pressing and releasing the meta keys. | |
Protected Attributes | |
SoFieldSensor * | rotFieldSensor |
SoFieldSensor * | scaleFieldSensor |
SoTrackballDragger is a ball wrapped in three circular stripes. The stripes are oriented like wheels that spin around the x, y, and z axes. Drag the stripes to rotate the trackball around those axes. You do not have to hit the lines; pick anywhere within the stripe's outline. To rotate the trackball freely in 3 dimensions, click the area between the stripes and then drag. An invisible but pickable sphere initiates this dragging. If the mouse is still moving when you release it, the trackball will continue to spin.
Press the <Control>
key to scale the trackball uniformly instead of rotating.
Press the <Shift>
key and the user axis appears; this is a draggable axis with an extra stripe around it. Moving the mouse along the surface of the sphere drags the 'pole' of the axis. Release the <Shift>
key and the user axis remains; drag the new stripe for constrained rotation around the user axis. To make the user axis disappear, press <Shift>
and drag the pole to where two of other stripes intersect. This aligns the user axis with a primary axis, at which point the user axis disappears.
As you drag the trackball, it updates its rotation field, or its scaleFactor field if the <Control>
key is down. As with all draggers, if you change the fields the dragger moves in response.
Remember:
This is not an SoTransform!. If you want to move other objects with this dragger, you can either:
[a] Use an SoTrackballManip, which is subclassed from SoTransform. The manipulator creates one of these draggers and uses it as the interface to edit the manipulator's fields. (see the SoTrackballManip reference page).
[b] Use field-to-field connections to connect the fields of this dragger to those of any SoTransformation node.
You can change the parts in any instance of this dragger using setPart(). The default part geometries are defined as resources for this SoTrackballDragger class. They are detailed in the Dragger Resources section of the online reference page for this class. You can make your program use different default resources for the parts by copying the file /usr/share/data/draggerDefaults/trackballDragger.iv into your own directory, editing the file, and then setting the environment variable SO_DRAGGER_DIR to be a path to that directory.
TrackballDragger { renderCaching AUTO boundingBoxCaching AUTO renderCulling AUTO pickCulling AUTO isActive FALSE rotation 0 0 1 0 scaleFactor 1 1 1 }
Definition at line 192 of file SoTrackballDragger.h.
SoTrackballDragger::SoTrackballDragger | ( | ) |
virtual SoTrackballDragger::~SoTrackballDragger | ( | ) | [protected, virtual] |
void SoTrackballDragger::drag | ( | ) | [protected] |
void SoTrackballDragger::dragFinish | ( | ) | [protected] |
void SoTrackballDragger::dragStart | ( | ) | [protected] |
static void SoTrackballDragger::fieldSensorCB | ( | void * | , |
SoSensor * | |||
) | [static, protected] |
Reimplemented from SoInteractionKit.
static void SoTrackballDragger::finishCB | ( | void * | , |
SoDragger * | |||
) | [static, protected] |
static void SoTrackballDragger::initClass | ( | ) | [static] |
Reimplemented from SoDragger.
SbBool SoTrackballDragger::isAnimationEnabled | ( | ) | [inline] |
Definition at line 233 of file SoTrackballDragger.h.
static void SoTrackballDragger::metaKeyChangeCB | ( | void * | , |
SoDragger * | |||
) | [static, protected] |
static void SoTrackballDragger::motionCB | ( | void * | , |
SoDragger * | |||
) | [static, protected] |
void SoTrackballDragger::setAllPartsActive | ( | SbBool | onOrOff | ) | [protected] |
void SoTrackballDragger::setAnimationEnabled | ( | SbBool | newVal | ) |
These two methods will query and set whether this feature is turned on or off. By default, the animation feature is turned on.
virtual void SoTrackballDragger::setDefaultOnNonWritingFields | ( | ) | [protected, virtual] |
Draggers don't want to write out fields if they have default vals.
sets isActive to default if default and not connected.
Looks for fields named: 'rotation' with value SbRotation::identity() 'translation' with value (0,0,0) 'center' with value (0,0,0) 'scaleFactor' with value (1,1,1) and sets them to default if they are not connected from a field. (most draggers are missing at least some of these, but thats okay)
Then calls the method for SoInteractionKit.
NOTE: Parts which are set to default may still wind up writing to file if, for example, they lie on a path.
Reimplemented from SoDragger.
virtual SbBool SoTrackballDragger::setUpConnections | ( | SbBool | onOff, |
SbBool | doItAlways = FALSE |
||
) | [protected, virtual] |
Called by: start/end of SoBaseKit::readInstance and on new copy by: start/end of SoBaseKit::copy. Classes that redefine must call setUpConnections(TRUE,TRUE) at end of constructor. Returns the state of the node when this was called.
Reimplemented from SoInteractionKit.
static void SoTrackballDragger::startCB | ( | void * | , |
SoDragger * | |||
) | [static, protected] |
static void SoTrackballDragger::valueChangedCB | ( | void * | , |
SoDragger * | |||
) | [static, protected] |
Definition at line 229 of file SoTrackballDragger.h.
SoFieldSensor* SoTrackballDragger::rotFieldSensor [protected] |
Definition at line 250 of file SoTrackballDragger.h.
Definition at line 230 of file SoTrackballDragger.h.
SoFieldSensor* SoTrackballDragger::scaleFieldSensor [protected] |
Definition at line 251 of file SoTrackballDragger.h.