diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-02-21 07:38:25 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-02-21 07:38:25 +0100 |
commit | 19652b004e83ca7d460c87a7666ba46083b9222a (patch) | |
tree | a8bb7c030b67a412616367b45d5006d437bb2925 | |
parent | 1cc674eda2d3002891f8fc5d91e4771c9de0eb1a (diff) |
wip
-rw-r--r-- | editor/inspect.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/editor/inspect.cpp b/editor/inspect.cpp index c1f0840e..5a34d906 100644 --- a/editor/inspect.cpp +++ b/editor/inspect.cpp @@ -1,22 +1,31 @@ #include "inspect.hpp" +#include "compat/assert.hpp" #include "entity/accessor.hpp" -#include <imgui.h> +#include "imgui-raii.hpp" namespace floormat { +using namespace imgui; using namespace entities; template<typename T> -static void do_inspect_field(const void* datum, const entities::erased_accessor& accessor) +static void do_inspect_field(const void* datum, const erased_accessor& accessor) { - auto range = accessor.get_range(datum); - auto enabled = accessor.is_enabled(datum); - auto [min, max] = range.convert<T>(); + fm_assert(accessor.check_field_name<T>()); + raii_wrapper disabler; + switch (accessor.is_enabled(datum)) + { + using enum field_status; + case hidden: return; + case readonly: disabler = begin_disabled(); break; + case enabled: break; + } + auto [min, max] = accessor.get_range(datum).convert<T>(); } -template<> void inspect_field<int>(const void* datum, const entities::erased_accessor& accessor) +template<> void inspect_field<int>(const void* datum, const erased_accessor& accessor) { do_inspect_field<int>(datum, accessor); } |