class

FTerrainEditLayerStack

The stack behind every height edit. Ops still run on a plain composited FEditableHeightfield — nothing downstream (mesh build, collision, GPU upload) knows layers exist — but the difference an op made is folded into the ACTIVE layer, so hiding that layer restores the terrain underneath it exactly instead of leaving a baked-in dent.

Module
Game
Header
#include "Terrain/TerrainEditLayers.h"
Namespace
Mowo

Properties

TypeNameDescription
static constexpr uint32_tkSerializedVersionPersistence. The stack is what makes a sculpt non-destructive, so a scene that stores only the composite heightmap has already thrown the authoring away — the whole stack, BASE INCLUDED, goes into one blob so a reload can recompute composite == base + visible layers instead of trusting the flattened file it also wrote. Planes are raw little-endian float32 and uint8: exactness beats size here, because a quantized delta would drift the composite away from the heightmap saved next to it. Default 1.

Public functions

ReturnsNameDescription
voidInit
boolIsValid
uint32_tGetWidth
uint32_tGetHeight
const FEditableHeightfield&GetBase
boolSetBaseReplaces the unlayered floor without disturbing the stack — an import, a procedural regenerate or an offline erosion pass writes here.
int32_tGetLayerCount
FTerrainEditLayer*GetLayer
const FTerrainEditLayer*GetLayer
int32_tAddLayer
boolRemoveLayer
boolMoveLayer
int32_tGetActiveLayer
boolSetActiveLayer
voidBeginOpOp capture.
boolEndOp
voidCompositeRecomputes out from base + visible layers over region (empty = all).
voidCollapseToBaseDrops every layer's contribution into the base and empties the stack — the "Flatten Layers" command.
boolSerialize
boolDeserialize

Function details

Init

C++
void Init(const FEditableHeightfield& base)

IsValid

C++
bool IsValid() const

GetWidth

C++
uint32_t GetWidth() const

GetHeight

C++
uint32_t GetHeight() const

GetBase

C++
const FEditableHeightfield& GetBase() const

SetBase

C++
bool SetBase(const FEditableHeightfield& base)

Replaces the unlayered floor without disturbing the stack — an import, a procedural regenerate or an offline erosion pass writes here.

GetLayerCount

C++
int32_t GetLayerCount() const

GetLayer

C++
FTerrainEditLayer* GetLayer(int32_t index)

GetLayer

C++
const FTerrainEditLayer* GetLayer(int32_t index) const

AddLayer

C++
int32_t AddLayer(const std::string& name)

RemoveLayer

C++
bool RemoveLayer(int32_t index)

MoveLayer

C++
bool MoveLayer(int32_t from, int32_t to)

GetActiveLayer

C++
int32_t GetActiveLayer() const

SetActiveLayer

C++
bool SetActiveLayer(int32_t index)

BeginOp

C++
void BeginOp(const FEditableHeightfield& composite, const FTerrainTexelRegion& region)

Op capture. BeginOp snapshots the composite over the window the op is about to touch; EndOp folds (after - before) into the active layer and re-composites, so the field the caller holds always equals base + visible layers and never drifts from it.

EndOp

C++
bool EndOp(FEditableHeightfield& composite, const FTerrainTexelRegion& region)

Composite

C++
void Composite(FEditableHeightfield& out, const FTerrainTexelRegion& region) const

Recomputes out from base + visible layers over region (empty = all).

CollapseToBase

C++
void CollapseToBase(FEditableHeightfield& composite)

Drops every layer's contribution into the base and empties the stack — the "Flatten Layers" command.

Serialize

C++
bool Serialize(std::vector<uint8_t>& out) const

Deserialize

C++
bool Deserialize(const void* data, size_t size)
Generated from Terrain/TerrainEditLayers.h via game.json · Nov 5, 2026Version 1.0.0