20 size_t item_current_idx = data.shape.index();
22 const auto& combo_preview_value = variant_types[item_current_idx];
26 if(ImGui::BeginCombo(
"##Type",
name.c_str()))
28 for(
int n = 0; n < variant_types.size(); n++)
30 const bool is_selected = (item_current_idx == n);
34 if(ImGui::Selectable(
name.c_str(), is_selected))
37 result.changed =
true;
40 result.edit_finished |= ImGui::IsItemDeactivatedAfterEdit();
43 ImGui::DrawItemActivityOutline();
48 ImGui::SetItemDefaultFocus();
53 result.edit_finished |= ImGui::IsItemDeactivatedAfterEdit();
55 ImGui::DrawItemActivityOutline();
59 const auto type = variant_types[item_current_idx];
60 if(
type == entt::resolve<physics_box_shape>())
64 else if(
type == entt::resolve<physics_sphere_shape>())
68 else if(
type == entt::resolve<physics_capsule_shape>())
72 else if(
type == entt::resolve<physics_cylinder_shape>())
76 else if(
type == entt::resolve<physics_mesh_shape>())
82 std::string prop_name =
"shape";
83 std::string prop_pretty_name =
"Shape";
85 auto make_shape_proxy = [prop_name, prop_pretty_name, var_proxy](
auto&& shape_ref) ->
meta_any_proxy
87 using shape_type = std::decay_t<
decltype(shape_ref)>;
89 shape_proxy.
impl->parent = var_proxy.impl;
91 shape_proxy.impl->name = [&]()
93 const auto&
name = var_proxy.impl->name;
96 return prop_pretty_name;
98 return fmt::format(
"{}/{}",
name, prop_pretty_name);
100 shape_proxy.impl->getter = [parent_proxy = var_proxy](entt::meta_any& result)
102 entt::meta_any parent_var;
103 if(parent_proxy.impl->getter(parent_var) && parent_var)
106 if(hpp::holds_alternative<shape_type>(compound_shape.shape))
108 result = entt::meta_any{hpp::get<shape_type>(compound_shape.shape)};
114 shape_proxy.impl->setter = [parent_proxy = var_proxy](
meta_any_proxy& proxy,
const entt::meta_any& value, uint64_t execution_count)
mutable
116 entt::meta_any parent_var;
117 if(parent_proxy.impl->getter(parent_var) && parent_var)
120 if(value.try_cast<shape_type>())
122 compound_shape.shape = value.cast<shape_type>();
123 return parent_proxy.impl->setter(parent_proxy, parent_var, execution_count);
134 if(hpp::holds_alternative<physics_box_shape>(data.shape))
136 auto&
shape = hpp::get<physics_box_shape>(data.shape);
137 auto shape_proxy = make_shape_proxy(
shape);
138 entt::meta_any shape_var;
139 if(shape_proxy.impl->getter(shape_var))
144 else if(hpp::holds_alternative<physics_sphere_shape>(data.shape))
146 auto&
shape = hpp::get<physics_sphere_shape>(data.shape);
147 auto shape_proxy = make_shape_proxy(
shape);
148 entt::meta_any shape_var;
149 if(shape_proxy.impl->getter(shape_var))
154 else if(hpp::holds_alternative<physics_capsule_shape>(data.shape))
156 auto&
shape = hpp::get<physics_capsule_shape>(data.shape);
157 auto shape_proxy = make_shape_proxy(
shape);
158 entt::meta_any shape_var;
159 if(shape_proxy.impl->getter(shape_var))
164 else if(hpp::holds_alternative<physics_cylinder_shape>(data.shape))
166 auto&
shape = hpp::get<physics_cylinder_shape>(data.shape);
167 auto shape_proxy = make_shape_proxy(
shape);
168 entt::meta_any shape_var;
169 if(shape_proxy.impl->getter(shape_var))
174 else if(hpp::holds_alternative<physics_mesh_shape>(data.shape))
176 auto&
shape = hpp::get<physics_mesh_shape>(data.shape);
177 auto shape_proxy = make_shape_proxy(
shape);
178 entt::meta_any shape_var;
179 if(shape_proxy.impl->getter(shape_var))
186 ImGui::LabelText(
"Unknown",
"%s",
"test");
Global context for tracking prefab override changes during inspection.
void push_segment(const std::string &segment, const std::string &pretty_segment)
Pushes a new path segment onto both contexts and applies override styling.