Unravel Engine C++ Reference
Loading...
Searching...
No Matches
editor_actions.h
Go to the documentation of this file.
1#pragma once
2
3#include <base/basetypes.hpp>
4#include <context/context.hpp>
5
8#include <engine/ecs/prefab.h>
11#include <logging/logging.h>
12
14
15#include <chrono>
16#include <functional>
17#include <string>
18#include <vector>
19
20namespace unravel
21{
22
24{
25 std::string phase{"inactive"};
26 bool is_active{false};
27 bool is_paused{false};
28 bool is_splash{false};
30 uint64_t frames_running{0};
31};
32
34{
35 std::string active_entity_id;
36 std::vector<std::string> entity_ids;
37};
38
40{
41 uint64_t id{0};
42 level::level_enum level{level::off};
43 std::string text;
44 std::string filename;
45 std::string funcname;
46 int line{0};
47};
48
53{
54 std::string source_path;
55 std::string dest_path;
56 std::string dest_key;
57 bool is_directory{false};
58 tpp::shared_future<bool> future;
59};
60
62{
63 static auto new_scene(rtti::context& ctx) -> bool;
64 static auto open_scene(rtti::context& ctx) -> bool;
65 static auto open_scene_from_asset(rtti::context& ctx, const asset_handle<scene_prefab>& asset) -> bool;
66 static auto save_scene(rtti::context& ctx) -> bool;
67 static auto save_scene_as(rtti::context& ctx) -> bool;
68 static auto prompt_save_scene(rtti::context& ctx, const std::function<void()>& on_continue) -> bool;
69
74 static auto load_scene_from_asset(rtti::context& ctx,
75 const asset_handle<scene_prefab>& asset,
76 std::string* error = nullptr) -> bool;
77
83
88 static auto save_scene_to_path(rtti::context& ctx,
89 const fs::path& path,
90 bool update_source = true,
91 bool show_notification = true) -> bool;
92
93 static auto close_project(rtti::context& ctx) -> bool;
94 static auto reload_project(rtti::context& ctx) -> bool;
95
96 static void run_project(const fs::path& executable_path);
97 static auto deploy_project(rtti::context& ctx, const deploy_settings& params)
98 -> std::map<std::string, tpp::shared_future<void>>;
99 static auto can_deploy_project(rtti::context& ctx, const deploy_settings& params) -> bool;
100
101
102 static void recompile_shaders(const std::string& group = "");
103 static void recompile_textures(const std::string& group = "");
104 static void recompile_ui(const std::string& group = "");
105 static void recompile_scripts(const std::string& group = "");
106 static void recompile_meshes(const std::string& group = "");
107 static void recompile_all(const std::string& group = "");
108 static void generate_script_workspace();
109 static void open_workspace_on_file(const fs::path& file, int line = 0);
110
120 static auto rebuild_reflection_probes(rtti::context& ctx, bool force_full_first_frame = true) -> size_t;
121
122 // Play mode (shared by header UI + MCP)
123 static auto can_enter_play(rtti::context& ctx, std::string* error = nullptr) -> bool;
124 static auto get_play_state(rtti::context& ctx) -> play_state_info;
125 static auto set_play_active(rtti::context& ctx,
126 bool active,
127 bool allow_splash = true,
128 std::string* error = nullptr) -> bool;
129 static auto toggle_play(rtti::context& ctx, bool allow_splash = true, std::string* error = nullptr) -> bool;
130 static auto set_play_paused(rtti::context& ctx, bool paused, std::string* error = nullptr) -> bool;
131 static auto skip_play_frame(rtti::context& ctx, std::string* error = nullptr) -> bool;
132
133 // Selection (entity handles only for Phase A)
134 static auto get_selection(rtti::context& ctx) -> selection_info;
135 static auto set_selection(rtti::context& ctx,
136 const std::vector<std::string>& entity_ids,
137 bool add = false,
138 std::string* error = nullptr) -> bool;
139 static void clear_selection(rtti::context& ctx);
140
141 // Console log history
142 static auto get_recent_logs(rtti::context& ctx,
143 level::level_enum min_level,
144 size_t max_count,
145 uint64_t after_id = 0) -> std::vector<log_query_entry>;
146
147 // Entity inspect
148 static auto inspect_entity(rtti::context& ctx,
149 const std::string& entity_id,
150 bool include_components,
151 std::string* error = nullptr) -> std::string;
152
153 // Panel focus (ImGui dock tabs)
154 static auto focus_scene_panel(rtti::context& ctx, std::string* error = nullptr) -> bool;
155 static auto focus_game_panel(rtti::context& ctx, std::string* error = nullptr) -> bool;
156
161 static auto request_main_window_focus(rtti::context& ctx, std::string* error = nullptr) -> bool;
162
172 static auto import_files(rtti::context& ctx,
173 const std::vector<std::string>& paths,
174 const fs::path& target_path,
175 bool async = true) -> std::vector<import_files_item>;
176
181 static auto wait_import_jobs(std::vector<import_files_item>& items,
182 std::chrono::milliseconds timeout) -> bool;
183
184};
185
186} // namespace unravel
defaults::scene_preset preset
std::vector< render_pass_node_item > items
std::string error
Definition mcp_async.cpp:33
Thread-safe handle to an asset.
scene_preset
Quality presets for new scene creation (low = less expensive, high = more expensive).
Definition defaults.h:215
static auto close_project(rtti::context &ctx) -> bool
static void run_project(const fs::path &executable_path)
static auto can_enter_play(rtti::context &ctx, std::string *error=nullptr) -> bool
static auto load_scene_from_asset(rtti::context &ctx, const asset_handle< scene_prefab > &asset, std::string *error=nullptr) -> bool
Non-modal scene load (shared by File menu + MCP). Clears edit state, loads asset, syncs prefabs,...
static auto skip_play_frame(rtti::context &ctx, std::string *error=nullptr) -> bool
static auto import_files(rtti::context &ctx, const std::vector< std::string > &paths, const fs::path &target_path, bool async=true) -> std::vector< import_files_item >
Copy external files/folders into target_path (content-browser Import parity).
static void open_workspace_on_file(const fs::path &file, int line=0)
static void recompile_shaders(const std::string &group="")
static void recompile_scripts(const std::string &group="")
static auto save_scene_to_path(rtti::context &ctx, const fs::path &path, bool update_source=true, bool show_notification=true) -> bool
Atomic-save active scene to path/key. When update_source is true, sets scene.source and project opene...
static void recompile_ui(const std::string &group="")
static auto open_scene(rtti::context &ctx) -> bool
static auto open_scene_from_asset(rtti::context &ctx, const asset_handle< scene_prefab > &asset) -> bool
static auto request_main_window_focus(rtti::context &ctx, std::string *error=nullptr) -> bool
Focus/raise the OS main window so asset watcher and similar focus-gated work can run (e....
static auto set_play_active(rtti::context &ctx, bool active, bool allow_splash=true, std::string *error=nullptr) -> bool
static auto get_play_state(rtti::context &ctx) -> play_state_info
static void clear_selection(rtti::context &ctx)
static void recompile_textures(const std::string &group="")
static auto focus_scene_panel(rtti::context &ctx, std::string *error=nullptr) -> bool
static auto set_selection(rtti::context &ctx, const std::vector< std::string > &entity_ids, bool add=false, std::string *error=nullptr) -> bool
static auto prompt_save_scene(rtti::context &ctx, const std::function< void()> &on_continue) -> bool
static auto get_recent_logs(rtti::context &ctx, level::level_enum min_level, size_t max_count, uint64_t after_id=0) -> std::vector< log_query_entry >
static auto inspect_entity(rtti::context &ctx, const std::string &entity_id, bool include_components, std::string *error=nullptr) -> std::string
static void recompile_all(const std::string &group="")
static auto focus_game_panel(rtti::context &ctx, std::string *error=nullptr) -> bool
static auto save_scene(rtti::context &ctx) -> bool
static auto new_scene(rtti::context &ctx) -> bool
static auto set_play_paused(rtti::context &ctx, bool paused, std::string *error=nullptr) -> bool
static auto reload_project(rtti::context &ctx) -> bool
static auto save_scene_as(rtti::context &ctx) -> bool
static auto rebuild_reflection_probes(rtti::context &ctx, bool force_full_first_frame=true) -> size_t
Flags every reflection probe across all loaded scenes for rebuild.
static auto toggle_play(rtti::context &ctx, bool allow_splash=true, std::string *error=nullptr) -> bool
static auto deploy_project(rtti::context &ctx, const deploy_settings &params) -> std::map< std::string, tpp::shared_future< void > >
static auto wait_import_jobs(std::vector< import_files_item > &items, std::chrono::milliseconds timeout) -> bool
Block until all import copy jobs complete or timeout elapses.
static void recompile_meshes(const std::string &group="")
static auto new_scene_from_preset(rtti::context &ctx, defaults::scene_preset preset) -> bool
Non-modal new scene from preset (shared by create-scene modal + MCP). Cancels any pending create-scen...
static auto can_deploy_project(rtti::context &ctx, const deploy_settings &params) -> bool
static void generate_script_workspace()
static auto get_selection(rtti::context &ctx) -> selection_info
One async content-browser-style import job (external path -> project folder).
tpp::shared_future< bool > future
std::string text
level::level_enum level
std::string funcname
std::string filename
int line
std::vector< std::string > entity_ids