9#include <hpp/utility.hpp>
21auto json_escape(
const std::string& value) -> std::string
24 out.reserve(value.size() + 8);
67 if(
id.empty() || !scn.registry)
71 if(
auto uuid = hpp::uuid::from_string(
id))
73 auto handle = scn.find_entity_by_uuid(*uuid);
81 const auto integral =
static_cast<entt::entity
>(std::stoul(
id));
82 if(scn.registry->valid(integral))
84 return entt::handle(*scn.registry, integral);
101 return hpp::to_string(
id->id);
103 return std::to_string(entt::to_integral(
entity.entity()));
108 std::vector<std::string> names;
113 hpp::for_each_tuple_type<all_inspectable_components>(
117 if(
entity.all_of<ctype>())
119 auto type = entt::resolve<ctype>();
125 auto type = entt::resolve<script_component>();
141 name = tag_comp->name;
146 math::vec3 position_world{0.0f};
147 math::vec3 rotation_world{0.0f};
148 math::vec3 scale_world{1.0f};
149 math::vec3 position_local{0.0f};
150 math::vec3 rotation_local{0.0f};
151 math::vec3 scale_local{1.0f};
154 active = transform->is_active();
155 position_world = transform->get_position_global();
156 rotation_world = transform->get_rotation_euler_global();
157 scale_world = transform->get_scale_global();
158 position_local = transform->get_position_local();
159 rotation_local = transform->get_rotation_euler_local();
160 scale_local = transform->get_scale_local();
161 if(
auto parent = transform->get_parent())
167 std::string components_json =
"[";
168 for(
size_t i = 0; i < components.size(); ++i)
172 components_json +=
",";
174 components_json += make_json_string(components[i]);
176 components_json +=
"]";
177 std::string children_json =
"[]";
178 if(depth < max_depth)
183 const auto&
children = transform->get_children();
184 for(
size_t i = 0; i <
children.size(); ++i)
188 children_json +=
",";
192 children_json +=
"]";
196 R
"({{"id":{},"name":{},"tag":{},"active":{},"parent_id":{},"position":[{:.6g},{:.6g},{:.6g}],"rotation_euler":[{:.6g},{:.6g},{:.6g}],"scale":[{:.6g},{:.6g},{:.6g}],"position_local":[{:.6g},{:.6g},{:.6g}],"rotation_euler_local":[{:.6g},{:.6g},{:.6g}],"scale_local":[{:.6g},{:.6g},{:.6g}],"components":{},"children":{}}})",
198 make_json_string(name),
199 make_json_string(tag),
200 active ? "true" :
"false",
230 std::stringstream stream;
Class that contains core data for audio listeners. There can only be one instance of it per scene.
auto get_pretty_name(const meta_type &t) -> std::string
auto make_json_string(const std::string &value) -> std::string
auto json_escape(const std::string &value) -> std::string
auto entity_id_string(entt::handle entity) -> std::string
Stable id string for MCP/editor tooling (UUID preferred).
auto find_entity_by_id(scene &scn, const std::string &id) -> entt::handle
Resolve an entity by UUID string or integral entt id.
auto collect_component_pretty_names(entt::handle entity) -> std::vector< std::string >
Component pretty-names present on the entity (inspectable + Script).
auto entity_components_serialized(entt::handle entity) -> std::string
Full associative serialization of serializeable components (scene-file format).
std::tuple< id_component, tag_component, layer_component, prefab_component, prefab_id_component, transform_component, test_component, model_component, animation_component, bone_component, submesh_component, camera_component, volume_component, auto_exposure_component, tonemapping_component, assao_component, bloom_component, fxaa_component, taa_component, ssr_component, ssil_component, light_component, skylight_component, reflection_probe_component, physics_component, character_controller_component, audio_source_component, audio_listener_component, text_component, particle_emitter_component, ui_document_component > all_inspectable_components
auto save_to_stream(std::ostream &stream, entt::const_handle e, const script_component::script_object &obj) -> bool
auto entity_to_summary_json(entt::handle entity, int depth, int max_depth) -> std::string
JSON summary: transform, component pretty-names, optional children.
Component that provides a unique identifier (UUID) for an entity.
Represents a scene in the ACE framework, managing entities and their relationships.
Component that provides a tag (name or label) for an entity.