Polyphase Game Engine
Loading...
Searching...
No Matches
EditorImgui.h
Go to the documentation of this file.
1#pragma once
2
3#if EDITOR
4#include "EngineTypes.h"
5
6#include <cstdint>
7#include <vector>
8#include "imgui.h"
9#include "misc/cpp/imgui_stdlib.h"
10
11class Object;
12class Property;
13struct AssetStub;
14
15typedef void(*FileBrowserCallbackFP)(const std::vector<std::string>& filePaths);
16
17
18void EditorImguiInit();
19void EditorImguiDraw();
20
27ImFont* GetEditorTerminalFont();
28
29void EditorImguiShutdown();
30void EditorImguiPreShutdown();
31
32void EditorImguiGetViewport(uint32_t& x, uint32_t& y, uint32_t& width, uint32_t& height);
33bool EditorIsInterfaceVisible();
34bool EditorImguiIsViewportHovered();
35void EditorImguiGetViewportRect(float* outX, float* outY, float* outW, float* outH);
36void EditorOpenFileBrowser(FileBrowserCallbackFP callback, bool folderMode);
37void EditorSetFileBrowserDir(const std::string& dir);
38void EditorShowUnsavedAssetsModal(const std::vector<AssetStub*>& unsavedStubs);
39
50void EditorShowAlert(const char* title, const char* message);
51
52void DrawAssetProperty(Property& prop, uint32_t index, Object* owner, PropertyOwnerType ownerType);
53
63void InvalidateAddNodeMenuCache();
64
65// Animated progress modal for long-running editor operations (scene save,
66// asset save, enter/exit PIE, reload scripts). Long synchronous work in
67// these paths would otherwise freeze the UI; calling Pump() at safe
68// checkpoints renders one editor frame so the modal animates and the
69// status label updates. Only valid to call from non-ImGui contexts -- i.e.
70// from the deferred-end-of-frame dispatcher in EditorMain.cpp after
71// EditorImguiDraw has returned. Begin/SetStatus/Step/End perform their
72// own (throttled) pump.
73namespace EditorProgress
74{
75 // Open the modal. status text is shown immediately. If cancellable is
76 // true a Cancel button is rendered; loops should poll WasCancelled().
77 void Begin(const char* title, const char* status, bool cancellable = false);
78
79 // Update the status label and pump a frame (subject to ~60Hz throttle).
80 void SetStatus(const char* msg);
81
82 // Set the progress bar. Negative = indeterminate sine marquee; 0..1 =
83 // determinate fill. No pump (use SetStatus or Step to redraw).
84 void SetFraction(float f);
85
86 // Convenience for "Step N of M" loops: updates label + determinate
87 // fraction + pumps.
88 void Step(const char* msg, int done, int total);
89
90 // Force-render one editor frame. Throttled to ~60Hz; ignored when not
91 // active. Asserts if called inside an ImGui frame scope.
92 void Pump();
93
94 // Close the modal and render one final frame.
95 void End();
96
97 bool IsActive();
98 bool WasCancelled();
99}
100
101#endif
PropertyOwnerType
Definition EngineTypes.h:155
Definition Object.h:13
Definition Property.h:14
Definition Asset.h:88