asge::game::scene::SceneSerializer
Serializes an ecs::Registry's entities to a TOML scene file.
#include <SceneSerializer.hpp>Private Attributes
Public Member Functions
explicit SceneSerializer(filesystem::VirtualFileSystem const &inVfs) noexceptBinds this serializer to the VFS scene asset paths are resolved through.
SceneSerializer(SceneSerializer const &)=defaultSceneSerializer(SceneSerializer &&)=defaultSceneSerializer & operator=(SceneSerializer const &)=defaultSceneSerializer & operator=(SceneSerializer &&)=default~SceneSerializer()=defaultBoolResult Save(ecs::Registry const &inRegistry, filesystem::Path const &inPath, SaveContext *outCtx=nullptr) const noexceptWrites every currently-alive entity in inRegistry to inPath as TOML: one [[entity]] array-of-tables entry per entity, with a subtable for each serializable component it currently has.
outCtx | If non-null, receives each entity's index in the file (m_Ids). |
Ok on success, or the underlying filesystem::WriteText error.
BoolResult Load(ecs::Registry &dstRegistry, str::String const &inVirtualPath, LoadContext *outCtx=nullptr) const noexceptPopulates dstRegistry from a scene file previously written by Save(): one fresh CreateEntity() per [[entity]] block, with every serializable component present re-added via its Serializer.
outCtx | If non-null, receives each file index's new entity (m_Entities) on success. |
Ok on success. On any failure, only the entities this call itself created are rolled back — anything already in dstRegistry before the call is never touched, win or lose.
BoolResult LoadFromFile(ecs::Registry &dstRegistry, filesystem::Path const &inPath, LoadContext *outCtx=nullptr) const noexceptPrivate Member Functions
BoolResult LoadResolved(ecs::Registry &dstRegistry, filesystem::Path const &inPath, LoadContext *outCtx) const noexceptprivate