Unravel Engine C++ Reference
|
Global context for tracking prefab override changes during inspection. More...
#include <inspectors.h>
Public Member Functions | |
prefab_override_context ()=default | |
Default constructor. | |
void | set_entity_uuid (const hpp::uuid &uuid) |
Sets the entity UUID for both path contexts. | |
void | set_component_type (const std::string &type, const std::string &pretty_type) |
Sets the component type for both path contexts. | |
void | push_segment (const std::string &segment, const std::string &pretty_segment) |
Pushes a new path segment onto both contexts and applies override styling. | |
void | pop_segment () |
Pops the last path segment and removes override styling if needed. | |
auto | begin_prefab_inspection (entt::handle entity) -> bool |
Initialize context for inspecting a prefab instance. | |
void | end_prefab_inspection () |
End prefab inspection context and clean up state. | |
auto | record_override () -> bool |
Record a property override when a change is detected. | |
auto | is_path_overridden () const -> bool |
Check if the current property path is already overridden. | |
Static Public Member Functions | |
static auto | find_prefab_root_entity (entt::handle entity) -> entt::handle |
Finds the prefab root entity by traversing up the parent hierarchy. | |
static auto | get_entity_prefab_uuid (entt::handle entity) -> hpp::uuid |
Gets the prefab UUID of an entity from its prefab_id_component. | |
static void | mark_transform_as_changed (entt::handle entity, bool position, bool rotation, bool scale, bool skew) |
Marks transform properties as changed in prefab override system. | |
static void | mark_transform_global_as_changed (entt::handle entity, bool position, bool rotation, bool scale, bool skew) |
static void | mark_active_as_changed (entt::handle entity) |
Marks entity active state as changed in prefab override system. | |
static void | mark_text_area_as_changed (entt::handle entity) |
Marks text area as changed in prefab override system. | |
static void | mark_material_as_changed (entt::handle entity) |
Marks material as changed in prefab override system. | |
static void | mark_property_as_changed (entt::handle entity, const entt::meta_type &component_type, const std::string &property_path) |
Marks a specific property as changed using component type. | |
static void | mark_property_as_changed (entt::handle entity, const std::string &component_type_name, const std::string &component_pretty_type_name, const std::string &property_path) |
Marks a specific property as changed using component type names. | |
static auto | exists_in_prefab (scene &cache_scene, const asset_handle< prefab > &prefab, hpp::uuid entity_uuid, const std::string &component_type, const std::string &property_path) -> bool |
Checks if a property exists in the original prefab. | |
static void | mark_entity_as_removed (entt::handle entity) |
Marks an entity as removed from the prefab instance. | |
Public Attributes | |
std::function< bool(const hpp::uuid &entity_uuid, const std::string &component_path)> | is_path_overridden_callback |
Callback function to check if a specific property path is already overridden. | |
property_path_context | path_context |
Current property path context for serialization paths. | |
property_path_context | pretty_path_context |
Current property path context for human-readable paths. | |
entt::handle | prefab_root_entity |
The prefab root entity that contains the prefab_component. | |
entt::handle | entity |
The specific entity currently being inspected. | |
scene | prefab_scene {"prefab_diff_scene"} |
Temporary scene for prefab comparison operations. | |
uintptr_t | prefab_version {} |
Version tracking for prefab changes. | |
bool | is_active = false |
Whether we're currently inspecting a prefab instance. | |
Global context for tracking prefab override changes during inspection.
Manages the state needed to track which properties have been modified in prefab instances, enabling the override system that allows instances to deviate from their prefab templates while maintaining the connection.
Definition at line 93 of file inspectors.h.
|
default |
Default constructor.
auto unravel::prefab_override_context::begin_prefab_inspection | ( | entt::handle | entity | ) | -> bool |
Initialize context for inspecting a prefab instance.
entity | The prefab instance entity being inspected |
Definition at line 102 of file inspectors.cpp.
void unravel::prefab_override_context::end_prefab_inspection | ( | ) |
End prefab inspection context and clean up state.
Definition at line 137 of file inspectors.cpp.
|
static |
Checks if a property exists in the original prefab.
cache_scene | Temporary scene for prefab loading |
prefab | Handle to the prefab asset |
entity_uuid | UUID of the entity in the prefab |
component_type | Type name of the component |
property_path | Path to the property |
Definition at line 438 of file inspectors.cpp.
|
static |
Finds the prefab root entity by traversing up the parent hierarchy.
entity | The entity to start searching from |
entity | The entity to start searching from |
Definition at line 239 of file inspectors.cpp.
|
static |
Gets the prefab UUID of an entity from its prefab_id_component.
Get the UUID of an entity from its id_component.
entity | The entity to get the UUID from |
entity | The entity to get the UUID from |
Definition at line 273 of file inspectors.cpp.
|
inline |
Check if the current property path is already overridden.
Definition at line 171 of file inspectors.h.
|
static |
Marks entity active state as changed in prefab override system.
entity | Entity whose active state was modified |
Definition at line 341 of file inspectors.cpp.
|
static |
Marks an entity as removed from the prefab instance.
entity | Entity that was removed |
Definition at line 419 of file inspectors.cpp.
|
static |
Marks material as changed in prefab override system.
entity | Entity whose material was modified |
Definition at line 351 of file inspectors.cpp.
|
static |
Marks a specific property as changed using component type.
entity | Entity that was modified |
component_type | Meta type of the component |
property_path | Path to the specific property that changed |
Definition at line 356 of file inspectors.cpp.
|
static |
Marks a specific property as changed using component type names.
entity | Entity that was modified |
component_type_name | Technical name of the component type |
component_pretty_type_name | Human-readable name of the component type |
property_path | Path to the specific property that changed |
Definition at line 366 of file inspectors.cpp.
|
static |
Marks text area as changed in prefab override system.
entity | Entity whose text area was modified |
Definition at line 346 of file inspectors.cpp.
|
static |
Marks transform properties as changed in prefab override system.
entity | Entity whose transform was modified |
position | Whether position was changed |
rotation | Whether rotation was changed |
scale | Whether scale was changed |
skew | Whether skew was changed |
Definition at line 288 of file inspectors.cpp.
|
static |
Definition at line 313 of file inspectors.cpp.
void unravel::prefab_override_context::pop_segment | ( | ) |
Pops the last path segment and removes override styling if needed.
Definition at line 217 of file inspectors.cpp.
void unravel::prefab_override_context::push_segment | ( | const std::string & | segment, |
const std::string & | pretty_segment ) |
Pushes a new path segment onto both contexts and applies override styling.
segment | Technical path segment |
pretty_segment | Human-readable path segment |
Definition at line 199 of file inspectors.cpp.
auto unravel::prefab_override_context::record_override | ( | ) | -> bool |
Record a property override when a change is detected.
Uses the current property path context to determine what was changed. Automatically removes any parent or child overrides to keep only the most specific path.
Definition at line 146 of file inspectors.cpp.
void unravel::prefab_override_context::set_component_type | ( | const std::string & | type, |
const std::string & | pretty_type ) |
Sets the component type for both path contexts.
type | Technical component type name |
pretty_type | Human-readable component type name |
Definition at line 188 of file inspectors.cpp.
void unravel::prefab_override_context::set_entity_uuid | ( | const hpp::uuid & | uuid | ) |
Sets the entity UUID for both path contexts.
uuid | UUID of the entity being inspected |
Definition at line 178 of file inspectors.cpp.
entt::handle unravel::prefab_override_context::entity |
The specific entity currently being inspected.
Definition at line 111 of file inspectors.h.
bool unravel::prefab_override_context::is_active = false |
Whether we're currently inspecting a prefab instance.
Definition at line 119 of file inspectors.h.
std::function<bool(const hpp::uuid& entity_uuid, const std::string& component_path)> unravel::prefab_override_context::is_path_overridden_callback |
Callback function to check if a specific property path is already overridden.
Definition at line 101 of file inspectors.h.
property_path_context unravel::prefab_override_context::path_context |
Current property path context for serialization paths.
Definition at line 104 of file inspectors.h.
entt::handle unravel::prefab_override_context::prefab_root_entity |
The prefab root entity that contains the prefab_component.
Definition at line 109 of file inspectors.h.
scene unravel::prefab_override_context::prefab_scene {"prefab_diff_scene"} |
Temporary scene for prefab comparison operations.
Definition at line 114 of file inspectors.h.
uintptr_t unravel::prefab_override_context::prefab_version {} |
Version tracking for prefab changes.
Definition at line 116 of file inspectors.h.
property_path_context unravel::prefab_override_context::pretty_path_context |
Current property path context for human-readable paths.
Definition at line 106 of file inspectors.h.