| 1 |
NAME SoTransformManip SoXfManip "" { base class for all transform Nodes with built-in 3D user interfaces } |
| 2 |
|
| 3 |
INCLUDE manips/SoTransformManip.h |
| 4 |
|
| 5 |
DESC { |
| 6 |
\cSoTransformManip\. |
| 7 |
is the base class for all \cSoTransform\. nodes that have a built-in |
| 8 |
3D user interface. |
| 9 |
Since it is derived from \cSoTransform\., any changes to its |
| 10 |
fields result in the rotation, scaling, and/or translation of nodes that |
| 11 |
follow it in the scene graph. |
| 12 |
\p |
| 13 |
Typically, you will want to replace a regular \cSoTransform\. with an |
| 14 |
\cSoTransformManip\. (as when the user selects an object to be moved), |
| 15 |
or vice versa (as when the object is deselected, and the motion interface |
| 16 |
should go away). |
| 17 |
Use the |
| 18 |
\+\mreplaceNode()\. method\. |
| 19 |
\-\mSoXfManipReplaceNode()\. function\. |
| 20 |
to insert a manipulator into a scene graph, and the |
| 21 |
\+\mreplaceManip()\. method\. |
| 22 |
\-\mSoXfManipReplaceManip()\. function\. |
| 23 |
to remove it when done. |
| 24 |
\p |
| 25 |
Every subclass of \cSoTransformManip\. utilizes a dragger of some sort to |
| 26 |
provide a 3D interface. (This class does not have dragger; but all the |
| 27 |
subclasses do.) |
| 28 |
However a manipulator differs from a dragger; it |
| 29 |
influences other objects in the scene because, as an \cSoTransform\., |
| 30 |
it alters the state. |
| 31 |
The fields values and movement of a dragger, on the other hand, affect only |
| 32 |
the dragger itself. |
| 33 |
\p |
| 34 |
Each \cSoTransformManip\. subclass utilizes its dragger by adding it |
| 35 |
as a hidden child. When an action is applied to the manipulator, |
| 36 |
such as rendering or handling events, the manipulator first traverses the |
| 37 |
dragger, and then the manipulator adds its transformation matrix to the state. |
| 38 |
When you click-drag-release over the manipulator, it passes these events down |
| 39 |
to the dragger, which moves as a result ("I can't \ehelp\. it, I'm a dragger!"). |
| 40 |
\p |
| 41 |
The manipulator maintains consistency between the fields |
| 42 |
of the dragger and its own fields. Let's say you use the mouse to rotate |
| 43 |
the \edragger\.. Callbacks insure that the |
| 44 |
\vrotation\. field of the \emanipulator\. will change by the same |
| 45 |
amount, resulting in the rotation of nodes which follow in the scene graph. |
| 46 |
Similarly, if you set any of the \cSoTransformManip\. fields |
| 47 |
the manipulator will |
| 48 |
move the dragger accordingly. You can use this feature |
| 49 |
to impose contraints on a manipulator: If the user moves the manipulator so |
| 50 |
that a field value becomes too large, you can set |
| 51 |
the field back to your desired maximum, and the whole thing will move back to |
| 52 |
where you specified. |
| 53 |
\p |
| 54 |
Since each \cSoTransformManip\. uses a dragger to provide its interface, |
| 55 |
you will generally be told to look at the dragger's reference page for |
| 56 |
details of how it moves and what the different parts are for. |
| 57 |
The interface for the dragger and the manipulator will always be exactly the |
| 58 |
same. |
| 59 |
Usually, a \cSoTransformManip\. will surround the |
| 60 |
objects that it influences (i.e., those that move along with it). |
| 61 |
This is because the manipulator |
| 62 |
turns on the \esurroundScale\. part of its dragger; so the |
| 63 |
dragger geometry expands to envelope the other objects (see the reference |
| 64 |
page for \cSoSurroundScale\.). |
| 65 |
\p |
| 66 |
Because the dragger is a \ehidden\. child, you can see the dragger on screen |
| 67 |
and interact with it, but the dragger |
| 68 |
does not show up when you write the manipulator to file. Also, any \cSoPath\. |
| 69 |
will end at the manipulator. (See the Actions section of this reference page |
| 70 |
for a complete description of when the dragger is traversed). |
| 71 |
\p |
| 72 |
If you want to get a pointer to the dragger |
| 73 |
you can get it from the manipulator using the |
| 74 |
\m\+getDragger()\.\-SoXfManipGetDragger()\.\. method. You will need to |
| 75 |
do this if you want to change the geometry of a manipulator, since the |
| 76 |
geometry actually belongs to the dragger. |
| 77 |
} |
| 78 |
|
| 79 |
METHOD "" SoTransformManip() { |
| 80 |
Constructor. |
| 81 |
} |
| 82 |
|
| 83 |
METHOD getDrag SoDragger *getDragger() { |
| 84 |
Returns a pointer to the dragger being used by this manipulator. |
| 85 |
Given this pointer, you can customize the dragger just like you would |
| 86 |
any other dragger. You can change geometry using |
| 87 |
the \m\+setPart()\.\-SoDragSetPart()\.\. method, or add callbacks using |
| 88 |
the methods found in the \cSoDragger\. reference page. |
| 89 |
} |
| 90 |
|
| 91 |
METHOD "" SbBool replaceNode( SoPath *p ) { |
| 92 |
Replaces the tail of the path with this manipulator. |
| 93 |
The tail of the path must be an \cSoTransform\. node (or subclass thereof). |
| 94 |
If the path has a nodekit, this will try to use |
| 95 |
\m\+setPart()\.\-SoBaseKitSetPart()\.\. to insert the manipulator. |
| 96 |
Otherwise, the manipulator requires that the |
| 97 |
next to last node in the path chain be a group. |
| 98 |
\p |
| 99 |
The field values from the transform node will be copied to |
| 100 |
this manipulator, and the transform will be replaced. |
| 101 |
\p |
| 102 |
The manipulator will not call |
| 103 |
\m\+ref()\.\-SoXfRef()\.\. on the node it is replacing. |
| 104 |
The old node will disappear if |
| 105 |
it has no references other than from the input path \ap\. and its parent, |
| 106 |
since this manipulator will be replacing it in both of those places. |
| 107 |
Nor will the manipulator make any |
| 108 |
changes to field connections of the old node. |
| 109 |
The calling process is thus responsible for keeping |
| 110 |
track of its own nodes and field connections. |
| 111 |
} |
| 112 |
|
| 113 |
METHOD "" SbBool replaceManip(SoPath *p, SoTransform *newOne ) const { |
| 114 |
Replaces the tail of the path, which must be this manipulator, |
| 115 |
with the given \cSoTransform\. node. |
| 116 |
If the path has a nodekit, this will try to use |
| 117 |
\m\+setPart()\.\-SoBaseKitSetPart()\.\. to insert the new node. |
| 118 |
Otherwise, the manipulator requires that the |
| 119 |
next to last node in the path chain be a group. |
| 120 |
\p |
| 121 |
The field values from the manipulator will be copied |
| 122 |
to the transform node, and the manipulator will be replaced. |
| 123 |
\p |
| 124 |
The manipulator will not call |
| 125 |
\+\mref()\. or \munref()\.\. |
| 126 |
\-\mSoXfRef()\. or \mSoXfUnref()\.\. |
| 127 |
on the node which is replacing it, nor will it make any |
| 128 |
changes to field connections. |
| 129 |
The calling process is thus responsible for keeping |
| 130 |
track of its own nodes and field connections. |
| 131 |
} |
| 132 |
|
| 133 |
METHOD "" static SoType getClassTypeId() { |
| 134 |
Returns type identifier for this class. |
| 135 |
} |
| 136 |
|
| 137 |
|
| 138 |
ACTION SoGLRenderAction, SoCallbackAction, |
| 139 |
SoGetBoundingBoxAction, SoGetMatrixAction, |
| 140 |
SoHandleEventAction, SoRayPickAction { |
| 141 |
First, traverses the dragger the way an \cSoGroup\. would. All draggers |
| 142 |
place themselves in space, but leave the current transformation unchanged |
| 143 |
when finished. |
| 144 |
Then the \cSoTransformManip\. accumulates a transformation into the |
| 145 |
current transformation just like its base class, \cSoTransform\.. |
| 146 |
} |
| 147 |
|
| 148 |
ACTION SoSearchAction { |
| 149 |
Searches just like an \cSoTransform\.. Does not search the dragger, |
| 150 |
which is a hidden child. |
| 151 |
} |
| 152 |
|
| 153 |
ACTION SoWriteAction { |
| 154 |
Writes out just like an \cSoTransform\.. Does not write the dragger, |
| 155 |
which is a hidden child. If you really need to write valuable information |
| 156 |
about the dragger, such as customized geometry, you |
| 157 |
can retrieve the dragger with the |
| 158 |
\m\+getDragger()\.\-SoXfManipGetDragger()\.\. method and then write |
| 159 |
it out separately. |
| 160 |
} |
| 161 |
|
| 162 |
ALSO { |
| 163 |
SoDragger, |
| 164 |
SoTransform, |
| 165 |
SoCenterballManip, |
| 166 |
SoHandleBoxManip, |
| 167 |
SoJackManip, |
| 168 |
SoSurroundScale, |
| 169 |
SoTabBoxManip, |
| 170 |
SoTrackballManip, |
| 171 |
SoTransformBoxManip, |
| 172 |
SoTransformerManip |
| 173 |
} |