Unravel Engine C++ Reference
Loading...
Searching...
No Matches
unravel::prefab_component Struct Reference

Component that holds a reference to a prefab asset and tracks property overrides. More...

#include <prefab_component.h>

Inheritance diagram for unravel::prefab_component:
unravel::component_crtp< prefab_component, owned_component > unravel::owned_component unravel::basic_component

Public Member Functions

void clear_overrides ()
 Clear all overrides (for applying all changes to prefab)
 
void add_override (const hpp::uuid &entity_uuid, const std::string &component_path)
 Add a property override.
 
void add_override (const hpp::uuid &entity_uuid, const std::string &component_path, const std::string &pretty_component_path)
 Add a property override with pretty path.
 
auto has_override (const hpp::uuid &entity_uuid, const std::string &component_path) const -> bool
 Check if a property is overridden.
 
void remove_override (const hpp::uuid &entity_uuid, const std::string &component_path)
 Remove a property override.
 
void remove_entity (const hpp::uuid &entity_uuid)
 Remove an entity from the prefab.
 
auto get_all_overrides () const -> const std::set< prefab_property_ override _data > &
 Get all overrides.
 
auto has_serialization_override (const std::string &serialization_path) const -> bool
 Check if a serialization path has an override (for backward compatibility)
 
- Public Member Functions inherited from unravel::owned_component
auto operator= (const owned_component &other) -> owned_component &=default
 
void set_owner (entt::handle owner)
 Sets the owner of the component.
 
auto get_owner () const noexcept -> entt::const_handle
 Gets the owner of the component.
 
auto get_owner () noexcept -> entt::handle
 Gets the owner of the component.
 
- Public Member Functions inherited from unravel::basic_component
void touch ()
 Marks the component as 'touched'.
 

Public Attributes

asset_handle< prefabsource
 Handle to the prefab asset.
 
std::set< prefab_property_override_dataproperty_overrides
 Storage of property overrides Each override is identified by entity UUID + component path This allows entity renaming without invalidating overrides.
 
std::set< hpp::uuid > removed_entities
 
bool changed = false
 
- Public Attributes inherited from unravel::basic_component
bool eto {}
 Disable empty type optimizations.
 

Static Public Attributes

static constexpr bool in_place_delete = false
 
- Static Public Attributes inherited from unravel::component_crtp< prefab_component, owned_component >
static constexpr bool in_place_delete
 Indicates if the component can be deleted in place.
 

Additional Inherited Members

- Public Types inherited from unravel::component_crtp< prefab_component, owned_component >
using base
 
- Static Public Member Functions inherited from unravel::owned_component
template<typename T >
static void on_create_component (entt::registry &r, entt::entity e)
 
template<typename T >
static void on_destroy_component (entt::registry &r, entt::entity e)
 

Detailed Description

Component that holds a reference to a prefab asset and tracks property overrides.

Definition at line 36 of file prefab_component.h.

Member Function Documentation

◆ add_override() [1/2]

void unravel::prefab_component::add_override ( const hpp::uuid & entity_uuid,
const std::string & component_path )

Add a property override.

Parameters
entity_uuidThe UUID of the entity being overridden
component_pathThe component type + property path

Definition at line 42 of file prefab_component.cpp.

◆ add_override() [2/2]

void unravel::prefab_component::add_override ( const hpp::uuid & entity_uuid,
const std::string & component_path,
const std::string & pretty_component_path )

Add a property override with pretty path.

Parameters
entity_uuidThe UUID of the entity being overridden
component_pathThe component type + property path
pretty_component_pathThe human-readable component path

Definition at line 47 of file prefab_component.cpp.

◆ clear_overrides()

void unravel::prefab_component::clear_overrides ( )

Clear all overrides (for applying all changes to prefab)

Definition at line 36 of file prefab_component.cpp.

◆ get_all_overrides()

auto unravel::prefab_component::get_all_overrides ( ) const & -> const std::set<prefab_property_
override

Get all overrides.

Returns
Set of all property overrides

Definition at line 120 of file prefab_component.cpp.

◆ has_override()

auto unravel::prefab_component::has_override ( const hpp::uuid & entity_uuid,
const std::string & component_path ) const -> bool

Check if a property is overridden.

Parameters
entity_uuidThe UUID of the entity
component_pathThe component type + property path
Returns
True if the property is overridden

Definition at line 95 of file prefab_component.cpp.

◆ has_serialization_override()

auto unravel::prefab_component::has_serialization_override ( const std::string & serialization_path) const -> bool

Check if a serialization path has an override (for backward compatibility)

Parameters
serialization_pathThe path in format "entities/uuid/components/component/path"
Returns
True if the path is overridden

Definition at line 125 of file prefab_component.cpp.

◆ remove_entity()

void unravel::prefab_component::remove_entity ( const hpp::uuid & entity_uuid)

Remove an entity from the prefab.

Parameters
entity_uuidThe UUID of the entity

Definition at line 105 of file prefab_component.cpp.

◆ remove_override()

void unravel::prefab_component::remove_override ( const hpp::uuid & entity_uuid,
const std::string & component_path )

Remove a property override.

Parameters
entity_uuidThe UUID of the entity
component_pathThe component type + property path

Definition at line 100 of file prefab_component.cpp.

Member Data Documentation

◆ changed

bool unravel::prefab_component::changed = false

Definition at line 54 of file prefab_component.h.

◆ in_place_delete

bool unravel::prefab_component::in_place_delete = false
staticconstexpr

Definition at line 38 of file prefab_component.h.

◆ property_overrides

std::set<prefab_property_override_data> unravel::prefab_component::property_overrides

Storage of property overrides Each override is identified by entity UUID + component path This allows entity renaming without invalidating overrides.

Definition at line 50 of file prefab_component.h.

◆ removed_entities

std::set<hpp::uuid> unravel::prefab_component::removed_entities

Definition at line 52 of file prefab_component.h.

◆ source

asset_handle<prefab> unravel::prefab_component::source

Handle to the prefab asset.

Definition at line 43 of file prefab_component.h.


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