class

FActorSerializer

Module
Game
Header
#include "Game/ActorSerializer.h"
Namespace
Mowo

Type aliases

AliasDescription
using FMigrateFn = void (*)(uint32_t storedVersion, MDF::MdfNode& actorNode)Rewrites an Actor node written at storedVersion into the shape the class has now — a renamed key, a split field, a changed unit — before any property is read.

Public functions

ReturnsNameDescription
voidRegisterClassVersionAn actor class's own data version, the counterpart of a component's TypeDescriptor version + migrate.
uint32_tGetClassVersion
boolWriteActorWrite actor as an Actor child of entityNode.
AActor*ReadActorRespawn the actor described by entityNode's Actor child into world, adopting backingEntity instead of creating a fresh one.
voidResolveActorReferencesRe-applies the actor references in entityNode once every actor they can name exists.
voidCopyFromArchetypeCopy every supported MPROPERTY value from archetype onto target, up the whole class chain — the same kinds the writer saves, references only when they name another placed actor.
voidCloneActorFromArchetypeOverlay a whole actor: CopyFromArchetype for the actor itself plus each of its same-named / same-class components.
voidWriteObjectPropertiesThe property half of the actor format for an MObject that is not an actor — MSaveGame.
voidReadObjectProperties
voidWriteObjectDeltaThe asset form: only what differs from the class's default object, so a raised class default reaches every asset that never overrode it — the opposite choice from a save.
voidRemapActorReferencesThe world-state journal's half: an ActorState child of entityNode carrying the actor's and its named components' MPROPERTY(SaveGame) fields and, for a Visual Script actor, the value of every declared variable — full values, not a delta, because the overlay lands on the authored level.
boolExtractUnknownActorKeysKeys in entityNode's Actor node that actor's class has no field for — written by a build that has the field — into outCarried (an Actor node with Properties and per-component Component children).
voidMergeUnknownActorKeys
boolWriteObjectPropertyOne property of object in the actor format -- the FULL value, never a delta -- into node, which then carries exactly that key (or child).
boolWriteDefaultObjectPropertyThe same property as the class default holds it: the class default object for an actor, the default object's same-named component for a component placed by the actor's constructor, the component class's own default for one a designer added.
boolPropertyDiffersFromDefaultWhether property differs from that default, by what the writer would save (the delta is empty exactly when the value matches).
boolWriteActorState
boolApplyActorState

Function details

RegisterClassVersion

C++
static void RegisterClassVersion(const std::string& className, uint32_t version, FMigrateFn migrate)

An actor class's own data version, the counterpart of a component's TypeDescriptor version + migrate. The writer stamps _version on the Actor node when it is above 1; the reader migrates an older node in place and counts a newer one, which stops the level from being saved over by a build that could not read it. Unregistered classes are version 1. Registration is by the class's current name; a renamed class keeps its version through the Type redirect.

GetClassVersion

C++
static uint32_t GetClassVersion(const std::string& className)

WriteActor

C++
static bool WriteActor(AActor* actor, MDF::MdfNode& entityNode)

Write actor as an Actor child of entityNode. No-op returning false when the actor has no registered MClass (an unreflected type cannot be respawned by name, so persisting it would silently lose it on load).

ReadActor

C++
static AActor* ReadActor(MWorld& world, EntityID backingEntity, MDF::MdfNode& entityNode)

Respawn the actor described by entityNode's Actor child into world, adopting backingEntity instead of creating a fresh one. Property values are applied BEFORE BeginPlay so component mirrors publish the restored state onto the entity. Returns nullptr when there is no Actor child or the class is no longer registered.

ResolveActorReferences

C++
static void ResolveActorReferences(MWorld& world, AActor* actor, const MDF::MdfNode& entityNode)

Re-applies the actor references in entityNode once every actor they can name exists. ReadActor already resolves the ones it can; a loader that spawns a batch calls this per actor afterwards so an edge to an actor later in the file is not lost. Idempotent.

CopyFromArchetype

C++
static void CopyFromArchetype(MObject* archetype, MObject* target)

