Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoQtDirectionalLightEditor.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24#ifndef _SO_QT_DIRECTIONAL_LIGHT_EDITOR_
25#define _SO_QT_DIRECTIONAL_LIGHT_EDITOR_
26#include <Inventor/Qt/OivQtCompat.h>
27#include <Inventor/Qt/SoQtComponent.h>
28#include <Inventor/misc/SoCallbackList.h>
29
30class SbColor;
32class SoSeparator;
34class SoDragger;
35class SoQtColorEditor;
36class SoQtColorSlider;
37class SoQtRenderArea;
38class SoNodeSensor;
39class QMenu;
40class QAction;
41class SoSensor;
42class SoCamera;
44class SoPath;
45
46// callback function prototypes
48typedef void SoQtDirectionalLightEditorCB(void *userData, const SoDirectionalLight *light);
49
50
52// Class: SoQtDirectionalLightEditor
53
82
83 Q_OBJECT
84
85 public:
89 SoQtDirectionalLightEditor( QWidget* parent = qApp->activeWindow(),
90 const char *name = NULL,
91 SbBool buildInsideParent = TRUE);
96
101 void attach(SoPath *pathToLight);
105 void detach();
109 SbBool isAttached() { return (dirLight != NULL); }
110
114 void setLight(const SoDirectionalLight &newLight);
118 const SoDirectionalLight &getLight() const { return *dirLight; }
119
126 void *userData = NULL)
127 { callbackList->addCallback((SoCallbackListCB *) f, userData); }
132 void *userData = NULL)
133 { callbackList->removeCallback((SoCallbackListCB *) f, userData); }
134
135 // Redefined here since there are two windows to deal with -
136 // the color editor and the light manipulator
137 virtual void show();
138 virtual void hide();
139
140 private:
141 QWidget* mgrWidget; // topmost widget
142
143 // This constructor takes a boolean whether to build the widget now.
144 // Subclasses can pass FALSE, then call SoQtDirectionalLightEditor::buildWidget()
145 // when they are ready for it to be built.
146 SoEXTENDER
147 SoQtDirectionalLightEditor( QWidget* parent,
148 const char *name,
149 SbBool buildInsideParent,
150 SbBool buildNow);
151
152 // redefine these
153 virtual SbString getDefaultWidgetName() const;
154 virtual SbString getDefaultTitle() const;
155 virtual SbString getDefaultIconTitle() const;
156
157 // Open Inventor parts
158 SoDirectionalLight* dirLight; // light we are editing
159 SoSeparator* root; // root of local scene graph
160 SoSeparator* litStuff; // what's on display under the light
161 SoPerspectiveCamera* myCamera;
162 SoCamera* cameraToWatch;
163 SoNodeSensor* lightSensor;
164 SoNodeSensor* cameraSensor;
165 SoDirectionalLightManip* dirLightManip;
166 static char* geomBuffer;
167
168 // UI parts
169 SoQtColorEditor *colorEditor;
170 SoQtColorSlider* intensitySlider;
171 SoQtRenderArea* renderArea;
172 // SoQtClipboard *clipboard;
173
174 // Calbacks
175 SbBool ignoreCallback; // TRUE while callback should be ignored
176 SoCallbackList* callbackList;
177
178 // Copy and updates
179 void copyLight(SoDirectionalLight *dst, const SoDirectionalLight *src);
180 void updateLocalComponents();
181
182 private:
183
184 // Build routines
185 void constructorCommon(SbBool buildNow);
186 QWidget* buildWidget(QWidget* parent);
187 void activate(); // connects the sensor
188 void deactivate(); // disconnects the sensor
189
190 // Callbacks
191 static void colorEditorCloseCB(void *userData, SoQtComponent *comp) ;
192 static void colorEditorCB(void *, const SbColor *);
193 static void dirLightManipCB(void *, SoDragger *);
194 static void intensitySliderCB(void*, float);
195 static void cameraSensorCB(SoQtDirectionalLightEditor *, SoSensor *);
196 static void lightSensorCB(SoQtDirectionalLightEditor *, SoSensor *);
197 static void dialogCloseCB(void*, SoQtComponent*);
198
199 //qt variables
200 QMenu* edit_menu;
201 QAction* IDM_LEDT_COLOR_EDITOR;
202
203 private Q_SLOTS:
204 void visibilityChangeCB(SbBool visible);
205 void launchColorEditor();
206 void copy();
207 void paste();
208 void showHelp();
209 void keepOnTop();
210 void slot_help();
211};
212
213#endif // _SO_QT_DIRECTIONAL_LIGHT_EDITOR_
214
Color vector class.
Definition SbColor.h:82
Class for smart character strings.
Definition SbString.h:202
Manages a list of callbacks and associated data.
void addCallback(SoCallbackListCB *f, void *userData=NULL)
Adds a function to the list of callback functions.
void removeCallback(SoCallbackListCB *f, void *userData=NULL)
Removes a function from the list of callback functions.
Abstract base class for camera nodes.
Definition SoCamera.h:188
Node representing a directional light source.
Directional light node with 3D interface for editing direction.
Base class for nodekits that move in response to click-drag-release mouse events.
Definition SoDragger.h:537
Sensor class that can be attached to Open Inventor nodes.
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
Perspective camera node.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Component that l...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Component for ed...
SoQtDirectionalLightEditor(QWidget *parent=qApp->activeWindow(), const char *name=NULL, SbBool buildInsideParent=TRUE)
Constructor.
void attach(SoPath *pathToLight)
Attaches the editor to a directional light.
void setLight(const SoDirectionalLight &newLight)
Sets new light values.
void detach()
Detaches the editor from a directional light.
~SoQtDirectionalLightEditor()
Destructor.
void SoQtDirectionalLightEditorCB(void *userData, const SoDirectionalLight *light)
void removeLightChangedCallback(SoQtDirectionalLightEditorCB *f, void *userData=NULL)
Removes the lightChanged callback.
void addLightChangedCallback(SoQtDirectionalLightEditorCB *f, void *userData=NULL)
Adds lightChanged callback.
virtual void hide()
This hides the component.
virtual void show()
This shows the component.
const SoDirectionalLight & getLight() const
Gets the current light values.
SbBool isAttached()
Returns TRUE if the editor is attached.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Component for re...
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
Group node that saves and restores traversal state.
int SbBool
Boolean type.
Definition SbBase.h:87