Ocular Engine
OcularEditor.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_EDITOR__H__
19 #define __H__OCULAR_EDITOR__H__
20 
21 #include "Widgets/MainWindow.hpp"
22 #include "Scene/ComponentFactory.hpp"
23 
24 #include "Widgets/Properties/PropertyWidget.hpp"
25 #include "Widgets/Properties/PropertiesDisplayBox.hpp"
26 #include "Widgets/Properties/Renderables/RenderableDisplay.hpp"
27 
28 //------------------------------------------------------------------------------------------
29 
34 namespace Ocular
35 {
40  namespace Editor
41  {
42  class AxisGizmo;
43 
48  {
49  public:
50 
51  static Editor& get();
52  ~Editor();
53 
54  //------------------------------------------------------------
55  // Application Lifetime Methods
56  //------------------------------------------------------------
57 
58  bool initialize(int argc, char** argv);
59  void shutdown();
60  bool run();
61 
62  //------------------------------------------------------------
63  // Primary Getters
64  //------------------------------------------------------------
65 
69  MainWindow* getMainWindow() const;
70 
75 
88  void setSelectedObject(Core::SceneObject* object, bool ignoreNormalObject = false, bool ignoreGizmoObject = false);
89 
102 
115 
116  virtual bool onEvent(std::shared_ptr<Core::AEvent> event) override;
117 
118  //------------------------------------------------------------
119  // Misc Methods
120  //------------------------------------------------------------
121 
130  void setStatusNormal(std::string const& message);
131 
141  void setStatusPermanent(std::string const& message);
142 
154  void setStatusTemporary(std::string const& message, uint32_t lifetime);
155 
163  void setStatusNormalProgress(std::string const& message, uint32_t progress);
164 
165  //------------------------------------------------------------
166  // Widget Factories
167  //------------------------------------------------------------
168 
178  PropertyWidget* createPropertyWidget(std::string const& displayName, std::string const& type);
179 
184 
193  PropertiesDisplayBox* createCustomDisplay(std::string const& type);
194 
199 
203  RenderableDisplay* createRenderableDisplay(std::string const& type);
204 
208  Core::ComponentFactory<RenderableDisplay>& getRenderableDisplayFactory();
209 
210  //------------------------------------------------------------
211  // Static Methods
212  //------------------------------------------------------------
213 
217  static bool IsCommonName(std::string const& name);
218 
222  static std::string FormatName(std::string const& name);
223 
224  protected:
225 
226  private:
227 
228  Editor();
229  Editor(Editor const&) = delete;
230  void operator=(Editor const&) = delete;
231 
232  bool setupEditorCamera();
233  void setupAxis();
234  void setupGizmos();
235 
236  //------------------------------------------------------------------------------
237 
238  QApplication* m_QtApp;
239 
240  MainWindow* m_MainWindow;
241  Core::Camera* m_EditorCamera;
242 
243  Core::SceneObject* m_SelectedObject;
244  Core::SceneObject* m_FocusedObject;
245 
246  Core::ComponentFactory<PropertyWidget> m_PropertyWidgetFactory;
247  Core::ComponentFactory<PropertiesDisplayBox> m_CustomDisplayFactory;
248  Core::ComponentFactory<RenderableDisplay> m_RenderableDisplayFactory;
249 
250  AxisGizmo* m_GizmoTranslate;
251  };
252  }
256 }
261 #define OcularEditor Ocular::Editor::Editor::get()
262 
263 //------------------------------------------------------------------------------------------
264 
265 #endif
void setStatusNormalProgress(std::string const &message, uint32_t progress)
Definition: OcularEditor.cpp:305
Parent class for all general property widgets.
Definition: PropertyWidget.hpp:51
MainWindow * getMainWindow() const
Definition: OcularEditor.cpp:195
PropertyWidget * createPropertyWidget(std::string const &displayName, std::string const &type)
Definition: OcularEditor.cpp:314
Definition: ComponentFactory.hpp:43
Definition: AEventListener.hpp:43
Core::ComponentFactory< PropertyWidget > & getPropertyWidgetFactory()
Definition: OcularEditor.cpp:326
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
PropertiesDisplayBox * createCustomDisplay(std::string const &type)
Definition: OcularEditor.cpp:331
Definition: OcularEditor.hpp:47
Definition: SceneObject.hpp:93
void setStatusNormal(std::string const &message)
Definition: OcularEditor.cpp:275
void setSelectedObject(Core::SceneObject *object, bool ignoreNormalObject=false, bool ignoreGizmoObject=false)
Definition: OcularEditor.cpp:205
void setStatusTemporary(std::string const &message, uint32_t lifetime)
Definition: OcularEditor.cpp:295
Definition: AxisGizmo.hpp:49
Core::ComponentFactory< PropertiesDisplayBox > & getCustomDisplayFactory()
Definition: OcularEditor.cpp:343
Definition: PropertiesDisplayBox.hpp:46
Core::Camera * getEditorCamera() const
Definition: OcularEditor.cpp:200
void setStatusPermanent(std::string const &message)
Definition: OcularEditor.cpp:285
Definition: Camera.hpp:79
Core::SceneObject * getSelectedObject() const
Definition: OcularEditor.cpp:261
Main window for the Ocular Editor application.
Definition: MainWindow.hpp:46
Definition: RenderableDisplay.hpp:40
static bool IsCommonName(std::string const &name)
Definition: OcularEditor.cpp:369
Core::SceneObject * getFocusedObject() const
Definition: OcularEditor.cpp:266