diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-06-07 02:30:03 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-06-07 02:30:03 +0200 |
commit | 6ae3651048efc81605a3f1c4b9ae2af7d257b626 (patch) | |
tree | e54f1f8b85fc585c8fc73494ea4e76942c167efa /editor | |
parent | 21370fdbc2342ce7edb7bf770203b1f36d824f6f (diff) |
a inspect
Diffstat (limited to 'editor')
-rw-r--r-- | editor/inspect-types.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/editor/inspect-types.cpp b/editor/inspect-types.cpp index 0968eeec..65af0966 100644 --- a/editor/inspect-types.cpp +++ b/editor/inspect-types.cpp @@ -19,6 +19,11 @@ using st = field_status; template<> struct entity_accessors<object, inspect_intent_t> { + static constexpr bool enable_bbox_editing(const object& x) + { + return x.updates_passability() || x.pass != pass_mode::pass; + } + static constexpr auto accessors() { using E = Entity<object>; @@ -76,12 +81,12 @@ struct entity_accessors<object, inspect_intent_t> { E::type<Vector2b>::field{"bbox-offset"_s, &object::bbox_offset, [](object& x, Vector2b value) { x.set_bbox(x.offset, value, x.bbox_size, x.pass); }, - [](const object& x) { return x.pass == pass_mode::pass ? st::readonly : st::enabled; }, + [](const object& x) { return enable_bbox_editing(x) ? st::enabled : st::readonly; }, }, E::type<Vector2ub>::field{"bbox-size"_s, &object::bbox_size, [](object& x, Vector2ub value) { x.set_bbox(x.offset, x.bbox_offset, value, x.pass); }, - [](const object& x) { return x.pass == pass_mode::pass ? st::readonly : st::enabled; }, + [](const object& x) { return enable_bbox_editing(x) ? st::enabled : st::readonly; }, constantly(constraints::range<Vector2ub>{{1,1}, {255, 255}}), }, E::type<bool>::field{"ephemeral"_s, |