Editor API
UnigineEditor public API
ViewportManager.h
1 // Copyright (C), UNIGINE. All rights reserved.
2 #pragma once
3 
4 #include <editor/EditorGlobal.h>
5 
6 #include <UniginePlayers.h>
7 #include <UnigineGui.h>
8 #include <UnigineViewport.h>
9 #include <UnigineVector.h>
10 #include <UnigineNode.h>
11 #include <UnigineObjects.h>
12 
13 
14 namespace Editor
15 {
16 
17 struct ViewportWindow;
18 using ViewportWindowId = ViewportWindow *;
20 // ViewportManager.
25 class EDITOR_API ViewportManager final
26 {
27 public:
31  static ViewportWindowId createViewportWindow(const char *name = nullptr);
35  static bool removeViewportWindow(ViewportWindowId viewport_id);
39  static bool showViewportWindow(ViewportWindowId viewport_id);
43  static bool hideViewportWindow(ViewportWindowId viewport_id);
44 
46  static int getNumViewportWindows();
49  static ViewportWindowId getViewportWindowId(int index);
50 
52  static ViewportWindowId getLastHoveredViewportWindow();
54  static ViewportWindowId getActiveViewportWindow();
55 
58  static const char *getViewportWindowName(ViewportWindowId viewport_id);
61  static ViewportWindowId getViewportWindowId(const char *name);
62 
65  static Unigine::PlayerPtr getViewportWindowPlayer(ViewportWindowId viewport_id);
69  static void setViewportWindowPlayer(ViewportWindowId viewport_id, const Unigine::PlayerPtr &player);
70 
73  static Unigine::ViewportPtr getViewportWindowViewport(ViewportWindowId viewport_id);
76  static Unigine::GuiPtr getViewportWindowGui(ViewportWindowId viewport_id);
77 
80  static int getViewportWindowMouseX(ViewportWindowId viewport_id);
83  static int getViewportWindowMouseY(ViewportWindowId viewport_id);
86  static Unigine::Math::ivec2 getViewportWindowMousePos(ViewportWindowId viewport_id);
87 
90  static int getViewportWindowWidth(ViewportWindowId viewport_id);
93  static int getViewportWindowHeight(ViewportWindowId viewport_id);
96  static Unigine::Math::ivec2 getViewportWindowSize(ViewportWindowId viewport_id);
97 
100  static void setEnabledRectangleSelection(bool enable);
103  static bool isEnabledRectangleSelection();
104 
108  static void focusOnNode(ViewportWindowId viewport_id, const Unigine::NodePtr &node);
112  static void focusOnNodeList(ViewportWindowId viewport_id,
113  const Unigine::Vector<Unigine::NodePtr> &nodes);
118  static void focusOnSurface(ViewportWindowId viewport_id, const Unigine::ObjectPtr &object,
119  int surface);
124  static void focusOnSurfaceList(ViewportWindowId viewport_id, const Unigine::ObjectPtr &object,
125  const Unigine::Vector<int> &surfaces);
130  static void focusOnCenter(ViewportWindowId viewport_id, const Unigine::Math::Vec3 &center,
131  float radius);
132 
134  static void forceWireframeWarming();
135 
138  static void placeNode(const Unigine::NodePtr &node);
141  static void placeNodeList(const Unigine::Vector<Unigine::NodePtr> &nodes);
142 };
143 
144 } // namespace Editor
Definition: Actions.h:11
ViewportWindow * ViewportWindowId
Definition: ViewportManager.h:18
Viewport manager class. This class is used to create, manage, and remove all viewports in the Editor.
Definition: ViewportManager.h:25