#pragma once #include "SH_API.h" #include #include #include "ECS_Base/SHECSMacros.h" #include #include namespace YAML { class Emitter; class Node; } namespace SHADE { class SHSceneNode; constexpr const char* ComponentsNode = "Components"; constexpr const char* EntityNameNode = "Name"; constexpr const char* EIDNode = "EID"; constexpr const char* IsActiveNode = "IsActive"; constexpr const char* NumberOfChildrenNode = "NumberOfChildren"; constexpr const char* ScriptsNode = "Scripts"; struct SH_API SHSerialization { static bool SerializeSceneToFile(AssetID const& sceneAssetID); static std::string SerializeSceneToString(); static void SerializeSceneToEmitter(YAML::Emitter& out); static std::string DeserializeSceneFromFile(AssetID const& sceneAssetID) noexcept; static void EmitEntity(SHSceneNode* entityNode, YAML::Emitter& out); static std::string SerializeEntitiesToString(std::vector const& entities) noexcept; static void SerializeEntityToFile(std::filesystem::path const& path); static YAML::Node SerializeEntityToNode(SHSceneNode* sceneNode); static EntityID DeserializeEntitiesFromString(std::string const& data, EntityID const& parentEID = MAX_EID) noexcept; static std::vector GetComponentIDList(YAML::Node const& componentsNode); static void LoadAssetsFromAssetQueue(std::unordered_map& assetQueue); private: static void InitializeEntity(YAML::Node const& entityNode, EntityID const& eid); static constexpr std::string_view NewSceneName = "New Scene"; }; }