Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoQtDirectionalLightEditor.h
Go to the documentation of this file.
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-2014 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_
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
47typedef void SoQtDirectionalLightEditorCB(void *userData, const SoDirectionalLight *light);
48
49
51// Class: SoQtDirectionalLightEditor
52
81
82 Q_OBJECT
83
84 public:
88 SoQtDirectionalLightEditor( QWidget* parent = qApp->activeWindow(),
89 const char *name = NULL,
90 SbBool buildInsideParent = TRUE);
95
100 void attach(SoPath *pathToLight);
104 void detach();
108 SbBool isAttached() { return (dirLight != NULL); }
109
113 void setLight(const SoDirectionalLight &newLight);
117 const SoDirectionalLight &getLight() const { return *dirLight; }
118
125 void *userData = NULL)
126 { callbackList->addCallback((SoCallbackListCB *) f, userData); }
131 void *userData = NULL)
132 { callbackList->removeCallback((SoCallbackListCB *) f, userData); }
133
134 // Redefined here since there are two windows to deal with -
135 // the color editor and the light manipulator
136 virtual void show();
137 virtual void hide();
138
139 private:
140 QWidget* mgrWidget; // topmost widget
141
142 // This constructor takes a boolean whether to build the widget now.
143 // Subclasses can pass FALSE, then call SoQtDirectionalLightEditor::buildWidget()
144 // when they are ready for it to be built.
146 SoQtDirectionalLightEditor( QWidget* parent,
147 const char *name,
148 SbBool buildInsideParent,
149 SbBool buildNow);
150
151 // redefine these
152 virtual SbString getDefaultWidgetName() const;
153 virtual SbString getDefaultTitle() const;
154 virtual SbString getDefaultIconTitle() const;
155
156 // Open Inventor parts
157 SoDirectionalLight* dirLight; // light we are editing
158 SoSeparator* root; // root of local scene graph
159 SoSeparator* litStuff; // what's on display under the light
160 SoPerspectiveCamera* myCamera;
161 SoCamera* cameraToWatch;
162 SoNodeSensor* lightSensor;
163 SoNodeSensor* cameraSensor;
164 SoDirectionalLightManip* dirLightManip;
165 static char* geomBuffer;
166
167 // UI parts
168 SoQtColorEditor *colorEditor;
169 SoQtColorSlider* intensitySlider;
170 SoQtRenderArea* renderArea;
171 // SoQtClipboard *clipboard;
172
173 // Calbacks
174 SbBool ignoreCallback; // TRUE while callback should be ignored
175 SoCallbackList* callbackList;
176
177 // Copy and updates
178 void copyLight(SoDirectionalLight *dst, const SoDirectionalLight *src);
179 void updateLocalComponents();
180
181 private:
182
183 // Build routines
184 void constructorCommon(SbBool buildNow);
185 QWidget* buildWidget(QWidget* parent);
186 void activate(); // connects the sensor
187 void deactivate(); // disconnects the sensor
188
189 // Callbacks
190 static void colorEditorCloseCB(void *userData, SoQtComponent *comp) ;
191 static void colorEditorCB(void *, const SbColor *);
192 static void dirLightManipCB(void *, SoDragger *);
193 static void intensitySliderCB(void*, float);
194 static void cameraSensorCB(SoQtDirectionalLightEditor *, SoSensor *);
195 static void lightSensorCB(SoQtDirectionalLightEditor *, SoSensor *);
196 static void dialogCloseCB(void*, SoQtComponent*);
197
198 //qt variables
199 QMenu* edit_menu;
200 QAction* IDM_LEDT_COLOR_EDITOR;
201
202 private Q_SLOTS:
203 void visibilityChangeCB(SbBool visible);
204 void launchColorEditor();
205 void copy();
206 void paste();
207 void showHelp();
208 void keepOnTop();
209 void slot_help();
210};
211
212#endif // _SO_QT_DIRECTIONAL_LIGHT_EDITOR_
213
#define SoEXTENDER
#define TRUE
Possible value of SbBool.
Definition SbBase.h:77
SoQtColorSlider(QWidget *parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE, Type type=INTENSITY_SLIDER)
void SoQtDirectionalLightEditorCB(void *userData, const SoDirectionalLight *light)
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:534
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 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:97
Group node that saves and restores traversal state.
int SbBool
Boolean type.
Definition SbBase.h:87
void SoCallbackListCB(void *userData, void *callbackData)