summaryrefslogtreecommitdiffhomepage
path: root/editor/inspect.cpp
blob: 5a34d9065385d244d49bef1cdfe8b636706555fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "inspect.hpp"
#include "compat/assert.hpp"
#include "entity/accessor.hpp"
#include "imgui-raii.hpp"

namespace floormat {

using namespace imgui;
using namespace entities;

template<typename T>
static void do_inspect_field(const void* datum, const erased_accessor& accessor)
{
    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 erased_accessor& accessor)
{
    do_inspect_field<int>(datum, accessor);
}

} // namespace floormat