Represents a scene in the ACE framework, managing entities and their relationships.
More...
#include <scene.h>
|
| | scene (const std::string &tag_name) |
| | Constructs a new scene.
|
| |
| | ~scene () |
| | Destroys the scene and cleans up resources.
|
| |
| auto | load_from (const asset_handle< scene_prefab > &pfb, bool call_callbacks=true) -> bool |
| | Loads a scene from a prefab asset.
|
| |
| void | reload (bool call_callbacks=true) |
| | Reloads the scene from the source prefab asset.
|
| |
| void | unload () |
| | Unloads the scene, removing all entities.
|
| |
| auto | instantiate_out (const asset_handle< prefab > &pfb, entt::handle &, bool call_callbacks=true) -> bool |
| | Instantiates a prefab in the scene.
|
| |
| auto | instantiate (const asset_handle< prefab > &pfb, bool call_callbacks=true) -> entt::handle |
| |
| auto | instantiate (const asset_handle< prefab > &pfb, entt::handle parent, bool call_callbacks=true) -> entt::handle |
| |
| void | clear_entity (entt::handle &handle) |
| |
| auto | create_handle (entt::entity e) -> entt::handle |
| | Creates an entity in the scene.
|
| |
| auto | create_handle (entt::entity e) const -> entt::const_handle |
| | Creates an entity in the scene (const version).
|
| |
| auto | create_entity (const std::string &tag={}, entt::handle parent={}) -> entt::handle |
| | Creates an entity in the scene with an optional tag and parent.
|
| |
| auto | clone_entity (entt::handle clone_from, bool keep_parent=true, bool call_callbacks=true) -> entt::handle |
| | Clones an existing entity in the scene.
|
| |
| void | clone_entity (entt::handle &clone_to, entt::handle clone_from, bool keep_parent=true, bool call_callbacks=true) |
| |
| auto | find_entity_by_uuid (const hpp::uuid &target_uuid) const -> entt::handle |
| | Finds an entity by UUID in the scene.
|
| |
|
| static auto | get_all_scenes () -> const std::vector< scene * > & |
| |
| static auto | instantiate_out (entt::registry ®, const asset_handle< prefab > &pfb, entt::handle &, bool call_callbacks=true) -> bool |
| |
| static auto | create_entity (entt::registry &r, const std::string &name={}, entt::handle parent={}) -> entt::handle |
| | Creates an entity in the specified registry with an optional name and parent.
|
| |
| static void | clone_scene (const scene &src_scene, scene &dst_scene, bool call_callbacks=true) |
| | Clones the entities from one scene to another.
|
| |
| static auto | find_entity_by_prefab_uuid (entt::handle root_entity, const hpp::uuid &target_uuid) -> entt::handle |
| | Finds an entity by UUID in the scene.
|
| |
| static auto | get_scene (entt::handle entity) -> scene * |
| | Gets the scene from an entity handle.
|
| |
Represents a scene in the ACE framework, managing entities and their relationships.
Definition at line 69 of file scene.h.
◆ scene()
| unravel::scene::scene |
( |
const std::string & | tag_name | ) |
|
Constructs a new scene.
Definition at line 148 of file scene.cpp.
◆ ~scene()
| unravel::scene::~scene |
( |
| ) |
|
Destroys the scene and cleans up resources.
Definition at line 194 of file scene.cpp.
◆ clear_entity()
| void unravel::scene::clear_entity |
( |
entt::handle & | handle | ) |
|
◆ clone_entity() [1/2]
| void unravel::scene::clone_entity |
( |
entt::handle & | clone_to, |
|
|
entt::handle | clone_from, |
|
|
bool | keep_parent = true, |
|
|
bool | call_callbacks = true ) |
◆ clone_entity() [2/2]
| auto unravel::scene::clone_entity |
( |
entt::handle | clone_from, |
|
|
bool | keep_parent = true, |
|
|
bool | call_callbacks = true ) -> entt::handle |
Clones an existing entity in the scene.
- Parameters
-
| e | The handle to the entity to clone. |
| keep_parent | Whether to keep the parent relationship. |
- Returns
- A handle to the cloned entity.
Definition at line 398 of file scene.cpp.
◆ clone_scene()
| void unravel::scene::clone_scene |
( |
const scene & | src_scene, |
|
|
scene & | dst_scene, |
|
|
bool | call_callbacks = true ) |
|
static |
Clones the entities from one scene to another.
- Parameters
-
| src_scene | The source scene. |
| dst_scene | The destination scene. |
Definition at line 408 of file scene.cpp.
◆ create_entity() [1/2]
| auto unravel::scene::create_entity |
( |
const std::string & | tag = {}, |
|
|
entt::handle | parent = {} ) -> entt::handle |
Creates an entity in the scene with an optional tag and parent.
- Parameters
-
| tag | The tag for the entity. |
| parent | The parent entity handle. |
- Returns
- A handle to the created entity.
Definition at line 360 of file scene.cpp.
◆ create_entity() [2/2]
| auto unravel::scene::create_entity |
( |
entt::registry & | r, |
|
|
const std::string & | name = {}, |
|
|
entt::handle | parent = {} ) -> entt::handle |
|
static |
Creates an entity in the specified registry with an optional name and parent.
- Parameters
-
| r | The registry to create the entity in. |
| name | The name for the entity. |
| parent | The parent entity handle. |
- Returns
- A handle to the created entity.
Definition at line 305 of file scene.cpp.
◆ create_handle() [1/2]
| auto unravel::scene::create_handle |
( |
entt::entity | e | ) |
-> entt::handle |
Creates an entity in the scene.
- Parameters
-
- Returns
- A handle to the created entity.
Definition at line 428 of file scene.cpp.
◆ create_handle() [2/2]
| auto unravel::scene::create_handle |
( |
entt::entity | e | ) |
const -> entt::const_handle |
Creates an entity in the scene (const version).
- Parameters
-
- Returns
- A constant handle to the created entity.
Definition at line 434 of file scene.cpp.
◆ find_entity_by_prefab_uuid()
| auto unravel::scene::find_entity_by_prefab_uuid |
( |
entt::handle | root_entity, |
|
|
const hpp::uuid & | target_uuid ) -> entt::handle |
|
static |
Finds an entity by UUID in the scene.
- Parameters
-
| uuid | The UUID of the entity to find. |
- Returns
- The entity handle if found, otherwise an empty handle.
Definition at line 440 of file scene.cpp.
◆ find_entity_by_uuid()
| auto unravel::scene::find_entity_by_uuid |
( |
const hpp::uuid & | target_uuid | ) |
const -> entt::handle |
Finds an entity by UUID in the scene.
- Parameters
-
| uuid | The UUID of the entity to find. |
- Returns
- The entity handle if found, otherwise an empty handle.
Definition at line 338 of file scene.cpp.
◆ get_all_scenes()
| auto unravel::scene::get_all_scenes |
( |
| ) |
-> const std::vector<scene*>& |
|
static |
◆ get_scene()
| auto unravel::scene::get_scene |
( |
entt::handle | entity | ) |
-> scene* |
|
static |
Gets the scene from an entity handle.
- Parameters
-
- Returns
- The scene if found, otherwise nullptr.
Definition at line 343 of file scene.cpp.
◆ instantiate() [1/2]
| auto unravel::scene::instantiate |
( |
const asset_handle< prefab > & | pfb, |
|
|
bool | call_callbacks = true ) -> entt::handle |
◆ instantiate() [2/2]
| auto unravel::scene::instantiate |
( |
const asset_handle< prefab > & | pfb, |
|
|
entt::handle | parent, |
|
|
bool | call_callbacks = true ) -> entt::handle |
◆ instantiate_out() [1/2]
| auto unravel::scene::instantiate_out |
( |
const asset_handle< prefab > & | pfb, |
|
|
entt::handle & | e, |
|
|
bool | call_callbacks = true ) -> bool |
Instantiates a prefab in the scene.
- Parameters
-
| pfb | The asset handle to the prefab. |
- Returns
- A handle to the instantiated entity.
Definition at line 238 of file scene.cpp.
◆ instantiate_out() [2/2]
| auto unravel::scene::instantiate_out |
( |
entt::registry & | reg, |
|
|
const asset_handle< prefab > & | pfb, |
|
|
entt::handle & | e, |
|
|
bool | call_callbacks = true ) -> bool |
|
static |
◆ load_from()
Loads a scene from a prefab asset.
- Parameters
-
| pfb | The asset handle to the scene prefab. |
- Returns
- True if the scene was loaded successfully, false otherwise.
Definition at line 219 of file scene.cpp.
◆ reload()
| void unravel::scene::reload |
( |
bool | call_callbacks = true | ) |
|
Reloads the scene from the source prefab asset.
- Parameters
-
| call_callbacks | Whether to call the load callbacks. |
Definition at line 208 of file scene.cpp.
◆ unload()
| void unravel::scene::unload |
( |
| ) |
|
Unloads the scene, removing all entities.
Definition at line 200 of file scene.cpp.
◆ registry
| std::unique_ptr<entt::registry> unravel::scene::registry {} |
The registry that manages all entities in the scene.
Definition at line 187 of file scene.h.
◆ source
The source prefab asset handle for the scene.
Definition at line 182 of file scene.h.
◆ tag
| std::string unravel::scene::tag {} |
The documentation for this struct was generated from the following files: