Unravel Engine C++ Reference
Loading...
Searching...
No Matches
editing_action.cpp
Go to the documentation of this file.
1#include "editing_action.h"
2#include "imgui/imgui.h"
4
5namespace unravel
6{
7
8// No implementation needed for the base class - all methods are virtual
9void editing_action_t::draw_in_inspector_impl(rtti::context& ctx, const entt::meta_any& old_value, const entt::meta_any& new_value, const entt::meta_custom& custom)
10{
11 var_info info;
12 info.read_only = true;
13 info.is_property = true;
14
15 ImGui::Separator();
16 ImGui::Text("%s", get_name().c_str());
17 entt::meta_any old_value_copy = old_value;
18 entt::meta_any new_value_copy = new_value;
19 ImGui::SetNextWindowSizeConstraints({}, {400.0f, ImGui::GetContentRegionAvail().y});
20
21 auto child_name = fmt::format("##tooltip_child_{}_{}", name, uintptr_t(this));
22 ImGui::BeginChild(child_name.c_str(), {}, ImGuiChildFlags_AlwaysAutoResize | ImGuiChildFlags_AutoResizeX | ImGuiChildFlags_AutoResizeY);
23
24
25 inspect_var(ctx, old_value_copy, make_proxy(old_value_copy), info, custom);
26 ImGui::EndChild();
27 ImGui::SameLine();
28
29 ImGui::Text(" %s ", ICON_MDI_ARROW_RIGHT);
30 ImGui::SameLine();
31 ImGui::SetNextWindowSizeConstraints({}, {400.0f, ImGui::GetContentRegionAvail().y});
32
33 auto child_name2 = fmt::format("##tooltip_child2_{}_{}", name, uintptr_t(this));
34 ImGui::BeginChild(child_name2.c_str(), {}, ImGuiChildFlags_AlwaysAutoResize | ImGuiChildFlags_AutoResizeX | ImGuiChildFlags_AutoResizeY);
36 info.read_only = false;
37
38 inspect_var(ctx, new_value_copy, make_proxy(new_value_copy), info, custom);
39 ImGui::PopFont();
40 ImGui::EndChild();
41}
42
43} // namespace unravel
#define ICON_MDI_ARROW_RIGHT
void PushFont(Font::Enum _font)
Definition imgui.cpp:617
auto make_proxy(entt::meta_any &var, const std::string &name) -> meta_any_proxy
Creates a simple proxy for direct variable access.
auto inspect_var(rtti::context &ctx, entt::meta_any &var, const meta_any_proxy &var_proxy, const var_info &info, const entt::meta_custom &custom) -> inspect_result
Main entry point for inspecting any variable with automatic type resolution.
virtual auto get_name() const -> const std::string &
void draw_in_inspector_impl(rtti::context &ctx, const entt::meta_any &old_value, const entt::meta_any &new_value, const entt::meta_custom &custom)
Metadata about a variable being inspected.
Definition inspector.h:133
bool is_property
Whether this is a property that can be overridden in prefabs.
Definition inspector.h:137
bool read_only
Whether the variable should be displayed as read-only.
Definition inspector.h:135