From f0b525fa88e55072edbf096ccbdbd3b6008fb463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diogo=20Mendon=C3=A7a?= Date: Mon, 5 Feb 2024 18:00:03 +0000 Subject: [PATCH] test(reflection): cover comparison --- core/CMakeLists.txt | 294 +++++++++++----------- core/include/cubos/core/ecs/blueprint.hpp | 15 +- core/src/data/ser/json.cpp | 2 +- core/tests/CMakeLists.txt | 107 ++++---- core/tests/reflection/comparison.cpp | 58 +++++ engine/src/scene/bridge.cpp | 48 ++-- 6 files changed, 295 insertions(+), 229 deletions(-) create mode 100644 core/tests/reflection/comparison.cpp diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 3c99508e8..059596977 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -3,9 +3,11 @@ option(WITH_GLFW "With GLFW?" ON) option(WITH_OPENGL "With OpenGL?" ON) -if (WITH_GLFW) - option(GLFW_USE_SUBMODULE "Compile GLFW from source?" ON) -endif () + +if(WITH_GLFW) + option(GLFW_USE_SUBMODULE "Compile GLFW from source?" ON) +endif() + option(WITH_OPENAL "With OpenAL?" ON) option(GLM_USE_SUBMODULE "Compile GLM from source?" ON) @@ -19,158 +21,155 @@ message("# Building core samples: " ${BUILD_CORE_SAMPLES}) message("# Building core tests: " ${BUILD_CORE_TESTS}) # Set core source files - set(CUBOS_CORE_SOURCE - "src/log.cpp" - "src/thread_pool.cpp" - - "src/memory/stream.cpp" - "src/memory/standard_stream.cpp" - "src/memory/buffer_stream.cpp" - "src/memory/any_value.cpp" - "src/memory/any_vector.cpp" - - "src/reflection/type.cpp" - "src/reflection/type_registry.cpp" - "src/reflection/traits/constructible.cpp" - "src/reflection/traits/fields.cpp" - "src/reflection/traits/array.cpp" - "src/reflection/traits/dictionary.cpp" - "src/reflection/traits/string_conversion.cpp" - "src/reflection/traits/nullable.cpp" - "src/reflection/traits/enum.cpp" - "src/reflection/external/primitives.cpp" - "src/reflection/external/cstring.cpp" - "src/reflection/external/string.cpp" - "src/reflection/external/string_view.cpp" - "src/reflection/external/uuid.cpp" - "src/reflection/external/glm.cpp" - - "src/data/old/serializer.cpp" - "src/data/old/deserializer.cpp" - "src/data/old/json_serializer.cpp" - "src/data/old/json_deserializer.cpp" - "src/data/old/binary_serializer.cpp" - "src/data/old/binary_deserializer.cpp" - "src/data/old/package.cpp" - "src/data/old/context.cpp" - - "src/data/fs/file.cpp" - "src/data/fs/file_system.cpp" - "src/data/fs/standard_archive.cpp" - "src/data/fs/embedded_archive.cpp" - "src/data/ser/serializer.cpp" - "src/data/ser/json.cpp" - "src/data/ser/debug.cpp" - "src/data/des/deserializer.cpp" - "src/data/des/json.cpp" - - "src/io/window.cpp" - "src/io/cursor.cpp" - "src/io/glfw_window.hpp" - "src/io/glfw_window.cpp" - "src/io/keyboard.cpp" - "src/io/gamepad.cpp" - - "src/gl/debug.cpp" - "src/gl/render_device.cpp" - "src/gl/ogl_render_device.hpp" - "src/gl/ogl_render_device.cpp" - "src/gl/util.cpp" - - "src/al/audio_device.cpp" - "src/al/oal_audio_device.cpp" - "src/al/oal_audio_device.hpp" - - "src/ecs/entity/entity.cpp" - "src/ecs/entity/hash.cpp" - "src/ecs/entity/archetype_graph.cpp" - "src/ecs/entity/archetype_id.cpp" - "src/ecs/entity/pool.cpp" - - "src/ecs/table/column.cpp" - "src/ecs/table/dense/table.cpp" - "src/ecs/table/dense/registry.cpp" - "src/ecs/table/sparse_relation/id.cpp" - "src/ecs/table/sparse_relation/table.cpp" - "src/ecs/table/sparse_relation/registry.cpp" - "src/ecs/table/tables.cpp" - - "src/ecs/system/access.cpp" - "src/ecs/system/system.cpp" - "src/ecs/system/options.cpp" - "src/ecs/system/dispatcher.cpp" - "src/ecs/system/arguments/commands.cpp" - "src/ecs/system/arguments/query.cpp" - "src/ecs/system/arguments/resources.cpp" - "src/ecs/system/arguments/world.cpp" - - "src/ecs/query/term.cpp" - "src/ecs/query/data.cpp" - "src/ecs/query/filter.cpp" - "src/ecs/query/fetcher.cpp" - "src/ecs/query/opt.cpp" - - "src/ecs/reflection.cpp" - "src/ecs/blueprint.cpp" - "src/ecs/world.cpp" - "src/ecs/command_buffer.cpp" - "src/ecs/types.cpp" - "src/ecs/cubos.cpp" - - "src/geom/box.cpp" - "src/geom/capsule.cpp" + "src/log.cpp" + "src/thread_pool.cpp" + + "src/memory/stream.cpp" + "src/memory/standard_stream.cpp" + "src/memory/buffer_stream.cpp" + "src/memory/any_value.cpp" + "src/memory/any_vector.cpp" + + "src/reflection/type.cpp" + "src/reflection/type_registry.cpp" + "src/reflection/traits/constructible.cpp" + "src/reflection/traits/fields.cpp" + "src/reflection/traits/array.cpp" + "src/reflection/traits/dictionary.cpp" + "src/reflection/traits/string_conversion.cpp" + "src/reflection/traits/nullable.cpp" + "src/reflection/traits/enum.cpp" + "src/reflection/external/primitives.cpp" + "src/reflection/external/cstring.cpp" + "src/reflection/external/string.cpp" + "src/reflection/external/string_view.cpp" + "src/reflection/external/uuid.cpp" + "src/reflection/external/glm.cpp" + + "src/data/old/serializer.cpp" + "src/data/old/deserializer.cpp" + "src/data/old/json_serializer.cpp" + "src/data/old/json_deserializer.cpp" + "src/data/old/binary_serializer.cpp" + "src/data/old/binary_deserializer.cpp" + "src/data/old/package.cpp" + "src/data/old/context.cpp" + + "src/data/fs/file.cpp" + "src/data/fs/file_system.cpp" + "src/data/fs/standard_archive.cpp" + "src/data/fs/embedded_archive.cpp" + "src/data/ser/serializer.cpp" + "src/data/ser/json.cpp" + "src/data/ser/debug.cpp" + "src/data/des/deserializer.cpp" + "src/data/des/json.cpp" + + "src/io/window.cpp" + "src/io/cursor.cpp" + "src/io/glfw_window.hpp" + "src/io/glfw_window.cpp" + "src/io/keyboard.cpp" + "src/io/gamepad.cpp" + + "src/gl/debug.cpp" + "src/gl/render_device.cpp" + "src/gl/ogl_render_device.hpp" + "src/gl/ogl_render_device.cpp" + "src/gl/util.cpp" + + "src/al/audio_device.cpp" + "src/al/oal_audio_device.cpp" + "src/al/oal_audio_device.hpp" + + "src/ecs/entity/entity.cpp" + "src/ecs/entity/hash.cpp" + "src/ecs/entity/archetype_graph.cpp" + "src/ecs/entity/archetype_id.cpp" + "src/ecs/entity/pool.cpp" + + "src/ecs/table/column.cpp" + "src/ecs/table/dense/table.cpp" + "src/ecs/table/dense/registry.cpp" + "src/ecs/table/sparse_relation/id.cpp" + "src/ecs/table/sparse_relation/table.cpp" + "src/ecs/table/sparse_relation/registry.cpp" + "src/ecs/table/tables.cpp" + + "src/ecs/system/access.cpp" + "src/ecs/system/system.cpp" + "src/ecs/system/options.cpp" + "src/ecs/system/dispatcher.cpp" + "src/ecs/system/arguments/commands.cpp" + "src/ecs/system/arguments/query.cpp" + "src/ecs/system/arguments/resources.cpp" + "src/ecs/system/arguments/world.cpp" + + "src/ecs/query/term.cpp" + "src/ecs/query/data.cpp" + "src/ecs/query/filter.cpp" + "src/ecs/query/fetcher.cpp" + "src/ecs/query/opt.cpp" + + "src/ecs/reflection.cpp" + "src/ecs/blueprint.cpp" + "src/ecs/world.cpp" + "src/ecs/command_buffer.cpp" + "src/ecs/types.cpp" + "src/ecs/cubos.cpp" + + "src/geom/box.cpp" + "src/geom/capsule.cpp" ) # Create core library - add_library(cubos-core ${CUBOS_CORE_SOURCE}) target_include_directories(cubos-core PUBLIC "include") target_compile_definitions(cubos-core PUBLIC - -DCUBOS_CORE_ECS_MAX_COMPONENTS=${CUBOS_CORE_ECS_MAX_COMPONENTS} - -DCUBOS_CORE_DISPATCHER_MAX_CONDITIONS=${CUBOS_CORE_DISPATCHER_MAX_CONDITIONS} + -DCUBOS_CORE_ECS_MAX_COMPONENTS=${CUBOS_CORE_ECS_MAX_COMPONENTS} + -DCUBOS_CORE_DISPATCHER_MAX_CONDITIONS=${CUBOS_CORE_DISPATCHER_MAX_CONDITIONS} ) cubos_common_target_options(cubos-core) # Link dependencies +if(WITH_OPENGL) + set(GLAD_SOUURCES_DIR "lib/glad") + add_subdirectory("${GLAD_SOUURCES_DIR}/cmake" glad_cmake SYSTEM) + glad_add_library(glad REPRODUCIBLE API gl:core=3.3) + target_link_libraries(cubos-core PRIVATE glad) + target_compile_definitions(cubos-core PRIVATE WITH_OPENGL) +endif() -if (WITH_OPENGL) - set(GLAD_SOUURCES_DIR "lib/glad") - add_subdirectory("${GLAD_SOUURCES_DIR}/cmake" glad_cmake SYSTEM) - glad_add_library(glad REPRODUCIBLE API gl:core=3.3) - target_link_libraries(cubos-core PRIVATE glad) - target_compile_definitions(cubos-core PRIVATE WITH_OPENGL) -endif () - -if (WITH_GLFW) - if (GLFW_USE_SUBMODULE) - set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) - set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) - set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) - add_subdirectory(lib/glfw) - else () - find_package(glfw3 REQUIRED) - endif () - - target_link_libraries(cubos-core PRIVATE glfw) - target_compile_definitions(cubos-core PRIVATE WITH_GLFW) -endif () - -if (WITH_OPENAL) - set(ALSOFT_UTILS OFF CACHE BOOL "" FORCE) - set(ALSOFT_NO_CONFIG_UTIL OFF CACHE BOOL "" FORCE) - set(ALSOFT_EXAMPLES OFF CACHE BOOL "" FORCE) - add_subdirectory(lib/openal-soft) - target_include_directories(cubos-core PRIVATE lib/openal-soft/include) - target_link_libraries(cubos-core PRIVATE OpenAL) - target_compile_definitions(cubos-core PRIVATE WITH_OPENAL) +if(WITH_GLFW) + if(GLFW_USE_SUBMODULE) + set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) + set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) + set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) + add_subdirectory(lib/glfw) + else() + find_package(glfw3 REQUIRED) + endif() + + target_link_libraries(cubos-core PRIVATE glfw) + target_compile_definitions(cubos-core PRIVATE WITH_GLFW) endif() -if (GLM_USE_SUBMODULE) - add_subdirectory(lib/glm SYSTEM) -else () - find_package(glm REQUIRED) -endif () +if(WITH_OPENAL) + set(ALSOFT_UTILS OFF CACHE BOOL "" FORCE) + set(ALSOFT_NO_CONFIG_UTIL OFF CACHE BOOL "" FORCE) + set(ALSOFT_EXAMPLES OFF CACHE BOOL "" FORCE) + add_subdirectory(lib/openal-soft) + target_include_directories(cubos-core PRIVATE lib/openal-soft/include) + target_link_libraries(cubos-core PRIVATE OpenAL) + target_compile_definitions(cubos-core PRIVATE WITH_OPENAL) +endif() + +if(GLM_USE_SUBMODULE) + add_subdirectory(lib/glm SYSTEM) +else() + find_package(glm REQUIRED) +endif() set(JSON_BuildTests OFF CACHE INTERNAL "") add_subdirectory(lib/json) @@ -186,12 +185,11 @@ target_link_libraries(cubos-core PUBLIC glm::glm nlohmann_json::nlohmann_json ${ target_link_libraries(cubos-core PRIVATE Threads::Threads) # Add core tests - -if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_CORE_TESTS) - add_subdirectory(tests) -endif () +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_CORE_TESTS) + add_subdirectory(tests) +endif() # Add core samples -if (BUILD_CORE_SAMPLES) - add_subdirectory(samples) -endif () +if(BUILD_CORE_SAMPLES) + add_subdirectory(samples) +endif() diff --git a/core/include/cubos/core/ecs/blueprint.hpp b/core/include/cubos/core/ecs/blueprint.hpp index 151193bec..e8d4038a1 100644 --- a/core/include/cubos/core/ecs/blueprint.hpp +++ b/core/include/cubos/core/ecs/blueprint.hpp @@ -162,15 +162,24 @@ namespace cubos::core::ecs template using EntityMap = std::unordered_map; - memory::UnorderedBimap GetEntities() const + /// @brief Gets the map relating entities to their name + /// @return Bimap relating entities and names + memory::UnorderedBimap entities() const { return mBimap; } - memory::TypeMap> GetComponents() const + + /// @brief Gets the map relating types of components to maps of entities to the component values. + /// @return TypeMap of an EntityMap to component values + memory::TypeMap> components() const { return mComponents; } - memory::TypeMap>> GetRelations() const + + /// @brief Gets the map relating types of relations to maps of entities to maps of entities to the component + /// values. + /// @return TypeMap of an EntityMap to another EntityMap to component values + memory::TypeMap>> relations() const { return mRelations; } diff --git a/core/src/data/ser/json.cpp b/core/src/data/ser/json.cpp index f24bca608..0823dae5e 100644 --- a/core/src/data/ser/json.cpp +++ b/core/src/data/ser/json.cpp @@ -96,7 +96,7 @@ bool JSONSerializer::decompose(const Type& type, const void* value) { if (type.get().size() == 1) { - // If there's a single field, read it directly. + // If there's a single field, write it directly. if (!this->write(type.get().begin()->type(), type.get().view(value).begin()->value)) { diff --git a/core/tests/CMakeLists.txt b/core/tests/CMakeLists.txt index 8c2eb6f10..b8fc366c8 100644 --- a/core/tests/CMakeLists.txt +++ b/core/tests/CMakeLists.txt @@ -2,66 +2,67 @@ # Core tests build configuration add_executable( - cubos-core-tests - main.cpp - utils.cpp + cubos-core-tests + main.cpp + utils.cpp - reflection/reflect.cpp - reflection/type.cpp - reflection/type_registry.cpp - reflection/traits/constructible.cpp - reflection/traits/fields.cpp - reflection/traits/nullable.cpp - reflection/traits/enum.cpp - reflection/external/primitives.cpp - reflection/external/cstring.cpp - reflection/external/string.cpp - reflection/external/string_view.cpp - reflection/external/uuid.cpp - reflection/external/glm.cpp - reflection/external/vector.cpp - reflection/external/map.cpp - reflection/external/unordered_map.cpp + reflection/reflect.cpp + reflection/comparison.cpp + reflection/type.cpp + reflection/type_registry.cpp + reflection/traits/constructible.cpp + reflection/traits/fields.cpp + reflection/traits/nullable.cpp + reflection/traits/enum.cpp + reflection/external/primitives.cpp + reflection/external/cstring.cpp + reflection/external/string.cpp + reflection/external/string_view.cpp + reflection/external/uuid.cpp + reflection/external/glm.cpp + reflection/external/vector.cpp + reflection/external/map.cpp + reflection/external/unordered_map.cpp - data/fs/embedded_archive.cpp - data/fs/standard_archive.cpp - data/fs/file_system.cpp - data/ser/debug.cpp - data/ser/json.cpp - data/des/json.cpp - data/context.cpp + data/fs/embedded_archive.cpp + data/fs/standard_archive.cpp + data/fs/file_system.cpp + data/ser/debug.cpp + data/ser/json.cpp + data/des/json.cpp + data/context.cpp - memory/any_value.cpp - memory/any_vector.cpp - memory/function.cpp - memory/type_map.cpp - memory/unordered_bimap.cpp + memory/any_value.cpp + memory/any_vector.cpp + memory/function.cpp + memory/type_map.cpp + memory/unordered_bimap.cpp - ecs/utils.cpp - ecs/cubos.cpp - ecs/world.cpp - ecs/query.cpp - ecs/blueprint.cpp + ecs/utils.cpp + ecs/cubos.cpp + ecs/world.cpp + ecs/query.cpp + ecs/blueprint.cpp - ecs/commands.cpp - ecs/system.cpp - ecs/dispatcher.cpp + ecs/commands.cpp + ecs/system.cpp + ecs/dispatcher.cpp - ecs/utils/expected.cpp - ecs/utils/action.cpp - ecs/types.cpp - ecs/table/dense/table.cpp - ecs/table/sparse_relation/table.cpp - ecs/entity/archetype_graph.cpp - ecs/entity/pool.cpp - ecs/query/data.cpp - ecs/query/term.cpp - ecs/query/filter.cpp - ecs/system/access.cpp - ecs/stress.cpp + ecs/utils/expected.cpp + ecs/utils/action.cpp + ecs/types.cpp + ecs/table/dense/table.cpp + ecs/table/sparse_relation/table.cpp + ecs/entity/archetype_graph.cpp + ecs/entity/pool.cpp + ecs/query/data.cpp + ecs/query/term.cpp + ecs/query/filter.cpp + ecs/system/access.cpp + ecs/stress.cpp - geom/box.cpp - geom/capsule.cpp + geom/box.cpp + geom/capsule.cpp ) target_link_libraries(cubos-core-tests cubos-core doctest::doctest) diff --git a/core/tests/reflection/comparison.cpp b/core/tests/reflection/comparison.cpp new file mode 100644 index 000000000..c9859e8e1 --- /dev/null +++ b/core/tests/reflection/comparison.cpp @@ -0,0 +1,58 @@ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using cubos::core::reflection::compare; +using cubos::core::reflection::FieldsTrait; +using cubos::core::reflection::reflect; +using cubos::core::reflection::Type; + +struct FieldsObject +{ + CUBOS_REFLECT; + int age; + float weight; +}; + +CUBOS_REFLECT_IMPL(FieldsObject) +{ + return Type::create("FieldsObject") + .with(FieldsTrait().withField("age", &FieldsObject::age).withField("weight", &FieldsObject::weight)); +} + +TEST_CASE("reflection::compare") +{ + const auto fo = FieldsObject(1, 0.3f); + const auto foEqual = FieldsObject(1, 0.3f); + const auto foDifferent = FieldsObject(2, 0.3f); + CHECK(compare(fo.reflect(), (void*)&fo, (void*)&foEqual)); + CHECK_FALSE(compare(fo.reflect(), (void*)&fo, (void*)&foDifferent)); + + std::vector> vec = { + std::unordered_map{{1, {1.2, 2.3, 4.5}}, {2, {1.2, 1.3, 4.5}}, {560, {1.2, 2.3, 4.5}}}, + std::unordered_map{{5, {1.2, 2.3, 4.5}}}, + std::unordered_map{{6, {1.2, 2.5, 4.5}}}}; + + std::vector> vecEqual = { + std::unordered_map{{1, {1.2, 2.3, 4.5}}, {2, {1.2, 1.3, 4.5}}, {560, {1.2, 2.3, 4.5}}}, + std::unordered_map{{5, {1.2, 2.3, 4.5}}}, + std::unordered_map{{6, {1.2, 2.5, 4.5}}}}; + + std::vector> vecDiff = { + std::unordered_map{{1, {1.2, 2.31, 4.5}}, {2, {1.2, 1.3, 4.5}}, {560, {1.2, 2.3, 4.5}}}, + std::unordered_map{{5, {1.2, 2.3, 4.5}}}, + std::unordered_map{{6, {1.2, 2.5, 4.5}}}}; + + CHECK(compare(reflect>>(), (void*)&vec, (void*)&vecEqual)); + CHECK_FALSE(compare(reflect>>(), (void*)&vec, (void*)&vecDiff)); +} diff --git a/engine/src/scene/bridge.cpp b/engine/src/scene/bridge.cpp index d11d7e8de..874d2f4a8 100644 --- a/engine/src/scene/bridge.cpp +++ b/engine/src/scene/bridge.cpp @@ -214,8 +214,8 @@ std::tuple&> GetOriginalComponentData( auto scene = assets.read(sceneAsset); if (entityPath.find(".") == std::string::npos) { - auto entity = scene->blueprint.GetEntities().atRight(entityPath); - if (auto components = scene->blueprint.GetComponents().at(componentType); !components.contains(entity)) + auto entity = scene->blueprint.entities().atRight(entityPath); + if (auto components = scene->blueprint.components().at(componentType); !components.contains(entity)) { return {nullptr, sceneAsset}; } @@ -236,13 +236,13 @@ std::tuple&> GetOriginalRelationDat auto scene = assets.read(sceneAsset); if (entityPath.find(".") == std::string::npos) { - auto entity = scene->blueprint.GetEntities().atRight(entityPath); - auto other = scene->blueprint.GetEntities().atRight(otherPath); - if (!scene->blueprint.GetRelations().contains(relationType)) + auto entity = scene->blueprint.entities().atRight(entityPath); + auto other = scene->blueprint.entities().atRight(otherPath); + if (!scene->blueprint.relations().contains(relationType)) { return {"", "", sceneAsset}; } - auto relations = scene->blueprint.GetRelations().at(relationType); + auto relations = scene->blueprint.relations().at(relationType); if (!relations.contains(entity)) { return {"", "", sceneAsset}; @@ -280,12 +280,12 @@ bool SceneBridge::saveToFile(const Assets& assets, const AnyAsset& handle, Strea json.push_back({"imports", importJson}); auto entitiesJson = nlohmann::json::object(); - for (const auto& [entity, name] : scene->blueprint.GetEntities()) + for (const auto& [entity, name] : scene->blueprint.entities()) { if (name.find(".") == std::string::npos) { auto entityJson = nlohmann::json::object(); - for (auto& [type, components] : scene->blueprint.GetComponents()) + for (auto& [type, components] : scene->blueprint.components()) { if (!components.contains(entity)) { @@ -294,7 +294,7 @@ bool SceneBridge::saveToFile(const Assets& assets, const AnyAsset& handle, Strea ser.write(components[entity].type(), components[entity].get()); entityJson.emplace(type->name().c_str(), ser.output()); } - for (auto& [type, relations] : scene->blueprint.GetRelations()) + for (auto& [type, relations] : scene->blueprint.relations()) { if (!relations.contains(entity)) { @@ -303,7 +303,7 @@ bool SceneBridge::saveToFile(const Assets& assets, const AnyAsset& handle, Strea for (auto& [other, relation] : relations[entity]) { ser.write(relation.type(), relation.get()); - entityJson.emplace((type->name() + "@" + scene->blueprint.GetEntities().atLeft(other)).c_str(), + entityJson.emplace((type->name() + "@" + scene->blueprint.entities().atLeft(other)).c_str(), ser.output()); } } @@ -314,7 +314,7 @@ bool SceneBridge::saveToFile(const Assets& assets, const AnyAsset& handle, Strea { bool dirty = false; auto entityJson = nlohmann::json::object(); - for (auto& [type, components] : scene->blueprint.GetComponents()) + for (auto& [type, components] : scene->blueprint.components()) { if (!components.contains(entity)) { @@ -325,9 +325,9 @@ bool SceneBridge::saveToFile(const Assets& assets, const AnyAsset& handle, Strea { auto subScene = assets.read(subHandle); if (cubos::core::reflection::compare(*type, components[entity].get(), - subScene->blueprint.GetComponents() + subScene->blueprint.components() .at(*type) - .at(subScene->blueprint.GetEntities().atRight(entityName)) + .at(subScene->blueprint.entities().atRight(entityName)) .get())) { continue; @@ -337,7 +337,7 @@ bool SceneBridge::saveToFile(const Assets& assets, const AnyAsset& handle, Strea ser.write(components[entity].type(), components[entity].get()); entityJson.emplace(type->name().c_str(), ser.output()); } - for (auto& [type, relations] : scene->blueprint.GetRelations()) + for (auto& [type, relations] : scene->blueprint.relations()) { if (!relations.contains(entity)) { @@ -345,24 +345,24 @@ bool SceneBridge::saveToFile(const Assets& assets, const AnyAsset& handle, Strea } for (auto& [other, relation] : relations[entity]) { - auto [entityName, otherName, subHandle] = GetOriginalRelationData( - assets, handle, name, scene->blueprint.GetEntities().atLeft(other), *type); + auto [entityName, otherName, subHandle] = + GetOriginalRelationData(assets, handle, name, scene->blueprint.entities().atLeft(other), *type); if (!entityName.empty()) { - if (auto subScene = assets.read(subHandle); cubos::core::reflection::compare( - *type, relation.get(), - subScene->blueprint.GetRelations() - .at(*type) - .at(subScene->blueprint.GetEntities().atRight(entityName)) - .at(subScene->blueprint.GetEntities().atRight(otherName)) - .get())) + if (auto subScene = assets.read(subHandle); + cubos::core::reflection::compare(*type, relation.get(), + subScene->blueprint.relations() + .at(*type) + .at(subScene->blueprint.entities().atRight(entityName)) + .at(subScene->blueprint.entities().atRight(otherName)) + .get())) { continue; } } dirty = true; ser.write(relation.type(), relation.get()); - entityJson.emplace((type->name() + "@" + scene->blueprint.GetEntities().atLeft(other)).c_str(), + entityJson.emplace((type->name() + "@" + scene->blueprint.entities().atLeft(other)).c_str(), ser.output()); } }