| 1 |
NAME SoPointLightManip SoPtLtManip "" { |
| 2 |
point light node with 3D interface for editing location |
| 3 |
} |
| 4 |
|
| 5 |
INCLUDE manips/SoPointLightManip.h |
| 6 |
|
| 7 |
DESC { |
| 8 |
\cSoPointLightManip\. is the base class for all \cSoPointLight\. nodes |
| 9 |
that have a built-in 3D user interface (this is the only such class |
| 10 |
provided with the Inventor toolkit). Since it is derived from |
| 11 |
\cSoPointLight\., any changes to its fields result in a change of |
| 12 |
lighting for nodes that follow it in the scene graph. In this case, the |
| 13 |
interface edits the \vlocation\. field. Also, the color of the |
| 14 |
manipulator's geometry will reflect the color of the light (but you can |
| 15 |
not edit the color using this manipulator). |
| 16 |
\p |
| 17 |
Typically, you will want to replace a regular \cSoPointLight\. with an |
| 18 |
\cSoPointLightManip\. (as when the user selects a light to be edited), |
| 19 |
or vice versa (as when the user is done moving the light and the interface |
| 20 |
should go away). |
| 21 |
Use the |
| 22 |
\+\mreplaceNode()\. method\.\-\mSoPtLtManipReplaceNode()\. function\. |
| 23 |
to insert a manipulator into a scene graph, and the |
| 24 |
\+\mreplaceManip()\. method\.\-\mSoPtLtManipReplaceManip()\. function\. |
| 25 |
to remove it when done. |
| 26 |
\p |
| 27 |
The \cSoPointLightManip\. utilizes an \cSoPointLightDragger\. to |
| 28 |
provide a 3D interface. However, the manipulator differs from the |
| 29 |
dragger; it lights other objects in the scene because, as an |
| 30 |
\cSoPointLight\., it alters the state. The fields values and movement |
| 31 |
of the dragger, on the other hand, affect only the dragger itself. To |
| 32 |
find out more about how the interface works and what each part will do, |
| 33 |
see the reference page for \cSoPointLightDragger\.. The interfaces of |
| 34 |
the dragger and the manipulator are identical. |
| 35 |
\p |
| 36 |
The \cSoPointLightManip\. utilizes its dragger by adding it |
| 37 |
as a hidden child. When an action is applied to the manipulator, |
| 38 |
such as rendering or handling events, the manipulator first traverses the |
| 39 |
dragger, and then the manipulator adds its lighting parameters to the state. |
| 40 |
When you click-drag-release over the manipulator, it passes these events down |
| 41 |
to the dragger, which moves as a result ("I can't \ehelp\. it, I'm a dragger!"). |
| 42 |
\p |
| 43 |
The manipulator maintains consistency between the fields |
| 44 |
of the dragger and its own fields. Let's say you use the mouse to translate |
| 45 |
the \edragger\.. Callbacks insure that the |
| 46 |
\vlocation\. field of the \emanipulator\. will change by the same |
| 47 |
amount, thus changing the lighting of nodes which follow |
| 48 |
in the scene graph. |
| 49 |
Similarly, if you set the \vlocation\. field of the |
| 50 |
\cSoPointLightManip\., the manipulator will |
| 51 |
place the dragger accordingly. |
| 52 |
\p |
| 53 |
Because the dragger is a \ehidden\. child, you can see the dragger on screen |
| 54 |
and interact with it, but the dragger |
| 55 |
does not show up when you write the manipulator to file. Also, any \cSoPath\. |
| 56 |
will end at the manipulator. (See the Actions section of this reference page |
| 57 |
for a complete description of when the dragger is traversed). |
| 58 |
\p |
| 59 |
If you want to get a pointer to the dragger |
| 60 |
you can get it from the manipulator using the |
| 61 |
\m\+getDragger()\.\-SoPtLtManipGetDragger()\.\. method. You will need to |
| 62 |
do this if you want to change the geometry of a manipulator, since the |
| 63 |
geometry actually belongs to the dragger. |
| 64 |
} |
| 65 |
|
| 66 |
METHOD "" SoPointLightManip() { |
| 67 |
Constructor. |
| 68 |
} |
| 69 |
|
| 70 |
METHOD getDrag SoDragger *getDragger() { |
| 71 |
Returns a pointer to the dragger being used by this manipulator. |
| 72 |
Given this pointer, you can customize the dragger just like you would |
| 73 |
any other dragger. You can change geometry using |
| 74 |
the \m\+setPart()\.\-SoDragSetPart()\.\. method, or add callbacks using |
| 75 |
the methods found in the \cSoDragger\. reference page. |
| 76 |
} |
| 77 |
|
| 78 |
METHOD "" SbBool replaceNode( SoPath *p ) { |
| 79 |
Replaces the tail of the path with this manipulator. |
| 80 |
The tail of the path must be an \cSoPointLight\. node (or subclass thereof). |
| 81 |
If the path has a nodekit, this will try to use |
| 82 |
\m\+setPart()\.\-SoBaseKitSetPart()\.\. to insert the manipulator. |
| 83 |
Otherwise, the manipulator requires that the |
| 84 |
next to last node in the path chain be a group. |
| 85 |
\p |
| 86 |
The field values from the point light node will be copied to |
| 87 |
this manipulator, and the light node will be replaced. |
| 88 |
\p |
| 89 |
The manipulator will not call |
| 90 |
\m\+ref()\.\-SoPtLtRef()\.\. on the node it is replacing. |
| 91 |
The old node will disappear if |
| 92 |
it has no references other than from the input path \ap\. and its parent, |
| 93 |
since this manipulator will be replacing it in both of those places. |
| 94 |
Nor will the manipulator make any |
| 95 |
changes to field connections of the old node. |
| 96 |
The calling process is thus responsible for keeping |
| 97 |
track of its own nodes and field connections. |
| 98 |
} |
| 99 |
|
| 100 |
METHOD "" SbBool replaceManip(SoPath *p, SoPointLight *newOne ) const { |
| 101 |
Replaces the tail of the path, which must be this manipulator, |
| 102 |
with the given \cSoPointLight\. node. |
| 103 |
If the path has a nodekit, this will try to use |
| 104 |
\m\+setPart()\.\-SoBaseKitSetPart()\.\. to insert the new node. |
| 105 |
Otherwise, the manipulator requires that the |
| 106 |
next to last node in the path chain be a group. |
| 107 |
\p |
| 108 |
The field values from the manipulator will be copied |
| 109 |
to the point light node, and the manipulator will be replaced. |
| 110 |
\p |
| 111 |
The manipulator will not call |
| 112 |
\+\mref()\. or \munref()\.\. |
| 113 |
\-\mSoPtLtRef()\. or \mSoPtLtUnref()\.\. |
| 114 |
on the node which is replacing it, nor will it make any |
| 115 |
changes to field connections. |
| 116 |
The calling process is thus responsible for keeping |
| 117 |
track of its own nodes and field connections. |
| 118 |
} |
| 119 |
|
| 120 |
METHOD "" static SoType getClassTypeId() { |
| 121 |
Returns type identifier for this class. |
| 122 |
} |
| 123 |
|
| 124 |
ACTION SoGLRenderAction, SoCallbackAction, |
| 125 |
SoGetBoundingBoxAction, SoGetMatrixAction, |
| 126 |
SoHandleEventAction, SoRayPickAction { |
| 127 |
First, traverses the dragger the way an \cSoGroup\. would. All draggers |
| 128 |
place themselves in space, but leave the current transformation unchanged |
| 129 |
when finished. |
| 130 |
Then the \cSoPointLightManip\. adds a point light into the state, |
| 131 |
just like its base class, \cSoPointLight\.. |
| 132 |
} |
| 133 |
|
| 134 |
ACTION SoSearchAction { |
| 135 |
Searches just like an \cSoPointLight\.. Does not search the dragger, |
| 136 |
which is a hidden child. |
| 137 |
} |
| 138 |
|
| 139 |
ACTION SoWriteAction { |
| 140 |
Writes out just like an \cSoPointLight\.. Does not write the dragger, |
| 141 |
which is a hidden child. If you really need to write valuable information |
| 142 |
about the dragger, such as customized geometry, you |
| 143 |
can retrieve the dragger with the |
| 144 |
\m\+getDragger()\.\-SoPtLtManipGetDragger()\.\. method and then write |
| 145 |
it out separately. |
| 146 |
} |
| 147 |
ALSO { |
| 148 |
SoDragger, |
| 149 |
SoPointLight, |
| 150 |
SoPointLightDragger, |
| 151 |
SoDirectionalLightManip, |
| 152 |
SoSpotLightManip |
| 153 |
} |
| 154 |
|