Scene
Scene class - contains entities and manages their lifecycle
- Module
- Game
- Header
#include "Scene/Scene.h"- Namespace
Mowo
Type aliases
| Alias | Description |
|---|---|
using FRenderHook = void (*)(Scene& scene, SceneRenderer* renderer, uint32_t cullingMask) |
Constructors
Public functions
| Returns | Name | Description |
|---|---|---|
void | Initialize | Lifecycle |
void | Shutdown | |
void | OnUpdateEditor | New lifecycle API |
void | OnUpdateRuntime | Ticks all systems (= current Update) |
void | OnUpdateSimulation | Ticks Transform + Physics + Animation + RectTransform |
void | OnRender | Draws through the hook the renderer library installs when it loads; a host that never loads it (the dedicated server) has none, and the call does nothing. |
void | SetRenderHook | |
FRenderHook | GetRenderHook | |
void | OnRuntimeStart | Ensures runtime systems present, calls init |
void | OnRuntimeStop | Shuts down runtime-only systems |
void | OnSimulationStart | Adds Physics + Animation only |
void | OnSimulationStop | Removes Physics + Animation |
Scope<Scene> | DeepCopy | Document round-trip (no text) → new Scene; name, path and env carried over |
const std::string& | GetName | Scene metadata |
void | SetName | |
const std::string& | GetPath | |
void | SetPath | |
bool | IsPlayWorld | A play-in-editor world: a disposable copy of an edited document (or a level travelled to from one). |
void | SetPlayWorld | |
void | SetWorldType | What this scene's actor world is for (Editor, PIE, Game). |
EWorldType | GetWorldType | |
void | SetDefaultWorldType | |
GameObject* | CreateGameObject | GameObject management (preferred API) |
GameObject* | GetGameObject | |
GameObject* | FindGameObject | |
std::vector<GameObject*> | FindGameObjectsWithTag | |
GameObject* | FindGameObjectWithTag | |
Entity | CreateEntity | Entity management |
EntityID | DuplicateEntity | |
void | DestroyEntity | |
std::string | ResolveGameModeClass | World Settings at play: the level's game-mode override wins over the project's; KillZ destroys every simulated body or character below the level's kill height and returns how many went. |
size_t | ApplyKillZ | |
Entity | FindEntity | |
std::vector<Entity> | FindEntitiesWithTag | |
std::string | GetEntityName | Entity name access |
const std::string& | GetEntityNameRef | |
void | SetEntityName | |
std::string | GetEntityTag | Entity tag access |
const std::string& | GetEntityTagRef | |
void | SetEntityTag | |
const std::string& | GetEntityFolder | Outliner organizational folder — pure editor metadata: it never affects the transform hierarchy or any runtime system, it only groups rows. |
void | SetEntityFolder | |
uint32_t | GetEntityLayer | Entity layer access (0-31) |
void | SetEntityLayer | |
Entity | FindEntityWithTag | Find first entity with tag (returns invalid entity if not found) |
bool | IsEntityActive | Active state (serialized — inactive entities skipped by systems) |
void | SetEntityActive | |
bool | IsEntityEditorHidden | Editor visibility — UE's bHiddenEd, serialized with the scene as the optional editor_hidden entity property (absent = visible, so every scene authored before this stays readable). |
void | SetEntityEditorHidden | |
bool | IsEntityEditorLocked | Editor selection lock — the Outliner's padlock, kept with the level as the optional editor_locked property the way UE keeps bLockLocation, so a lock an author set survives closing the level. |
void | SetEntityEditorLocked | |
bool | ShouldGatherEntity | Whether a per-entity gather may submit this entity. |
ESceneGatherContext | GetGatherContext | |
void | SetGatherContext | |
std::string | GetEntityPrefabSource | Prefab instance tracking (editor-only) |
void | SetEntityPrefabSource | |
int32_t | GetEntityPrefabSourceIndex | Which entry (PrefabEntityData::index) of the source prefab this instance entity was spawned from. |
void | SetEntityPrefabSourceIndex | |
void | CapturePrefabOverride | Capture the current value of a whole reflected component on a prefab instance as an override — a CDO-delta MDF blob (only properties that differ from the class default) keyed by the component display name. |
void | CapturePrefabOverride | Test/tooling seam: capture against an explicit prefab asset instead of resolving the entity's source path through the AssetManager. |
bool | PropagatePrefabInstance | Re-instantiate a placed prefab instance from its source, then replay its stored overrides — the "propagate a prefab edit to instances" path. |
void | SetParent | Entity hierarchy |
void | RemoveParent | |
Entity | GetParent | |
std::vector<Entity> | GetChildren | |
void | MoveEntityBefore | Reorder entity in the list (for drag&drop reorder in hierarchy) Moves 'toMove' so it appears before 'before' in iteration order. |
World* | GetWorld | |
const World* | GetWorld | |
bool | IsLoaded | Scene state |
bool | IsDirty | |
void | MarkDirty | |
void | ClearDirty | |
SceneEnvironment& | GetEnvironment | Environment settings |
const SceneEnvironment& | GetEnvironment | |
void | EvaluateVolumes | Volume framework EvaluateVolumes is the per-frame hook that walks the scene's VolumeComponents, blends their profiles using cameraPos, and writes the result back into m_environment.postProcess so the existing SceneRenderer read path picks it up unchanged. |
void | ResolveEnvironmentComponents | |
void | InvalidateVolumeBaseline | Forces re-capture of m_environment.postProcess as the baseline on the next EvaluateVolumes call. |
void | RebaseWorldOrigin | Origin rebasing. |
const Vec3& | GetWorldOriginOffset | |
Ref<RefCounted> | GetNavData | Navigation mesh (baked per scene). |
void | SetNavData | |
void | SetFocusHighlightProvider | Focus-highlight provider (plugin seam): the interaction system used to be named here directly; now whoever owns "what entity should the renderer highlight" registers a captureless provider. |
EntityID | ||
EntityID | FindUnboundPlacedNetworkEntity | Replication seam: the scene-placed entity a client-side Spawn packet should ADOPT instead of materializing a fresh ghost. |
uint32_t | AssignPlacedNetworkGuids | Stamp a stable identity on every scene-placed NetworkObject that lacks one, and break any collision an old copy-paste left behind. |
uint32_t | ReleaseAdoptedPlacedNetworkEntities | Hand every scene-placed NetworkObject back to the scene when a session ends. |
FPointCloudAccumulator* | GetOrCreatePointCloudAccumulator | Scanned point clouds. |
FPointCloudAccumulator* | GetPointCloudAccumulator | |
bool | AdoptPointCloudBlob | Replace one entity's cloud from a .mpcl blob the caller already holds. |
bool | SaveToFile | Serialization |
bool | LoadFromFile | |
bool | IsExternalActorMap | True when a save to path splits the level: a .mmap that already is a World package (world settings in the map, one .actor per actor under __ExternalActors__/, FExternalActorFiles), or a new one in a project on the package asset format. |
bool | LoadFromDocument | The second half of LoadFromFile for a document the caller already read and parsed — on a worker, say, since the read and the parse are the part of an open that needs no world. |
const std::string& | GetNewerContentReason | Why SaveToFile will refuse this scene (empty = it will not): the load read content a newer build wrote, and saving would drop what it added. |
void | ReloadBakedGi | Loads <scene>.mgi, the baked GI fallback, into the environment (or clears it). |
std::string | SerializeToMDF | |
bool | DeserializeFromMDF | |
void | SerializeToDocument | Document-level (de)serialization — no text round-trip. |
bool | DeserializeFromDocument | |
void | CapturePlayState | |
bool | RestorePlayState | |
bool | AddComponentByDisplayName | Type-erased component add/remove by reflection display name ("Light", "Terrain", ...). |
bool | RemoveComponentByDisplayName | |
int | MergeEntitiesFromMdf | Additive load: parses a serialized scene and appends its entities to this scene with *fresh* UUIDs (so two additive loads of the same MDF don't collide). |
std::string | SerializeEntityTreeToMdf | Serialize a single entity and all its descendants as a stand-alone MDF fragment. |
EntityID | RestoreEntityTreeFromMdf | Inverse of SerializeEntityTreeToMdf. |
std::string | SerializeEntityStateToMdf | |
bool | ApplyEntityStateFromMdf | |
bool | SerializeEntityTreeToNode | The node forms the world-state journal keeps, so a record stays a node from capture to save to overlay and is never text reparsed per entity. |
EntityID | RestoreEntityTreeFromNode | |
bool | SerializeEntityStateToNode | |
bool | ApplyEntityStateFromNode | |
std::unordered_map<std::string, std::string> | RemapCopiedTrees | Copy/paste and duplicate of a SET of trees (each an EntityTree node from SerializeEntityTreeToNode): one remap across the whole set, so every entity gets a fresh uuid and every parent link and actor or component reference naming another member of the set follows it to the copy. |
void | ResolveActorReferencesInTrees | After every tree of a set is restored: re-resolves the actor references of each restored actor, so an edge to an actor from a later tree of the set lands (a single restore resolves only within its own tree). |
bool | IsEntityRuntimeSpawned | |
bool | IsEntityTransient | Generated content: an entity an editor-time actor made for preview. |
void | SetEntityTransient | |
FWorldStateJournal* | GetWorldStateJournal | |
std::string | SerializePrefabFromEntities | Author a .mdfprefab document from a live actor selection: every given root plus its descendants is written as index/parent_index Entity nodes carrying their reflected components, in the container shape PrefabAsset loads and PrefabInstantiator instantiates. |
void | SetPrefabOverride | Prefab override metadata (editor-only; serialized into the scene file so they survive save/reopen and source-prefab reimport). |
std::string | GetPrefabOverride | |
bool | HasPrefabOverride | |
const std::unordered_map<std::string, std::string>* | GetPrefabOverrides | |
void | ClearPrefabOverrides | |
void | ForEachEntity | Iteration |
void | ForEachRootEntity | Iterate only root entities (no parent) |
void | ForEachGameObject | |
size_t | GetEntityCount | Entity count |
void | PreserveUnknownComponent | Passthrough for content this build cannot represent. |
void | PreserveUnknownActor | |
void | CarryUnknownKeys | Keeps the keys of node that desc does not know for the next save, replacing what was kept for that component before. |
const std::vector<MDF::MdfNode>* | GetPreservedComponents | |
void | UpdateHairStrands | Steps (or, with simulate false, rest-poses) every Hair Strands component's guides and rebuilds its render strands. |
uint32_t | GetHairInstanceCount | |
const FMeshRenderProxyCache& | GetMeshRenderProxies |
Function details
Scene
Scene()Scene
explicit Scene(const std::string& name)~Scene
~Scene()Initialize
void Initialize()Lifecycle
Shutdown
void Shutdown()OnUpdateEditor
void OnUpdateEditor(float dt)New lifecycle API
OnUpdateRuntime
void OnUpdateRuntime(float dt)Ticks all systems (= current Update)
OnUpdateSimulation
void OnUpdateSimulation(float dt)Ticks Transform + Physics + Animation + RectTransform
OnRender
void OnRender(SceneRenderer* renderer, uint32_t cullingMask = 0xFFFFFFFF)Draws through the hook the renderer library installs when it loads; a host that never loads it (the dedicated server) has none, and the call does nothing.
SetRenderHook
static void SetRenderHook(FRenderHook hook)GetRenderHook
static FRenderHook GetRenderHook()OnRuntimeStart
void OnRuntimeStart()Ensures runtime systems present, calls init
OnRuntimeStop
void OnRuntimeStop()Shuts down runtime-only systems
OnSimulationStart
void OnSimulationStart()Adds Physics + Animation only
OnSimulationStop
void OnSimulationStop()Removes Physics + Animation
DeepCopy
Scope<Scene> DeepCopy() constDocument round-trip (no text) → new Scene; name, path and env carried over
GetName
const std::string& GetName() constScene metadata
SetName
void SetName(const std::string& name)GetPath
const std::string& GetPath() constSetPath
void SetPath(const std::string& path)IsPlayWorld
bool IsPlayWorld() constA play-in-editor world: a disposable copy of an edited document (or a level travelled to from one). Travel out of it loads a fresh copy rather than handing the game a scene the editor has open.
SetPlayWorld
void SetPlayWorld(bool playWorld)SetWorldType
void SetWorldType(EWorldType type)What this scene's actor world is for (Editor, PIE, Game). A new scene takes the process default, which the editor sets to Editor at startup, so actors constructed while the level loads already see the right answer; SetPlayWorld makes it PIE, and OnUpdateEditor keeps a non-play scene Editor.
GetWorldType
EWorldType GetWorldType() constSetDefaultWorldType
static void SetDefaultWorldType(EWorldType type)CreateGameObject
GameObject* CreateGameObject(const std::string& name = "")GameObject management (preferred API)
GetGameObject
GameObject* GetGameObject(EntityID id)FindGameObject
GameObject* FindGameObject(const std::string& name) constFindGameObjectsWithTag
std::vector<GameObject*> FindGameObjectsWithTag(const std::string& tag) constFindGameObjectWithTag
GameObject* FindGameObjectWithTag(const std::string& tag) constCreateEntity
Entity CreateEntity(const std::string& name = "")Entity management
DuplicateEntity
EntityID DuplicateEntity(EntityID sourceId)DestroyEntity
void DestroyEntity(Entity entity)ResolveGameModeClass
static std::string ResolveGameModeClass(const Scene* scene, const std::string& projectGameMode)World Settings at play: the level's game-mode override wins over the project's; KillZ destroys every simulated body or character below the level's kill height and returns how many went.
ApplyKillZ
size_t ApplyKillZ()FindEntity
Entity FindEntity(const std::string& name) constFindEntitiesWithTag
std::vector<Entity> FindEntitiesWithTag(const std::string& tag) constGetEntityName
std::string GetEntityName(EntityID id) constEntity name access
GetEntityNameRef
const std::string& GetEntityNameRef(EntityID id) constSetEntityName
void SetEntityName(EntityID id, const std::string& name)GetEntityTag
std::string GetEntityTag(EntityID id) constEntity tag access
GetEntityTagRef
const std::string& GetEntityTagRef(EntityID id) constSetEntityTag
void SetEntityTag(EntityID id, const std::string& tag)GetEntityFolder
const std::string& GetEntityFolder(EntityID id) constOutliner organizational folder — pure editor metadata: it never affects the transform hierarchy or any runtime system, it only groups rows. Serialized with the scene so the layout survives.
SetEntityFolder
void SetEntityFolder(EntityID id, const std::string& folder)GetEntityLayer
uint32_t GetEntityLayer(EntityID id) constEntity layer access (0-31)
SetEntityLayer
void SetEntityLayer(EntityID id, uint32_t layer)FindEntityWithTag
Entity FindEntityWithTag(const std::string& tag) constFind first entity with tag (returns invalid entity if not found)
IsEntityActive
bool IsEntityActive(EntityID id) constActive state (serialized — inactive entities skipped by systems)
SetEntityActive
void SetEntityActive(EntityID id, bool active)IsEntityEditorHidden
bool IsEntityEditorHidden(EntityID id) constEditor visibility — UE's bHiddenEd, serialized with the scene as the optional editor_hidden entity property (absent = visible, so every scene authored before this stays readable). Distinct from bHidden: this is an authoring aid, and Play must never inherit it.
SetEntityEditorHidden
void SetEntityEditorHidden(EntityID id, bool hidden)IsEntityEditorLocked
bool IsEntityEditorLocked(EntityID id) constEditor selection lock — the Outliner's padlock, kept with the level as the optional editor_locked property the way UE keeps bLockLocation, so a lock an author set survives closing the level.
SetEntityEditorLocked
void SetEntityEditorLocked(EntityID id, bool locked)ShouldGatherEntity
static bool ShouldGatherEntity(ESceneGatherContext context, bool editorHidden)Whether a per-entity gather may submit this entity. A designer who hid a wall to reach behind it must not ship a level with a hole, so the flag stops at the editor boundary rather than travelling into PIE, Simulate or the standalone runtime.
GetGatherContext
ESceneGatherContext GetGatherContext() constSetGatherContext
void SetGatherContext(ESceneGatherContext context)GetEntityPrefabSource
std::string GetEntityPrefabSource(EntityID id) constPrefab instance tracking (editor-only)
SetEntityPrefabSource
void SetEntityPrefabSource(EntityID id, const std::string& path)GetEntityPrefabSourceIndex
int32_t GetEntityPrefabSourceIndex(EntityID id) constWhich entry (PrefabEntityData::index) of the source prefab this instance entity was spawned from. -1 = not a prefab instance. PrefabInstantiator stamps it on spawn; the live-link reapply path uses it to line each instance entity back up with its source entry.
SetEntityPrefabSourceIndex
void SetEntityPrefabSourceIndex(EntityID id, int32_t index)CapturePrefabOverride
void CapturePrefabOverride(EntityID id, const std::string& componentDisplayName)Capture the current value of a whole reflected component on a prefab instance as an override — a CDO-delta MDF blob (only properties that differ from the class default) keyed by the component display name. The reapply path re-applies these on top of the source-rebuilt components so local edits survive a prefab edit. Because the blob is a delta, an untouched (default) property is NOT pinned and still tracks the prefab source — this is UE's override-is-a-diff model.
CapturePrefabOverride
void CapturePrefabOverride(EntityID id, const std::string& componentDisplayName, const class PrefabAsset* sourcePrefab)Test/tooling seam: capture against an explicit prefab asset instead of resolving the entity's source path through the AssetManager.
PropagatePrefabInstance
bool PropagatePrefabInstance(EntityID rootId)Re-instantiate a placed prefab instance from its source, then replay its stored overrides — the "propagate a prefab edit to instances" path. rootId must be an instance root (prefabSourcePath set); the source prefab is resolved through the AssetManager. Returns false if the entity isn't an instance or the prefab can't be found.
SetParent
void SetParent(Entity child, Entity parent)Entity hierarchy
RemoveParent
void RemoveParent(Entity child)GetParent
Entity GetParent(Entity entity) constGetChildren
std::vector<Entity> GetChildren(Entity entity) constMoveEntityBefore
void MoveEntityBefore(EntityID toMove, EntityID before)Reorder entity in the list (for drag&drop reorder in hierarchy) Moves 'toMove' so it appears before 'before' in iteration order. If 'before' is INVALID_ENTITY, moves to the end.
GetWorld
World* GetWorld()GetWorld
const World* GetWorld() constIsLoaded
bool IsLoaded() constScene state
IsDirty
bool IsDirty() constMarkDirty
void MarkDirty()ClearDirty
void ClearDirty()GetEnvironment
SceneEnvironment& GetEnvironment()Environment settings
GetEnvironment
const SceneEnvironment& GetEnvironment() constEvaluateVolumes
void EvaluateVolumes(const Vec3& cameraPos)Volume framework EvaluateVolumes is the per-frame hook that walks the scene's VolumeComponents, blends their profiles using cameraPos, and writes the result back into m_environment.postProcess so the existing SceneRenderer read path picks it up unchanged. Baseline handling: on the first call after scene load (or after a PostProcessBaseline reset) the current m_environment.postProcess is captured as the authored baseline. Subsequent frames blend volumes on top of that baseline. To edit the baseline live, disable all volumes (or call InvalidateVolumeBaseline) so the next evaluation captures the inspector's fresh values.
ResolveEnvironmentComponents
void ResolveEnvironmentComponents()InvalidateVolumeBaseline
void InvalidateVolumeBaseline()Forces re-capture of m_environment.postProcess as the baseline on the next EvaluateVolumes call. Editor's Volume inspector triggers this when the user nudges the scene's PP fields directly.
RebaseWorldOrigin
void RebaseWorldOrigin(const Vec3& shift)Origin rebasing. Shifts every ROOT entity transform and the physics mirror (bodies + character controllers, velocities kept) by -shift; children stay relative. Auto-triggered in OnUpdateRuntime when the main camera drifts past wp.RebaseDistance (snapped to wp.RebaseGrid). The accumulated offset maps rebased coordinates back to absolute world space: absolute = local + offset.
GetWorldOriginOffset
const Vec3& GetWorldOriginOffset() constGetNavData
Ref<RefCounted> GetNavData() constNavigation mesh (baked per scene). Null until a bake is done or a pre-baked .navmesh is loaded. NavAgentSystem reads this each tick to plan paths; with no nav mesh it falls back to straight-line steering (Scope A behavior). Opaque: the baked nav asset type lives in the AINavigation plugin, which loads the companion .navmesh on scene attach and pushes it into its nav systems (FNavMeshProvider in the plugin wraps the cast for typed callers). Core stores only the owning reference so scene lifetime keeps the bake alive.
SetNavData
void SetNavData(Ref<RefCounted> data)SetFocusHighlightProvider
static void SetFocusHighlightProvider(EntityID (*provider)(World&))Focus-highlight provider (plugin seam): the interaction system used to be named here directly; now whoever owns "what entity should the renderer highlight" registers a captureless provider. Process-wide.
EntityID
static EntityID (*GetFocusHighlightProvider())(World&)FindUnboundPlacedNetworkEntity
static EntityID FindUnboundPlacedNetworkEntity(World& world, const char* prefabPath, const Vec3& position, uint64_t placedGuid)Replication seam: the scene-placed entity a client-side Spawn packet should ADOPT instead of materializing a fresh ghost. Server and client load the same scene file, so a placed NetworkObject already exists in the client's world when its Spawn arrives — spawning a ghost on top of it is the placed-object double-spawn. placedGuid is the authored identity off the Spawn packet and settles the match on its own when both sides have it. It is 0 for a runtime spawn, a pre-v4 sender, or a scene saved before the stamp existed, and then the match falls back to what shipped before: the authored prefab path plus the nearest pose among still-unbound candidates — which pairs interchangeable twins wrongly once they have moved. Anything already bound to a NetworkId or spawned by a previous packet is never considered. INVALID_ENTITY = no candidate (dynamic spawn — the caller materializes a ghost as before).
AssignPlacedNetworkGuids
uint32_t AssignPlacedNetworkGuids()Stamp a stable identity on every scene-placed NetworkObject that lacks one, and break any collision an old copy-paste left behind. Returns how many entities were changed. Called from the save path so authoring an object is all a designer has to do; exposed because a scene assembled in code (tests, a generator) needs the same guarantee before it is hosted.
ReleaseAdoptedPlacedNetworkEntities
uint32_t ReleaseAdoptedPlacedNetworkEntities()Hand every scene-placed NetworkObject back to the scene when a session ends. networkId and spawnedRemotely are session state written onto an entity the SCENE owns, and nothing else clears them, so a placed twin a join adopted stays marked as somebody's ghost forever. The next join then skips it in FindUnboundPlacedNetworkEntity and materializes a second copy — the double-spawn adoption exists to prevent, returning through leave → rejoin. Runtime-spawned ghosts are left alone: they belong to the session, not the scene, and the reload path already discards them. Returns how many entities were released.
GetOrCreatePointCloudAccumulator
FPointCloudAccumulator* GetOrCreatePointCloudAccumulator(EntityID id, const FPointCloudBudget& budget)Scanned point clouds. The Scene owns the accumulator behind every PointCloudComponent (keyed by entity), exactly so the save path has an owner to flush: SaveToFile writes each cloud's .mpcl companion and records its path on the component before the scene is serialized, and LoadFromFile rebuilds the accumulator from that path — the same shape as the terrain flush and the nav-mesh companion. Game code asks the scene for the accumulator instead of owning one; the component's runtime pointer is a non-owning view of the scene-owned object.
GetPointCloudAccumulator
FPointCloudAccumulator* GetPointCloudAccumulator(EntityID id) constAdoptPointCloudBlob
bool AdoptPointCloudBlob(EntityID id, const uint8_t* bytes, size_t size)Replace one entity's cloud from a .mpcl blob the caller already holds. The save path restores clouds from slot-owned sidecars rather than from the component's authored cloudPath — a saved game must not write back over the scene's shipped scan, and two slots of the same level have to hold two different revealed worlds.
SaveToFile
bool SaveToFile(const std::string& path)Serialization
LoadFromFile
bool LoadFromFile(const std::string& path)IsExternalActorMap
static bool IsExternalActorMap(const std::string& path)True when a save to path splits the level: a .mmap that already is a World package (world settings in the map, one .actor per actor under __ExternalActors__/, FExternalActorFiles), or a new one in a project on the package asset format. A plain .mmap stays one file.
LoadFromDocument
bool LoadFromDocument(const std::string& path, MDF::MdfDocument& doc)The second half of LoadFromFile for a document the caller already read and parsed — on a worker, say, since the read and the parse are the part of an open that needs no world. path is what the scene remembers as its file.
GetNewerContentReason
const std::string& GetNewerContentReason() constWhy SaveToFile will refuse this scene (empty = it will not): the load read content a newer build wrote, and saving would drop what it added.
ReloadBakedGi
void ReloadBakedGi()Loads <scene>.mgi, the baked GI fallback, into the environment (or clears it). LoadFromFile calls it; the editor calls it again after a bake.
SerializeToMDF
std::string SerializeToMDF(ESceneSerializeScope scope = ESceneSerializeScope::Session) constDeserializeFromMDF
bool DeserializeFromMDF(const std::string& mdfStr)SerializeToDocument
void SerializeToDocument(MDF::MdfDocument& outDoc, ESceneSerializeScope scope = ESceneSerializeScope::Session) constDocument-level (de)serialization — no text round-trip. SaveGame and other binary paths compose/consume the scene node directly.
DeserializeFromDocument
bool DeserializeFromDocument(MDF::MdfDocument& doc)CapturePlayState
void CapturePlayState(ScenePlaySnapshot& out) constRestorePlayState
bool RestorePlayState(const ScenePlaySnapshot& snapshot)AddComponentByDisplayName
bool AddComponentByDisplayName(EntityID id, const std::string& displayName)Type-erased component add/remove by reflection display name ("Light", "Terrain", ...). Backs the editor's Add Component menu; the name→type table mirrors the reflected-serialization lists in Scene.cpp until TypeDescriptor grows factory hooks.
RemoveComponentByDisplayName
bool RemoveComponentByDisplayName(EntityID id, const std::string& displayName)MergeEntitiesFromMdf
int MergeEntitiesFromMdf(const std::string& mdfStr)Additive load: parses a serialized scene and appends its entities to this scene with *fresh* UUIDs (so two additive loads of the same MDF don't collide). Environment settings, name, and path are left untouched. Returns the number of entities successfully merged (0 if the MDF failed to parse). Parent links are resolved only within the merged set — cross-scene parenting is not supported.
SerializeEntityTreeToMdf
std::string SerializeEntityTreeToMdf(EntityID rootId) constSerialize a single entity and all its descendants as a stand-alone MDF fragment. Same per-entity encoding as SerializeToMDF — each entity becomes an Entity{} root with its saved UUID, components, and a Relationship sub-node when parented inside the tree. The *outer* parent of the root is intentionally not encoded; callers (undo for delete, copy/paste) restore that link separately.
RestoreEntityTreeFromMdf
EntityID RestoreEntityTreeFromMdf(const std::string& mdfStr, const FWorldStateJournal* skipJournal = nullptr)Inverse of SerializeEntityTreeToMdf. Recreates every entity in the fragment with its *original* UUID (so external references — saved games, replication ghosts, sibling Constraints — keep resolving), restores their components, and rewires parent links within the tree. Returns the root entity id on success or INVALID_ENTITY on parse/restore failure. Existing entities with colliding UUIDs are skipped — undo never silently merges over a live entity.
SerializeEntityStateToMdf
std::string SerializeEntityStateToMdf(EntityID id, bool includeTransform = true, bool includeComponents = true) constApplyEntityStateFromMdf
bool ApplyEntityStateFromMdf(EntityID id, const std::string& mdfStr)SerializeEntityTreeToNode
bool SerializeEntityTreeToNode(EntityID rootId, MDF::MdfNode& outTree) constThe node forms the world-state journal keeps, so a record stays a node from capture to save to overlay and is never text reparsed per entity. The tree form fills an EntityTree node, the state form one Entity.
RestoreEntityTreeFromNode
EntityID RestoreEntityTreeFromNode(const MDF::MdfNode& tree, const FWorldStateJournal* skipJournal = nullptr)SerializeEntityStateToNode
bool SerializeEntityStateToNode(EntityID id, bool includeTransform, bool includeComponents, MDF::MdfNode& outEntity) constApplyEntityStateFromNode
bool ApplyEntityStateFromNode(EntityID id, const MDF::MdfNode& entityNode)RemapCopiedTrees
static std::unordered_map<std::string, std::string> RemapCopiedTrees(const std::vector<MDF::MdfNode*>& trees)Copy/paste and duplicate of a SET of trees (each an EntityTree node from SerializeEntityTreeToNode): one remap across the whole set, so every entity gets a fresh uuid and every parent link and actor or component reference naming another member of the set follows it to the copy. Pasting the trees one by one gave each its own remap, and a copy kept pointing at the original of anything copied beside it. Returns old uuid string -> new.
ResolveActorReferencesInTrees
void ResolveActorReferencesInTrees(const std::vector<const MDF::MdfNode*>& trees)After every tree of a set is restored: re-resolves the actor references of each restored actor, so an edge to an actor from a later tree of the set lands (a single restore resolves only within its own tree).
IsEntityRuntimeSpawned
bool IsEntityRuntimeSpawned(EntityID id) constIsEntityTransient
bool IsEntityTransient(EntityID id) constGenerated content: an entity an editor-time actor made for preview. It is left out of every serialization (the level file, the Play copy, save games) and hidden from the Outliner by default. An actor's own transient flag counts too, and so does a transient parent. Neither call touches the dirty state.
SetEntityTransient
void SetEntityTransient(EntityID id, bool transient)GetWorldStateJournal
FWorldStateJournal* GetWorldStateJournal() constSerializePrefabFromEntities
std::string SerializePrefabFromEntities(const std::vector<EntityID>& roots, const std::string& prefabName, std::unordered_map<EntityID, int32_t>* outIndices = nullptr, const std::string& selfSourcePath = {}) constAuthor a .mdfprefab document from a live actor selection: every given root plus its descendants is written as index/parent_index Entity nodes carrying their reflected components, in the container shape PrefabAsset loads and PrefabInstantiator instantiates. A single selected root becomes the prefab root; multiple roots are collected under a synthesized group entity at the origin so the result is always single-rooted. Returns the MDF text (empty on failure). outIndices (optional) receives the entry index assigned to each serialized entity — the caller that overwrites an existing .mdfprefab needs it to restamp the instance's prefabSourceIndex values so a later propagation pairs entities with the right entries (the serializer numbers entries fresh each time). selfSourcePath: the prefab file this serialization will overwrite. Instantiated members are stamped with their source path, so without it an instance's own children read as nested instances and get written as nested_prefab references to the very file being rewritten — the instantiator's cycle guard then refuses them and the applied prefab silently loses every child. Pass empty when authoring a NEW prefab (a stamped child there is a genuinely foreign nested instance).
SetPrefabOverride
void SetPrefabOverride(EntityID id, const std::string& key, const std::string& value)Prefab override metadata (editor-only; serialized into the scene file so they survive save/reopen and source-prefab reimport). Stored as opaque MDF-string key/value pairs — the inspector encodes "Transform.position.x" → "5.0" and decodes them on apply.
GetPrefabOverride
std::string GetPrefabOverride(EntityID id, const std::string& key) constHasPrefabOverride
bool HasPrefabOverride(EntityID id, const std::string& key) constGetPrefabOverrides
const std::unordered_map<std::string, std::string>* GetPrefabOverrides(EntityID id) constClearPrefabOverrides
void ClearPrefabOverrides(EntityID id)ForEachEntity
template<typename Func> void ForEachEntity(Func&& func)Iteration
ForEachRootEntity
template<typename Func> void ForEachRootEntity(Func&& func)Iterate only root entities (no parent)
ForEachGameObject
template<typename Func> void ForEachGameObject(Func&& func)GetEntityCount
size_t GetEntityCount() constEntity count
PreserveUnknownComponent
void PreserveUnknownComponent(EntityID id, const MDF::MdfNode& node)Passthrough for content this build cannot represent. Both are replace-by-identity so a repeated prefab reapply cannot stack duplicates onto the same entity.
PreserveUnknownActor
void PreserveUnknownActor(EntityID id, const MDF::MdfNode& node)CarryUnknownKeys
void CarryUnknownKeys(EntityID id, const TypeDescriptor& desc, const MDF::MdfNode& node)Keeps the keys of node that desc does not know for the next save, replacing what was kept for that component before.
GetPreservedComponents
const std::vector<MDF::MdfNode>* GetPreservedComponents(EntityID id) constUpdateHairStrands
void UpdateHairStrands(float dt, bool simulate)Steps (or, with simulate false, rest-poses) every Hair Strands component's guides and rebuilds its render strands. The runtime and simulate ticks call it with dynamics on, the editor tick with them off.
GetHairInstanceCount
uint32_t GetHairInstanceCount() constGetMeshRenderProxies
const FMeshRenderProxyCache& GetMeshRenderProxies() const