13 : entity_uuid(uuid), component_path(path), pretty_component_path(path)
18 : entity_uuid(uuid), component_path(path), pretty_component_path(pretty_path)
24 return entity_uuid == other.entity_uuid && component_path == other.component_path;
29 if (entity_uuid != other.entity_uuid)
31 return entity_uuid < other.entity_uuid;
33 return component_path < other.component_path;
51 auto is_parent_path = [](
const std::string& parent,
const std::string& child) ->
bool
53 if (child.length() <= parent.length())
57 if (child.substr(0, parent.length()) != parent)
61 char next_char = child[parent.length()];
62 return next_char ==
'/' || next_char ==
'[';
66 std::vector<prefab_property_override_data> to_remove;
70 if (existing_override.entity_uuid != entity_uuid)
76 if (is_parent_path(existing_override.component_path, component_path))
78 to_remove.push_back(existing_override);
81 else if (is_parent_path(component_path, existing_override.component_path))
89 for (
const auto& override_to_remove : to_remove)
91 remove_override(override_to_remove.entity_uuid, override_to_remove.component_path);
112 if(
override.entity_uuid == entity_uuid)
136 bool starts_with_entities = hpp::string_view(
segments[0]).starts_with(
"entities");
137 if(!starts_with_entities)
142 bool starts_with_components = hpp::string_view(
segments[2]).starts_with(
"components");
143 if(!starts_with_components)
149 std::string_view uuid_str =
segments[1];
150 auto uuid_opt = hpp::uuid::from_string(uuid_str);
151 if (!uuid_opt.has_value())
157 std::string component_path;
158 bool first_segment =
true;
160 for (
size_t i = 3; i <
segments.size(); ++i)
164 component_path +=
"/";
167 first_segment =
false;
171 if(has_override(uuid_opt.value(), component_path))
Hash specialization for batch_key to enable use in std::unordered_map.
auto tokenize(const std::string &str, const std::string &delimiters) -> string_tokens_t
const segment_list * segments
void remove_override(const hpp::uuid &entity_uuid, const std::string &component_path)
Remove a property override.
void clear_overrides()
Clear all overrides (for applying all changes to prefab)
auto has_serialization_override(const std::string &serialization_path) const -> bool
Check if a serialization path has an override (for backward compatibility)
auto has_override(const hpp::uuid &entity_uuid, const std::string &component_path) const -> bool
Check if a property is overridden.
std::set< hpp::uuid > removed_entities
std::set< prefab_property_override_data > property_overrides
Storage of property overrides Each override is identified by entity UUID + component path This allows...
void remove_entity(const hpp::uuid &entity_uuid)
Remove an entity from the prefab.
void add_override(const hpp::uuid &entity_uuid, const std::string &component_path)
Add a property override.
auto get_all_overrides() const -> const std::set< prefab_property_ override _data > &
Get all overrides.
Represents a property override with entity UUID and component/property path.
prefab_property_override_data()=default
auto operator==(const prefab_property_override_data &other) const -> bool
auto operator<(const prefab_property_override_data &other) const -> bool