Copy every supported MPROPERTY value from archetype onto target, up the whole class chain — the same kinds the writer saves, references only when they name another placed actor. This is what makes spawn a CDO clone rather than a bare construct().

CloneActorFromArchetype

C++
static void CloneActorFromArchetype(AActor* archetype, AActor* target)

Overlay a whole actor: CopyFromArchetype for the actor itself plus each of its same-named / same-class components. Both the CDO-clone spawn path and template (archetype) instancing route through here.

WriteObjectProperties

C++
static void WriteObjectProperties(MObject* object, MDF::MdfNode& node)

The property half of the actor format for an MObject that is not an actor — MSaveGame. Every supported MPROPERTY up the class chain is written as a property of node, the FULL set rather than a delta against the CDO: a save records what the player had, and a patch that raises a class default must not rewrite it.

ReadObjectProperties

C++
static void ReadObjectProperties(MObject* object, const MDF::MdfNode& node)

WriteObjectDelta

C++
static void WriteObjectDelta(MObject* object, MDF::MdfNode& node)

The asset form: only what differs from the class's default object, so a raised class default reaches every asset that never overrode it — the opposite choice from a save. A class with no CDO writes the full set.

RemapActorReferences

C++
static void RemapActorReferences(MDF::MdfNode& entityNode, const std::unordered_map<std::string, std::string>& uuidRemap)

The world-state journal's half: an ActorState child of entityNode carrying the actor's and its named components' MPROPERTY(SaveGame) fields and, for a Visual Script actor, the value of every declared variable — full values, not a delta, because the overlay lands on the authored level. Without it a placed actor's state (an opened door, a looted chest, any Visual Script variable) reverted on every sector reload and every save. False, and nothing written, when there is nothing to keep. A pasted or duplicated set gets fresh entity uuids; its actor references still named the originals, so a copied door pointed at the original's switch instead of the copied one. Rewrites every "actor:<uuid>" and "component:<uuid>/<name>" under entityNode's Actor node whose uuid is a key of uuidRemap (old uuid string -> new); references outside the set keep naming what they named.

ExtractUnknownActorKeys

C++
static bool ExtractUnknownActorKeys(AActor* actor, const MDF::MdfNode& entityNode, MDF::MdfNode& outCarried)

Keys in entityNode's Actor node that actor's class has no field for — written by a build that has the field — into outCarried (an Actor node with Properties and per-component Component children). The loader keeps them only for a document stamped by this engine or a newer one (FContentVersionStamp::CarriesUnknownKeys), and the writer merges them back under what it wrote, so a colleague on the older build no longer strips the newer build's actor fields by saving the level. A class with a Custom field is not carried: its handler's own keys are indistinguishable from unknown ones.

MergeUnknownActorKeys

C++
static void MergeUnknownActorKeys(const MDF::MdfNode& carried, MDF::MdfNode& entityNode)

WriteObjectProperty

C++
static bool WriteObjectProperty(MObject* object, FName property, MDF::MdfNode& node)

One property of object in the actor format -- the FULL value, never a delta -- into node, which then carries exactly that key (or child). The Details panel's undo stores these before/after captures, and ReadObjectProperties applies one back. False when the class chain has no such serializable property.

WriteDefaultObjectProperty

C++
static bool WriteDefaultObjectProperty(MObject* object, FName property, MDF::MdfNode& node)

The same property as the class default holds it: the class default object for an actor, the default object's same-named component for a component placed by the actor's constructor, the component class's own default for one a designer added. False when there is no default to read.

PropertyDiffersFromDefault

C++
static bool PropertyDiffersFromDefault(MObject* object, FName property)

Whether property differs from that default, by what the writer would save (the delta is empty exactly when the value matches). False with no default object to compare to.

WriteActorState

C++
static bool WriteActorState(AActor* actor, MDF::MdfNode& entityNode)

ApplyActorState

C++
static bool ApplyActorState(MWorld& world, AActor* actor, const MDF::MdfNode& entityNode)
Generated from Game/ActorSerializer.h via game.json · Nov 5, 2026Version 1.0.0