Polyphase Game Engine
Loading...
Searching...
No Matches
EditorState.h
Go to the documentation of this file.
1#pragma once
2
3#if EDITOR
4
5#include <array>
6#include <string>
7#include <set>
8#include <unordered_map>
9#include <vector>
10#include "Maths.h"
11#include "AssetRef.h"
12#include "SmartPointer.h"
13#include "Property.h"
14#include "Enums.h"
15#include "EditorTypes.h"
16#include "Nodes/Widgets/Text.h"
17#include "imgui.h"
18#include "./ImGuizmo/ImGuizmo.h"
19
20class Node;
21class Scene;
22class Timeline;
24class Widget;
25class Text;
26class Asset;
27struct AssetStub;
28class AssetDir;
29class ActionList;
30class Canvas;
31class Camera3D;
32class Viewport3D;
33class Viewport2D;
34class PaintManager;
35class VoxelSculptManager;
36class TilePaintManager;
37struct SubSceneOverride;
38
39enum class ControlMode
40{
41 Default,
42 Pilot,
44 Rotate,
45 Scale,
46 Pan,
47 Orbit
48};
49
50enum class TransformLock
51{
52 None,
53 AxisX,
54 AxisY,
55 AxisZ,
56 PlaneYZ,
57 PlaneXZ,
58 PlaneXY,
59 Count
60};
61
62enum class EditorMode
63{
64 Scene,
65 Scene2D,
66 Scene3D,
67
68 Count
69};
70
71enum class PaintMode
72{
73 None,
74 Color,
75 Instance,
76 Voxel,
77 Terrain,
78 TilePaint,
79
80 Count
81};
82
83enum class AssetBrowserTab
84{
85 Project = 0,
86 Addons = 1,
87 Count
88};
89
90struct LinkedSceneProps
91{
92 Node* mNode = nullptr;
93 std::vector<Property> mProps;
94 std::vector<SubSceneOverride> mSubSceneOverrides;
95};
96
97struct EditScene
98{
99 SceneRef mSceneAsset;
100 NodePtr mRootNode;
101 glm::mat4 mCameraTransform;
102 std::vector<LinkedSceneProps> mLinkedSceneProps;
103};
104
105struct RecentScene
106{
107 std::string mSceneName;
108 uint64_t mTimestamp = 0;
109};
110
111// Editor 3D viewport camera bookmark. One of 10 per-scene slots driven by the
112// `View_SaveBookmark*` / `View_GotoBookmark*` editor actions. Persisted in
113// EditorProject.sav, keyed by scene name.
114constexpr int32_t kEditorCameraBookmarkSlotCount = 10;
115
116struct EditorCameraBookmark
117{
118 bool mValid = false;
119 glm::vec3 mPosition = { 0.0f, 0.0f, 0.0f };
120 glm::quat mRotation = { 1.0f, 0.0f, 0.0f, 0.0f };
122 float mPerspectiveNearZ = 0.25f;
123 float mPerspectiveFarZ = 4096.0f;
124 float mPerspectiveFov = 70.0f;
125 float mOrthoNearZ = -2048.0f;
126 float mOrthoFarZ = 2048.0f;
127 float mOrthoWidth = 12.8f;
128 float mFocalDistance = 10.0f;
129};
130
131using EditorCameraBookmarkArray = std::array<EditorCameraBookmark, kEditorCameraBookmarkSlotCount>;
132
133// Per-asset state captured at BeginPlayInEditor and re-applied at
134// EndPlayInEditor so script mutations during play don't leak into the editor.
135struct PieAssetSnapshot
136{
137 std::vector<uint8_t> mBytes;
138 bool mWasDirty = false;
139};
140
141struct EditorState
142{
143 // Data
144 EditorMode mMode;
145 std::vector<Node*> mSelectedNodes;
146 Node* mShiftSelectAnchor = nullptr;
147 int32_t mSelectedInstance = -1;
148 std::vector<EditScene> mEditScenes;
149 AssetStub* mSelectedAssetStub = nullptr;
150 std::vector<AssetStub*> mSelectedAssetStubs;
151 ControlMode mControlMode = ControlMode::Default;
152 TransformLock mTransformLock = TransformLock::None;
153 SharedPtr<Camera3D> mEditorCamera;
154 float mPerspectiveNearZ = 0.25f;
155 float mPerspectiveFarZ = 4096.0f;
156 float mPerspectiveFov = 70.0f;
157 float mOrthoNearZ = -2048.0f;
158 float mOrthoFarZ = 2048.0f;
159 float mOrthoWidth = 12.8f;
160 bool mMouseNeedsRecenter = false;
161 bool mUiEnabled = true;
162 // Editor frame-rate cap in frames per second, 0 = uncapped. Applied at
163 // the end of Engine::Update outside Play In Editor so an idle editor does
164 // not spin at the display's refresh rate. Set from Preferences > General.
165 int32_t mEditorFrameRateCap = 60;
166 bool mPlayInEditor = false;
167 bool mPlayInGameWindow = false;
168 bool mEjected = false;
169 bool mPaused = false;
170 bool mHasEjectedOnce = false;
171 bool mSavedGridEnabled = false;
172
173 // One-frame latch consumed by Viewport3D's left-click selection path.
174 // Set true to make the next left-click release inside the viewport NOT
175 // change the selection. Plugin tools that handle their own clicks
176 // (Level Builder placement etc.) set this every frame they're armed
177 // via EditorUIHooks::Viewport_SuppressNextSelectionClick. Read-and-
178 // cleared in Viewport3D::HandleDefaultControls, so a stale flag never
179 // survives a real click.
180 bool mSuppressNextSelectionClick = false;
181 glm::vec4 mSavedEditorClearColor = glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
182 int32_t mSavedWindowRect[4] = {}; // x, y, w, h — saved before Play Full Screen resize
183 bool mSavedWindowMaximized = false; // saved before Play Full Screen resize
184 bool mSavedFullscreenForPie = false; // true if BeginPlayInEditor put us in fullscreen
185 int32_t mEditSceneIndex = -1;
186 int32_t mPieEditSceneIdx = -1;
187 std::unordered_map<Asset*, PieAssetSnapshot> mPieAssetSnapshots;
188 // Lazy cache of instantiated default trees for sub-scene source assets,
189 // used by the inspector to detect overridden properties and revert them.
190 // Keyed by source Scene*. Invalidated when an EditScene closes, on
191 // editor shutdown, and whenever a source Scene is reimported/saved.
192 std::unordered_map<Scene*, NodePtr> mInspectorDefaultCache;
193 // Deferred dispatch for long-running editor operations: the click/hotkey
194 // handler sets the appropriate *AtEndOfFrame flag, and EditorMain.cpp
195 // picks them up *after* EditorImguiDraw has returned and runs the work
196 // synchronously. The EditorProgress modal pumps additional ImGui frames
197 // during the work so the user sees animated progress instead of a freeze.
198 bool mBeginPieAtEndOfFrame = false;
199 bool mEndPieAtEndOfFrame = false;
200 bool mSaveSceneAtEndOfFrame = false;
201 bool mSaveSelectedAssetAtEndOfFrame = false;
202 bool mResaveAllAtEndOfFrame = false;
203 bool mBakeOcclusionAtEndOfFrame = false;
204 bool mClearOcclusionAtEndOfFrame = false;
205 // Set by World::ResolveOccludees when a baked occluder no longer matches;
206 // drawn as a toast with a Re-bake button by EditorImgui.
207 bool mOcclusionStaleNotice = false;
208 bool mReloadScriptsAtEndOfFrame = false;
209 bool mOpenProjectAtEndOfFrame = false;
210 std::string mPendingOpenProjectPath;
211 // Deferred "close current project" — used by File > Close Project and as
212 // a precondition for Tier-2 recovery. Drained by EditorMain's per-frame
213 // dispatcher alongside the open/save deferreds.
214 bool mCloseProjectAtEndOfFrame = false;
215 // Deferred Tier-2 recovery: drop addon DLLs, kill mspdbsrv, wipe
216 // Intermediate/Plugins, reopen project. mPendingAddonRecoveryReason is
217 // surfaced in logs.
218 bool mAddonRecoveryAtEndOfFrame = false;
219 std::string mPendingAddonRecoveryReason;
220 // Deferred Tier-3 recovery: spawn a fresh editor with --addon-recovery
221 // and quit the current one. The new instance does the wipe + reopen.
222 bool mEditorRestartAtEndOfFrame = false;
223 std::string mPendingEditorRestartReason;
224 // Deferred addon install. The Addons window Download/Install buttons and
225 // the native addon problem modal only queue ids here; the dispatcher runs
226 // AddonsWindow::ProcessPendingInstalls outside the ImGui frame so the
227 // synchronous curl download can sit under an EditorProgress modal, and
228 // any native package that arrived is then rebuilt through the
229 // project-restart reload.
230 bool mInstallAddonsAtEndOfFrame = false;
231 std::vector<std::string> mPendingAddonInstalls;
232 // Deferred addon removal (ids queued dependents-first by the Addons
233 // window's Remove modal). AddonsWindow::ProcessPendingUninstalls runs
234 // outside the ImGui frame; loaded native addons route through the
235 // project-restart machine so their DLLs unload with no scenes open.
236 bool mUninstallAddonsAtEndOfFrame = false;
237 std::vector<std::string> mPendingAddonUninstalls;
238 // Deferred "Check for Updates": synchronous GitHub API calls sit under
239 // an EditorProgress modal via AddonsWindow::ProcessPendingUpdateCheck.
240 bool mCheckAddonUpdatesAtEndOfFrame = false;
241 // Deferred OpenScene. Either a stub (preferred -- path is captured at
242 // request time so a later directory rename doesn't break it) or empty
243 // to trigger the OS file dialog inside the worker. Scene* is held as
244 // a raw pointer; the asset map owns the lifetime and the dispatcher
245 // runs same-tick so dangling is not realistic.
246 bool mOpenSceneAtEndOfFrame = false;
247 AssetStub* mPendingOpenSceneStub = nullptr;
248
249 // Generic progress modal state, consumed by DrawProgressModal and driven
250 // by the EditorProgress::* API. Negative fraction = indeterminate sine
251 // marquee; non-negative = determinate 0..1 fill.
252 bool mProgressActive = false;
253 // True only while EditorProgress is rendering one of its pumped frames.
254 // Everything drawn during that frame is running nested inside whatever
255 // long operation asked for the pump, so handlers that must not reenter
256 // that work check this. See IsInsideProgressPump() in EditorState.cpp.
257 bool mProgressPumping = false;
258 bool mProgressCancellable = false;
259 bool mProgressCancelRequested = false;
260 std::string mProgressTitle;
261 std::string mProgressStatus;
262 float mProgressFraction = -1.0f;
263 double mProgressLastPumpTime = 0.0;
264 AssetBrowserTab mActiveAssetTab = AssetBrowserTab::Project;
265 AssetDir* mTabCurrentDir[(int)AssetBrowserTab::Count] = {};
266 std::vector<AssetDir*> mTabDirPast[(int)AssetBrowserTab::Count];
267 std::vector<AssetDir*> mTabDirFuture[(int)AssetBrowserTab::Count];
268 std::string mTabFilterStr[(int)AssetBrowserTab::Count];
269 std::vector<AssetStub*> mTabFilteredStubs[(int)AssetBrowserTab::Count];
270 std::vector<Object*> mInspectPast;
271 std::vector<Object*> mInspectFuture;
272 Object* mInspectedObject;
273 Object* mPrevInspectedObject;
274 AssetRef mInspectedAsset;
275 bool mInspectLocked = false;
276 Viewport3D* mViewport3D = nullptr;
277 Viewport2D* mViewport2D = nullptr;
278 std::string mIOAssetPath;
279 bool mRequestSaveSceneAs = false;
280 bool mTrackSelectedAsset = false;
281 bool mTrackSelectedNode = false;
282 // Pending Scripts-panel reveal request. Exactly one of these is set at a
283 // time; the panel consumes and clears both on the next frame it draws.
284 std::string mRevealScriptName = "";
285 std::string mRevealScriptPath = "";
286 std::set<AssetDir*> mRevealAssetExpandDirs;
287 uint32_t mViewportX = 0;
288 uint32_t mViewportY = 0;
289 uint32_t mViewportWidth = 100;
290 uint32_t mViewportHeight = 100;
291 glm::uvec4 mPrevViewport = {};
292 bool mShowLeftPane = true;
293 bool mShowRightPane = true;
294 bool mShowInterface = true;
295 bool mPreviewLighting = true;
296 SharedPtr<Text> mOverlayText = nullptr;
297 std::vector<std::string> mFavoritedDirs;
298 std::vector<std::string> mRecentProjects;
299 std::vector<RecentScene> mRecentScenes;
300
301 // Per-scene camera bookmark slots, keyed by Scene asset name. Saved
302 // and restored from EditorProject.sav (kEditorProjectSaveVersion >= 4).
303 // Unsaved / untitled scenes use the empty-string key — those bookmarks
304 // work within the session but never persist.
305 std::unordered_map<std::string, EditorCameraBookmarkArray> mCameraBookmarks;
306 PaintMode mPaintMode = PaintMode::None;
307 PaintManager* mPaintManager = nullptr;
308 VoxelSculptManager* mVoxelSculptManager = nullptr;
309 class TerrainSculptManager* mTerrainSculptManager = nullptr;
310 TilePaintManager* mTilePaintManager = nullptr;
311
312 // ID of the currently-active addon viewport mode (Batch 15), empty when
313 // no addon mode is active. Activation is mutually exclusive with the
314 // built-in PaintMode: selecting an addon mode forces mMode=Scene3D and
315 // mPaintMode=None; selecting any built-in entry clears this string.
316 // Cross-reference: EditorUIHookManager owns the mode registrations
317 // (RegisteredViewportMode) — this struct only holds the active id and
318 // fires activate/deactivate callbacks via the manager on transition.
319 std::string mActiveAddonViewportModeId;
320
321 // Tile-paint mode stashes the editor camera's previous projection AND
322 // transform so it can switch to a top-down orthographic view of the
323 // currently-selected TileMap2D and restore the original camera on exit.
324 bool mTilePaintProjectionStashed = false;
325 bool mTilePaintPrevWasPerspective = true;
326 bool mTilePaintTransformStashed = false;
327 glm::vec3 mTilePaintPrevCameraPosition = { 0.0f, 0.0f, 0.0f };
328 glm::quat mTilePaintPrevCameraRotation = { 1.0f, 0.0f, 0.0f, 0.0f };
329 bool mNodePropertySelect = false;
330 int32_t mNodePropertySelectIndex = 0;
331 std::string mNodePropertySelectName = "";
332 std::string mPendingSceneImportPath = "";
333 std::vector<std::string> mPendingMeshImportPaths;
334 // Non-mesh asset imports are queued here from ImGui-context callers
335 // (menu, asset browser, OS drag-drop) and drained at end-of-frame by
336 // ActionManager::ImportPendingAssets under an EditorProgress modal, so
337 // multi-file WAV/PNG imports show progress instead of freezing.
338 bool mImportAssetsAtEndOfFrame = false;
339 std::vector<std::string> mPendingAssetImportPaths;
340 std::vector<std::string> mPendingSceneImportQueue;
341
342 // AssetDir row the mouse is over in the asset browser this frame. Reset
343 // at the top of EditorImguiDraw, set whenever a dir TreeNodeEx / Selectable
344 // reports IsItemHovered. Used by the OS file-drop modal so dropping onto
345 // a specific folder lands the files there instead of the active folder.
346 AssetDir* mMouseHoveredAssetDir = nullptr;
347
348 // Import-time name-clash queue. Filled by ActionManager::ImportAsset when
349 // the source file's basename collides with an existing asset of a different
350 // type (e.g. importing `tent.glb` as StaticMesh while `tent.oct` is already
351 // a Texture). Drained by the "Asset Name Clash" modal in EditorImgui, which
352 // lets the user rename or cancel before any pointers get rebound.
353 struct PendingImportClash
354 {
355 std::string mSourcePath; // file the user dropped / picked
356 std::string mOriginalBaseName; // basename derived from the source file (what would have been used)
357 std::string mProposedName; // user-editable; pre-filled with first free `name_N`
358 std::string mExistingTypeName;
359 std::string mImportTypeName;
360 bool mCombined = false; // true if it came in via ImportAssetCombined
361 MeshImportOptions mMeshOpts; // forwarded from the "Import Mesh Asset" modal so the re-driven import keeps Place-in-subdir / Import Materials / Shading Model / etc.
362 bool mHasMeshOpts = false; // true when mMeshOpts was populated from a mesh-import flow
363 };
364 std::vector<PendingImportClash> mPendingImportClashes;
365 AssetStub* mPendingReimportSceneStub = nullptr;
366 std::string mPendingReimportScenePath = "";
367 bool mShutdownUnsavedCheck = false;
368 bool mDevMode = false;
369 bool mShowBottomPane = true;
370 float mBottomPaneHeight = 180.0f;
371 bool mShowProjectUpgradeModal = false;
372 bool mProjectUpgradeInProgress = false;
373 std::vector<AssetStub*> mAssetsNeedingUpgrade;
374
375 // 3DS Preview Panel state
376 bool mShow3DSPreview = false;
377 int32_t mSceneScreenFilter = -1; // -1 = All Screens, 0 = Top Screen, 1 = Bottom Screen
378
379 // Game Preview Panel state
380 bool mShowGamePreview = false;
381 bool mGamePreviewCaptured = false;
382
383 // Play target (shared between viewport toolbar and Game Preview)
384 int32_t mPlayTarget = 0; // 0=PlayInEditor, 1=PlayFullScreen, 2=Dolphin, 3=Azahar, 4=Standalone, 5=Send3dsLink
385
386 // Node Graph Panel state
387 bool mShowNodeGraphPanel = false;
388
389 // Timeline Panel state
390 bool mShowTimelinePanel = false;
391
392 // Profiling Panel state
393 bool mShowProfilingPanel = false;
394
395 // Input Tester Panel state
396 bool mShowInputTesterPanel = false;
397
398 // Texture Atlas Viewer state
399 bool mShowTextureAtlasViewer = false;
400
401 // Git Panel state
402 bool mShowGitPanel = false;
403
404 // Animation Browser Panel state
405 bool mShowAnimationBrowser = false;
406 // Bone Mask Editor Panel state
407 bool mShowBoneMaskEditor = false;
408 TimelineRef mEditedTimelineRef;
409 TimelineInstance* mTimelinePreviewInstance = nullptr;
410 float mTimelinePlayheadTime = 0.0f;
411 bool mTimelinePreviewing = false;
412 float mTimelineZoom = 100.0f;
413 float mTimelineScrollX = 0.0f;
414 float mTimelineSnapInterval = 0.1f;
415 int32_t mTimelineSelectedTrack = -1;
416 int32_t mTimelineSelectedClip = -1;
417 int32_t mTimelineSelectedKeyframe = -1;
418
419 // ImGuizmo state
420 ImGuizmo::OPERATION mGizmoOperation = ImGuizmo::TRANSLATE;
421 ImGuizmo::MODE mGizmoMode = ImGuizmo::WORLD;
422 bool mGizmoBlockedBySelection = false;
423
424 // Methods
425 void Init();
426 void Shutdown();
427 void Update(float deltaTime);
428
429 void GatherProperties(std::vector<Property>& props);
430
431 void SetEditorMode(EditorMode mode);
432 EditorMode GetEditorMode();
433
434 void SetPaintMode(PaintMode paintMode);
435 PaintMode GetPaintMode();
436
437 // ===== Batch 15: Addon viewport mode helpers =====
438
453 void SetActiveAddonViewportMode(const std::string& modeId);
454
461 void ClearActiveAddonViewportMode();
462
464 bool HasActiveAddonViewportMode() const { return !mActiveAddonViewportModeId.empty(); }
465
467 const std::string& GetActiveAddonViewportModeId() const { return mActiveAddonViewportModeId; }
468
469 void ReadEditorSave();
470 void WriteEditorSave();
471
472 void ReadEditorProjectSave();
473 void WriteEditorProjectSave();
474
475 void HandleNodeDestroy(Node* node);
476
477 void SetSelectedNode(Node* newNode);
478 void AddSelectedNode(Node* node, bool addAllChildren);
479 void SelectNodesInRange(Node* rootNode, Node* endNode);
480 void RemoveSelectedNode(Node* node);
481 void SetSelectedAssetStub(AssetStub* newStub);
482 void AddSelectedAssetStub(AssetStub* stub);
483 void RemoveSelectedAssetStub(AssetStub* stub);
484 void ClearSelectedAssetStubs();
485 const std::vector<AssetStub*>& GetSelectedAssetStubs();
486 bool IsAssetStubSelected(AssetStub* stub);
487 void SetControlMode(ControlMode newMode);
488
489 void BeginPlayInEditor();
490 void EndPlayInEditor();
491 // Defer the start/stop by one frame so the loading modal can render
492 // before the (potentially slow) snapshot/clone or restore work runs.
493 void RequestBeginPlayInEditor();
494 void RequestEndPlayInEditor();
495 // Defer a Lua "Reload All Scripts" until end-of-frame so the progress
496 // modal can render before the script reload loop blocks. The worker is
497 // the global ::ReloadAllScripts() in Engine.cpp.
498 void RequestReloadAllScripts();
499 void EjectPlayInEditor();
500 void InjectPlayInEditor();
501 void SnapshotAssetsForPie();
502 void RestoreAssetsFromPie();
503
504 // Sub-scene override inspector helpers. The cache holds an instantiated
505 // copy of each source Scene asset that's currently being inspected; the
506 // inspector compares the live node's property values against the
507 // corresponding default node in the cached tree to detect overrides.
508 // Pass nullptr to InvalidateSubSceneDefaultCache to clear everything.
509 Node* GetSubSceneDefaultTree(Scene* src);
510 void InvalidateSubSceneDefaultCache(Scene* src = nullptr);
511 bool IsPropertyOverridden(Node* node, const std::string& propName);
512 void RevertPropertyToSource(Node* node, const std::string& propName);
513 void SetPlayInEditorPaused(bool paused);
514 bool IsPlayInEditorPaused();
515
516 void SetNodePropertySelect(bool enable, int32_t index, const std::string& propName);
517 void ClearNodePropertySelect();
518 void AssignNodePropertySelect(Node* targetNode);
519
520 POLYPHASE_API Camera3D* GetEditorCamera();
521 void ToggleEditorCameraProjection();
522 void ApplyEditorCameraSettings();
523
524 // Camera bookmarks. Slots are 0..kEditorCameraBookmarkSlotCount-1; the
525 // hotkey labels (1..0) correspond to slots 0..9. Save captures the editor
526 // camera's transform / projection / focal distance, Restore re-applies
527 // them, and Has reports whether a slot has been populated. Restore is
528 // intentionally NOT undoable — it changes editor view state, not scene
529 // content.
530 void SaveCameraBookmark(int32_t slot);
531 void RestoreCameraBookmark(int32_t slot);
532 bool HasCameraBookmark(int32_t slot) const;
533 const EditorCameraBookmarkArray* GetActiveSceneCameraBookmarks() const;
534 EditorCameraBookmarkArray* GetOrCreateActiveSceneCameraBookmarks();
535
536 void LoadStartupScene();
537
538 Node* GetSelectedNode();
539 Widget* GetSelectedWidget();
540 const std::vector<Node*>& GetSelectedNodes();
541 bool IsNodeSelected(Node* node);
542 void DeselectNode(Node* node);
543 int32_t GetSelectedInstance();
544 void SetSelectedInstance(int32_t instance);
545 //void ShowTextPrompt(const char* title, TextFieldHandlerFP confirmHandler, const char* defaultText = nullptr);
546
547 POLYPHASE_API void OpenEditScene(Scene* scene);
548 void OpenEditScene(int32_t idx);
549 void CloseEditScene(int32_t idx);
550 void ShelveEditScene();
551 EditScene* GetEditScene(int32_t idx = -1);
552 void CloseAllEditScenes();
553 void EnsureActiveScene();
554
555 void ShowEditorUi(bool show);
556
557 Asset* GetSelectedAsset();
558 AssetStub* GetSelectedAssetStub();
559 ControlMode GetControlMode();
560 glm::vec3 GetTransformLockVector(TransformLock lock);
561 void SetTransformLock(TransformLock lock);
562
563 Object* GetInspectedObject();
564 Node* GetInspectedNode();
565 Asset* GetInspectedAsset();
566 void InspectObject(Object* obj, bool force = false, bool recordHistory = true);
567 void LockInspect(bool lock);
568 bool IsInspectLocked();
569 void RecordInspectHistory();
570 void ClearInspectHistory();
571 void RemoveFromInspectHistory(Object* obj);
572 void ProgressInspectFuture();
573 void RegressInspectPast();
574 void ClearAssetDirHistory();
575 POLYPHASE_API void SetAssetDirectory(AssetDir* assetDir, bool recordHistory);
576 POLYPHASE_API AssetDir* GetAssetDirectory();
577 void BrowseToAsset(const std::string& name);
578 void BrowseToScript(const std::string& scriptName);
579 void BrowseToScriptPath(const std::string& fullPath);
580
581 void CaptureAndSaveScene(AssetStub* stub, Node* rootNode);
582 void DuplicateAsset(AssetStub* srcStub, const char* overrideName = nullptr);
583
584 void ProgressDirFuture();
585 void RegressDirPast();
586
587 void RemoveFilteredAssetStub(AssetStub* stub);
588 int ActiveTab() const { return (int)mActiveAssetTab; }
589
590 Viewport3D* GetViewport3D();
591 Viewport2D* GetViewport2D();
592
593 // True when the editor viewport should render lighting faithfully to a
594 // retro console target instead of applying desktop conveniences (the
595 // synthetic preview directional light, unclamped HDR light colors).
596 // Driven by the project's current build target, or - when no target is
597 // set - by the Game Preview panel's selected console resolution preset.
598 bool ShouldPreviewConsoleLighting();
599
600 bool IsDirFavorited(const std::string& dirPath);
601 void AddFavoriteDir(const std::string& dirPath);
602 void RemoveFavoriteDir(const std::string& dirPath);
603
604 void AddRecentProject(const std::string& projPath);
605 void AddRecentScene(const std::string& sceneName);
606};
607
608POLYPHASE_API EditorState* GetEditorState();
609
610#endif
bool Update()
Definition Engine.cpp:995
void Shutdown()
Definition Engine.cpp:1298
ProjectionMode
Definition Enums.h:27
#define POLYPHASE_API
Definition PolyphaseAPI.h:31
Definition AssetDir.h:13
Definition AssetRef.h:18
Definition Asset.h:125
Definition Camera3d.h:12
Definition Canvas.h:9
Definition Node.h:67
Definition Object.h:13
Definition Scene.h:42
Definition Text.h:24
Definition TimelineInstance.h:32
Definition Timeline.h:10
Definition Viewport2d.h:34
Definition Viewport3d.h:8
Definition Widget.h:57
Definition Asset.h:94
Definition Scene.h:14