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 |
| Loads a scene from a prefab asset.
|
|
void | unload () |
| Unloads the scene, removing all entities.
|
|
auto | instantiate_out (const asset_handle< prefab > &pfb, entt::handle &e) -> bool |
| Instantiates a prefab in the scene.
|
|
auto | instantiate (const asset_handle< prefab > &pfb) -> entt::handle |
|
auto | instantiate (const asset_handle< prefab > &pfb, entt::handle parent) -> 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) -> entt::handle |
| Clones an existing entity in the scene.
|
|
void | clone_entity (entt::handle &clone_to, entt::handle clone_from, bool keep_parent=true) |
|
|
static auto | get_all_scenes () -> const std::vector< scene * > & |
|
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) |
| 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.
|
|
Represents a scene in the ACE framework, managing entities and their relationships.
Definition at line 20 of file scene.h.
◆ scene()
unravel::scene::scene |
( |
const std::string & | tag_name | ) |
|
Constructs a new scene.
Definition at line 124 of file scene.cpp.
◆ ~scene()
unravel::scene::~scene |
( |
| ) |
|
Destroys the scene and cleans up resources.
Definition at line 163 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 ) |
◆ clone_entity() [2/2]
auto unravel::scene::clone_entity |
( |
entt::handle | clone_from, |
|
|
bool | keep_parent = 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 283 of file scene.cpp.
◆ clone_scene()
void unravel::scene::clone_scene |
( |
const scene & | src_scene, |
|
|
scene & | dst_scene ) |
|
static |
Clones the entities from one scene to another.
- Parameters
-
src_scene | The source scene. |
dst_scene | The destination scene. |
Definition at line 293 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 225 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 210 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 304 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 310 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 316 of file scene.cpp.
◆ get_all_scenes()
auto unravel::scene::get_all_scenes |
( |
| ) |
-> const std::vector<scene*>& |
|
static |
◆ instantiate() [1/2]
◆ instantiate() [2/2]
auto unravel::scene::instantiate |
( |
const asset_handle< prefab > & | pfb, |
|
|
entt::handle | parent ) -> entt::handle |
◆ instantiate_out()
auto unravel::scene::instantiate_out |
( |
const asset_handle< prefab > & | pfb, |
|
|
entt::handle & | e ) -> 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 186 of file scene.cpp.
◆ 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 176 of file scene.cpp.
◆ unload()
void unravel::scene::unload |
( |
| ) |
|
Unloads the scene, removing all entities.
Definition at line 169 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 117 of file scene.h.
◆ source
The source prefab asset handle for the scene.
Definition at line 112 of file scene.h.
◆ tag
std::string unravel::scene::tag {} |
The documentation for this struct was generated from the following files:
- C:/Workspace/github/UnravelEngine/UnravelEngine/engine/engine/ecs/scene.h
- C:/Workspace/github/UnravelEngine/UnravelEngine/engine/engine/ecs/scene.cpp