TDME2  1.9.200
SceneEditorTabController.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <string>
5 
6 #include <tdme/tdme.h>
21 
22 using std::string;
23 using std::unique_ptr;
24 
43 
44 /**
45  * Scene editor tab controller
46  * @author Andreas Drewke
47  */
49  : public TabController
50 {
51 
52 private:
53  unique_ptr<BasePropertiesSubController> basePropertiesSubController;
54  SceneEditorTabView* view { nullptr };
55  GUIScreenNode* screenNode { nullptr };
56  PopUps* popUps { nullptr };
57 
58  array<string, 2> applyBaseNodes = {
59  "base_name",
60  "base_description",
61  };
62  array<string, 3> applyTranslationNodes = {
63  "transform_translation_x",
64  "transform_translation_y",
65  "transform_translation_z"
66  };
67  array<string, 3> applyRotationNodes = {
68  "transform_rotation_x",
69  "transform_rotation_y",
70  "transform_rotation_z"
71  };
72  array<string, 3> applyScaleNodes = {
73  "transform_scale_x",
74  "transform_scale_y",
75  "transform_scale_z"
76  };
78  "reflection_environmentmap"
79  };
80  array<string, 30> applyLightNodes = {
81  "light_type",
82  "light_ambient_ambient",
83  "light_ambient_diffuse",
84  "light_ambient_specular",
85  "light_ambient_constant_attenuation",
86  "light_ambient_linear_attenuation",
87  "light_ambient_quadratic_attenuation",
88  "light_spot_ambient",
89  "light_spot_diffuse",
90  "light_spot_specular",
91  "light_spot_constant_attenuation",
92  "light_spot_linear_attenuation",
93  "light_spot_quadratic_attenuation",
94  "light_spot_position_x",
95  "light_spot_position_y",
96  "light_spot_position_z",
97  "light_spot_direction_x",
98  "light_spot_direction_y",
99  "light_spot_direction_z",
100  "light_spot_cutoff",
101  "light_spot_exponent",
102  "light_directional_ambient",
103  "light_directional_diffuse",
104  "light_directional_specular",
105  "light_directional_constant_attenuation",
106  "light_directional_linear_attenuation",
107  "light_directional_quadratic_attenuation",
108  "light_directional_direction_x",
109  "light_directional_direction_y",
110  "light_directional_direction_z"
111  };
112 
114 
115 public:
116  // forbid class copy
118 
119  /**
120  * Public constructor
121  * @param view view
122  */
124 
125  /**
126  * Destructor
127  */
128  virtual ~SceneEditorTabController();
129 
130  /**
131  * Get view
132  */
134  return view;
135  }
136 
137  // overridden method
138  inline GUIScreenNode* getScreenNode() override {
139  return screenNode;
140  }
141 
142  // overridden methods
143  void initialize(GUIScreenNode* screenNode) override;
144  void dispose() override;
145  void onChange(GUIElementNode* node) override;
146  void onAction(GUIActionListenerType type, GUIElementNode* node) override;
147  void onFocus(GUIElementNode* node) override;
148  void onUnfocus(GUIElementNode* node) override;
149  void onContextMenuRequest(GUIElementNode* node, int mouseX, int mouseY) override;
150  void onTooltipShowRequest(GUINode* node, int mouseX, int mouseY) override;
151  void onTooltipCloseRequest() override;
152  void onCommand(TabControllerCommand command) override;
153  void onDrop(const string& payload, int mouseX, int mouseY) override;
154 
155  /**
156  * Set run button mode
157  * @param running running
158  */
159  void setRunButtonMode(bool running);
160 
161  /**
162  * Set sky shader details
163  */
164  void setSkyShaderDetails();
165 
166  /**
167  * Set post processing details
168  */
170 
171  /**
172  * Apply sky shader details
173  * @param parameterName parameter name
174  */
175  void applySkyShaderDetails(const string& parameterName);
176 
177  /**
178  * Apply post processing shader details
179  * @param shaderId shader id
180  * @param parameterName parameter name
181  */
182  void applyPostProcessingDetails(const string& shaderId, const string& parameterName);
183 
184  /**
185  * Set GUI details
186  */
187  void setGUIDetails();
188 
189  /**
190  * Set GUI file name
191  * @param fileName file name
192  */
193  void setGUIFileName(const string& fileName);
194 
195  /**
196  * Unset GUI file name
197  */
198  void unsetGUIFileName();
199 
200  /**
201  * Set light details
202  * @param lightIdx light index
203  */
204  void setLightDetails(int lightIdx);
205 
206  /**
207  * Update light details
208  * @param lightIdx light index
209  */
210  void updateLightDetails(int lightIdx);
211 
212  /**
213  * Apply light
214  * @param lightIdx light index
215  */
216  void applyLightDetails(int lightIdx);
217 
218  /**
219  * Set prototype details
220  */
221  void setPrototypeDetails();
222 
223  /**
224  * Update reflection details drop down
225  * @param selectedReflectionEnvironmentMappingId selected reflection environment mapping id
226  * @param mixed mixed
227  */
228  void updateReflectionEnvironmentMappingDetailsDropDown(const string& selectedReflectionEnvironmentMappingId);
229 
230  /**
231  * Set entity details
232  * @param entity id
233  */
234  void setEntityDetails(const string& entityId);
235 
236  /**
237  * Set entity details for multiple entity selection
238  * @param pivot pivot
239  * @param selectedReflectionEnvironmentMappingId selected reflection environment mapping id
240  */
241  void setEntityDetailsMultiple(const Vector3& pivot, const string& selectedReflectionEnvironmentMappingId);
242 
243  /**
244  * Update entity details
245  * @param transform transform
246  */
247  void updateEntityDetails(const Transform& transform);
248 
249  /**
250  * Update entity details
251  * @param translation translation
252  * @param rotation rotation
253  * @param scale scale
254  */
255  void updateEntityDetails(const Vector3& translation, const Vector3& rotation, const Vector3& scale);
256 
257  /**
258  * Get prototype icon
259  * @param prototypeType prototype type
260  */
261  inline const string getPrototypeIcon(Prototype_Type* prototypeType) {
262  if (prototypeType == Prototype_Type::EMPTY) return "empty.png"; else
263  if (prototypeType == Prototype_Type::ENVIRONMENTMAPPING) return "reflection.png"; else
264  if (prototypeType == Prototype_Type::MODEL) return "mesh.png"; else
265  if (prototypeType == Prototype_Type::PARTICLESYSTEM) return "particle.png"; else
266  if (prototypeType == Prototype_Type::TERRAIN) return "terrain.png"; else
267  if (prototypeType == Prototype_Type::TRIGGER) return "trigger.png"; else return "";
268  }
269 
270  /**
271  * Set outliner content
272  */
273  void setOutlinerContent();
274 
275  /**
276  * Set outliner add drop down content
277  */
279 
280  /**
281  * Set details content
282  */
283  void setDetailsContent();
284 
285  /**
286  * Update details panel
287  * @param outlinerNode outliner node
288  */
289  void updateDetails(const string& outlinerNode);
290 
291  /**
292  * Unselect entities
293  */
294  void unselectEntities();
295 
296  /**
297  * Unselect entity
298  * @param entityId entity id
299  */
300  void unselectEntity(const string& entityId);
301 
302  /**
303  * Select entity
304  * @param entityId entity id
305  */
306  void selectEntity(const string& entityId);
307 
308  /**
309  * Select exactly given entities
310  * @param selectedOutlinerEntityIds selected entity outliner ids
311  */
312  void selectEntities(const vector<string>& selectedOutlinerEntityIds);
313 
314  /**
315  * On replace prototype
316  */
317  void onReplacePrototype();
318 
319  /**
320  * Rename entity
321  * @param entityName entity name
322  */
323  void startRenameEntity(const string& entityName);
324 
325  /**
326  * Rename entity
327  */
328  void renameEntity();
329 
330  /**
331  * Save
332  * @param pathName path name
333  * @param fileName file name
334  */
335  void save(const string& pathName, const string& fileName);
336 
337  /**
338  * Update info text line
339  * @param text text
340  */
341  void updateInfoText(const MutableString& text);
342 
343  /**
344  * Show the information pop up / modal
345  * @param caption caption
346  * @param message message
347  */
348  void showInfoPopUp(const string& caption, const string& message);
349 
350 };
Transform which contain scale, rotations and translation.
Definition: Transform.h:29
GUI node base class.
Definition: GUINode.h:64
GUI parent node base class thats supporting child nodes.
Definition: GUIParentNode.h:42
GUI screen node that represents a screen that can be rendered via GUI system.
Definition: GUIScreenNode.h:72
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Definition: Vector3.h:20
Pop ups controller accessor class.
Definition: PopUps.h:29
void onContextMenuRequest(GUIElementNode *node, int mouseX, int mouseY) override
On context menu request.
void onDrop(const string &payload, int mouseX, int mouseY) override
On drop.
void updateInfoText(const MutableString &text)
Update info text line.
void save(const string &pathName, const string &fileName)
Save.
void onCommand(TabControllerCommand command) override
On command.
void updateEntityDetails(const Transform &transform)
Update entity details.
void selectEntities(const vector< string > &selectedOutlinerEntityIds)
Select exactly given entities.
void updateDetails(const string &outlinerNode)
Update details panel.
void applyPostProcessingDetails(const string &shaderId, const string &parameterName)
Apply post processing shader details.
void applySkyShaderDetails(const string &parameterName)
Apply sky shader details.
void setEntityDetailsMultiple(const Vector3 &pivot, const string &selectedReflectionEnvironmentMappingId)
Set entity details for multiple entity selection.
const string getPrototypeIcon(Prototype_Type *prototypeType)
Get prototype icon.
SceneEditorTabController(SceneEditorTabView *view)
Public constructor.
void showInfoPopUp(const string &caption, const string &message)
Show the information pop up / modal.
void onAction(GUIActionListenerType type, GUIElementNode *node) override
void updateReflectionEnvironmentMappingDetailsDropDown(const string &selectedReflectionEnvironmentMappingId)
Update reflection details drop down.
unique_ptr< BasePropertiesSubController > basePropertiesSubController
void onTooltipShowRequest(GUINode *node, int mouseX, int mouseY) override
On tooltip show request.
void setEntityDetails(const string &entityId)
Set entity details.
Mutable utf8 aware string class.
Definition: MutableString.h:23
GUI action listener interface.
GUI change listener interface.
GUI focus listener interface.
Tab controller, which connects UI with logic.
Definition: TabController.h:34
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6