Unravel Engine C++ Reference
Loading...
Searching...
No Matches
unravel::prefab_override_context Struct 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ prefab_override_context()

unravel::prefab_override_context::prefab_override_context ( )
default

Default constructor.

Member Function Documentation

◆ begin_prefab_inspection()

auto unravel::prefab_override_context::begin_prefab_inspection ( entt::handle entity) -> bool

Initialize context for inspecting a prefab instance.

Parameters
entityThe prefab instance entity being inspected
Returns
true if successfully initialized for prefab inspection

Definition at line 102 of file inspectors.cpp.

◆ end_prefab_inspection()

void unravel::prefab_override_context::end_prefab_inspection ( )

End prefab inspection context and clean up state.

Definition at line 137 of file inspectors.cpp.

◆ exists_in_prefab()

auto unravel::prefab_override_context::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
static

Checks if a property exists in the original prefab.

Parameters
cache_sceneTemporary scene for prefab loading
prefabHandle to the prefab asset
entity_uuidUUID of the entity in the prefab
component_typeType name of the component
property_pathPath to the property
Returns
true if the property exists in the original prefab

Definition at line 438 of file inspectors.cpp.

◆ find_prefab_root_entity()

auto unravel::prefab_override_context::find_prefab_root_entity ( entt::handle entity) -> entt::handle
static

Finds the prefab root entity by traversing up the parent hierarchy.

Parameters
entityThe entity to start searching from
Returns
Handle to the entity with prefab_component, or empty handle if not found
Parameters
entityThe entity to start searching from
Returns
A handle to the entity with prefab_component, or empty handle if not found

Definition at line 239 of file inspectors.cpp.

◆ get_entity_prefab_uuid()

auto unravel::prefab_override_context::get_entity_prefab_uuid ( entt::handle entity) -> hpp::uuid
static

Gets the prefab UUID of an entity from its prefab_id_component.

Get the UUID of an entity from its id_component.

Parameters
entityThe entity to get the UUID from
Returns
The prefab UUID, or nil UUID if entity has no prefab_id_component
Parameters
entityThe entity to get the UUID from
Returns
The UUID as a string, or empty string if entity has no id_component

Definition at line 273 of file inspectors.cpp.

◆ is_path_overridden()

auto unravel::prefab_override_context::is_path_overridden ( ) const -> bool
inline

Check if the current property path is already overridden.

Returns
true if the current path has an existing override

Definition at line 171 of file inspectors.h.

◆ mark_active_as_changed()

void unravel::prefab_override_context::mark_active_as_changed ( entt::handle entity)
static

Marks entity active state as changed in prefab override system.

Parameters
entityEntity whose active state was modified

Definition at line 341 of file inspectors.cpp.

◆ mark_entity_as_removed()

void unravel::prefab_override_context::mark_entity_as_removed ( entt::handle entity)
static

Marks an entity as removed from the prefab instance.

Parameters
entityEntity that was removed

Definition at line 419 of file inspectors.cpp.

◆ mark_material_as_changed()

void unravel::prefab_override_context::mark_material_as_changed ( entt::handle entity)
static

Marks material as changed in prefab override system.

Parameters
entityEntity whose material was modified

Definition at line 351 of file inspectors.cpp.

◆ mark_property_as_changed() [1/2]

void unravel::prefab_override_context::mark_property_as_changed ( entt::handle entity,
const entt::meta_type & component_type,
const std::string & property_path )
static

Marks a specific property as changed using component type.

Parameters
entityEntity that was modified
component_typeMeta type of the component
property_pathPath to the specific property that changed

Definition at line 356 of file inspectors.cpp.

◆ mark_property_as_changed() [2/2]

void unravel::prefab_override_context::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 )
static

Marks a specific property as changed using component type names.

Parameters
entityEntity that was modified
component_type_nameTechnical name of the component type
component_pretty_type_nameHuman-readable name of the component type
property_pathPath to the specific property that changed

Definition at line 366 of file inspectors.cpp.

◆ mark_text_area_as_changed()

void unravel::prefab_override_context::mark_text_area_as_changed ( entt::handle entity)
static

Marks text area as changed in prefab override system.

Parameters
entityEntity whose text area was modified

Definition at line 346 of file inspectors.cpp.

◆ mark_transform_as_changed()

void unravel::prefab_override_context::mark_transform_as_changed ( entt::handle entity,
bool position,
bool rotation,
bool scale,
bool skew )
static

Marks transform properties as changed in prefab override system.

Parameters
entityEntity whose transform was modified
positionWhether position was changed
rotationWhether rotation was changed
scaleWhether scale was changed
skewWhether skew was changed

Definition at line 288 of file inspectors.cpp.

◆ mark_transform_global_as_changed()

void unravel::prefab_override_context::mark_transform_global_as_changed ( entt::handle entity,
bool position,
bool rotation,
bool scale,
bool skew )
static

Definition at line 313 of file inspectors.cpp.

◆ pop_segment()

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.

◆ push_segment()

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.

Parameters
segmentTechnical path segment
pretty_segmentHuman-readable path segment

Definition at line 199 of file inspectors.cpp.

◆ record_override()

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.

Returns
true if override was successfully recorded

Definition at line 146 of file inspectors.cpp.

◆ set_component_type()

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.

Parameters
typeTechnical component type name
pretty_typeHuman-readable component type name

Definition at line 188 of file inspectors.cpp.

◆ set_entity_uuid()

void unravel::prefab_override_context::set_entity_uuid ( const hpp::uuid & uuid)

Sets the entity UUID for both path contexts.

Parameters
uuidUUID of the entity being inspected

Definition at line 178 of file inspectors.cpp.

Member Data Documentation

◆ entity

entt::handle unravel::prefab_override_context::entity

The specific entity currently being inspected.

Definition at line 111 of file inspectors.h.

◆ is_active

bool unravel::prefab_override_context::is_active = false

Whether we're currently inspecting a prefab instance.

Definition at line 119 of file inspectors.h.

◆ is_path_overridden_callback

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.

◆ path_context

property_path_context unravel::prefab_override_context::path_context

Current property path context for serialization paths.

Definition at line 104 of file inspectors.h.

◆ prefab_root_entity

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.

◆ prefab_scene

scene unravel::prefab_override_context::prefab_scene {"prefab_diff_scene"}

Temporary scene for prefab comparison operations.

Definition at line 114 of file inspectors.h.

◆ prefab_version

uintptr_t unravel::prefab_override_context::prefab_version {}

Version tracking for prefab changes.

Definition at line 116 of file inspectors.h.

◆ pretty_path_context

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.


The documentation for this struct was generated from the following files: