36 auto root_prefab_entity = data.get_owner();
38 const auto& overrides = data.get_all_overrides();
40 if(!overrides.empty())
42 std::string header_id = fmt::format(
"Property Overrides: {}###Override Details", overrides.size());
43 if(ImGui::CollapsingHeader(header_id.c_str()))
48 std::string serialization_path_to_remove;
51 const auto& property_overrides = data.get_all_overrides();
52 for(
const auto& override_data : property_overrides)
55 std::string display_path;
62 display_path = entity_name +
"/" + override_data.pretty_component_path;
67 display_path = override_data.pretty_component_path;
71 ImGui::BulletText(
"%s", display_path.c_str());
75 std::string override_id = hpp::to_string(override_data.entity_uuid) +
":" + override_data.component_path;
76 ImGui::PushID(override_id.c_str());
77 if(ImGui::SmallButton(
"Revert"))
80 serialization_path_to_remove = override_id;
86 if(ImGui::IsItemHovered(ImGuiHoveredFlags_ForTooltip) && found_entity)
90 em.
focus(found_entity);
95 ImGui::SetItemTooltipEx(
"Entity: %s\nUUID: %s\nComponent Path: %s\nPretty Path: %s",
97 hpp::to_string(override_data.entity_uuid).c_str(),
98 override_data.component_path.c_str(),
99 override_data.pretty_component_path.c_str());
104 if(!serialization_path_to_remove.empty())
107 auto colon_pos = serialization_path_to_remove.find(
':');
108 if (colon_pos != std::string::npos)
110 std::string uuid_str = serialization_path_to_remove.substr(0, colon_pos);
111 std::string component_path = serialization_path_to_remove.substr(colon_pos + 1);
113 auto uuid_opt = hpp::uuid::from_string(uuid_str);
114 if (uuid_opt.has_value())
116 data.remove_override(uuid_opt.value(), component_path);
118 result.changed =
true;
131 if(!data.removed_entities.empty())
133 std::string header_id = fmt::format(
"Removed Entities: {}###Removed Entities", data.removed_entities.size());
134 if(ImGui::CollapsingHeader(header_id.c_str()))
138 hpp::uuid uiid_to_remove;
139 for(
auto& entity_uuid : data.removed_entities)
141 auto uuid_str = hpp::to_string(entity_uuid);
142 ImGui::BulletText(
"%s", uuid_str.c_str());
146 ImGui::PushID(uuid_str.c_str());
147 if(ImGui::SmallButton(
"Revert"))
150 uiid_to_remove = entity_uuid;
155 if(!uiid_to_remove.is_nil())
157 data.removed_entities.erase(uiid_to_remove);
159 result.changed =
true;
172 if(ImGui::Button(
"Apply All to Prefab", ImVec2(-1, ImGui::GetFrameHeight())))
174 data.changed =
false;
177 data.clear_overrides();
178 result.changed =
true;
181 if(ImGui::Button(
"Revert All Overrides", ImVec2(-1, ImGui::GetFrameHeight())))
183 data.clear_overrides();
185 result.changed =
true;