| 1 |
NAME SoTabPlaneDragger SoTabPlnDrag "" { object you can translate or scale within a plane by dragging with the mouse } |
| 2 |
|
| 3 |
INCLUDE draggers/SoTabPlaneDragger.h |
| 4 |
|
| 5 |
DESC { \cSoTabPlaneDragger\. is a dragger which allows the user |
| 6 |
to interactively translate and scale in a plane. It looks like |
| 7 |
a square white outline with smaller green squares (or \etabs\.) set |
| 8 |
in the corners and along the center of each edge. Dragging a \vcorner tab\. |
| 9 |
scales the dragger in 2D by scaling about the opposite corner. |
| 10 |
Dragging an \vedge tab\. performs 1D scaling about the opposite edge. |
| 11 |
The rest of the dragger is invisible but pickable; selecting it |
| 12 |
initiates translation within the plane. |
| 13 |
\p |
| 14 |
The dragger tries to keep the small tabs a constant size in screen space. |
| 15 |
Every time a drag begins or ends, the size is recalculated based on the |
| 16 |
viewing and modeling matrix. |
| 17 |
\p |
| 18 |
When dragging the translator part, |
| 19 |
press the \k<Shift>\. key and you can constrain motion to either the |
| 20 |
local \vx axis\. or the \vy axis\.. The direction is determined by your initial |
| 21 |
mouse gesture after pressing the key. Releasing the key removes the constraint. |
| 22 |
\p |
| 23 |
When the translator part drags, the dragger updates its \vtranslation\. |
| 24 |
field. The various scaling parts cause changes to both the |
| 25 |
\vscaleFactor\. and \vtranslation\. field, since scaling about a point other |
| 26 |
than the center adds translation to the center of the dragger. |
| 27 |
If you set the field, the dragger will move accordingly. |
| 28 |
You can also connect fields of other nodes or engines from |
| 29 |
this one |
| 30 |
to make them follow the dragger's motion. |
| 31 |
\p |
| 32 |
You can not change the shape used to draw |
| 33 |
the tabs. This part is kept privately and may not be changed; the |
| 34 |
coordinates for the tabs are edited during |
| 35 |
\m\+adjustScaleTabSize()\.\-SoTabPlnDrag::adjustScaleTabSize()\.\.. |
| 36 |
\p |
| 37 |
The \cSoTabPlaneDragger\. class does contain three other parts you can |
| 38 |
change: \etabPlaneTranslator\., \etabPlaneScaleTabMaterial\. and |
| 39 |
\etabPlaneScaleTabHints\.. |
| 40 |
\p |
| 41 |
Each of these is set by default from |
| 42 |
a resource described in the Dragger Resources section of the online |
| 43 |
reference page for this class. You |
| 44 |
can change the parts in any instance of this dragger using |
| 45 |
\m\+setPart()\.\-SoDraggerSetPart()\.\.. |
| 46 |
\p |
| 47 |
You can make your program use different default resources for the parts |
| 48 |
by copying the file |
| 49 |
\v/usr/share/data/draggerDefaults/tabPlaneDragger.iv\. |
| 50 |
into your own directory, editing the file, and then |
| 51 |
setting the environment variable \vSO_DRAGGER_DIR\. to be a path to that directory. |
| 52 |
} |
| 53 |
|
| 54 |
METHOD "" SoTabPlaneDragger() { |
| 55 |
Constructor. |
| 56 |
} |
| 57 |
|
| 58 |
METHOD "" void adjustScaleTabSize() { |
| 59 |
Cause the scale tab sizes to be re-adjusted |
| 60 |
so that they remain a near constant screen space size. |
| 61 |
This happens automatically upon dragger finish. |
| 62 |
Call this to adjust the scale tab sizes at other times, for instance |
| 63 |
after the camera has changed in a viewer finish callback. |
| 64 |
} |
| 65 |
METHOD getClassNkitCat static |
| 66 |
const SoNodekitCatalog *getClassNodekitCatalog() const |
| 67 |
{ Returns an \cSoNodekitCatalog\. for this class } |
| 68 |
|
| 69 |
METHOD "" static SoType getClassTypeId() { |
| 70 |
Returns type identifier for this class. |
| 71 |
} |
| 72 |
|
| 73 |
FIELD scaleFactor { Scale factor affecting the dragger. } |
| 74 |
FIELD translation { Position of the dragger. } |
| 75 |
|
| 76 |
DRAGGER_RESOURCE { |
| 77 |
tabPlaneTranslator, |
| 78 |
translator, |
| 79 |
"Outline of a Square. The region within it is pickable", |
| 80 |
"Begins translation within the plane" |
| 81 |
} |
| 82 |
|
| 83 |
DRAGGER_RESOURCE { |
| 84 |
tabPlaneScaleTabMaterial, |
| 85 |
scaleTabMaterial, |
| 86 |
"Green - half diffuse, half emissive.", |
| 87 |
"Used as material for scaling tabs." |
| 88 |
} |
| 89 |
|
| 90 |
DRAGGER_RESOURCE { |
| 91 |
tabPlaneScaleTabHints, |
| 92 |
scaleTabHints, |
| 93 |
"shapeHints node:COUNTERCLOCKWISE/SOLID/CONVEX", |
| 94 |
"Property for the tab nodes." |
| 95 |
} |
| 96 |
|
| 97 |
|
| 98 |
ALSO { |
| 99 |
SoInteractionKit, |
| 100 |
SoDragger, |
| 101 |
SoCenterballDragger, |
| 102 |
SoDirectionalLightDragger, |
| 103 |
SoDragPointDragger, |
| 104 |
SoHandleBoxDragger, |
| 105 |
SoJackDragger, |
| 106 |
SoPointLightDragger, |
| 107 |
SoRotateCylindricalDragger, |
| 108 |
SoRotateDiscDragger, |
| 109 |
SoRotateSphericalDragger, |
| 110 |
SoScale1Dragger, |
| 111 |
SoScale2Dragger, |
| 112 |
SoScale2UniformDragger, |
| 113 |
SoScaleUniformDragger, |
| 114 |
SoSpotLightDragger, |
| 115 |
SoTabBoxDragger, |
| 116 |
SoTrackballDragger, |
| 117 |
SoTransformBoxDragger, |
| 118 |
SoTransformerDragger, |
| 119 |
SoTranslate1Dragger, |
| 120 |
SoTranslate2Dragger |
| 121 |
} |
| 122 |
|