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
| Type | Name | Description |
|---|---|---|
static constexpr uint32_t | kSerializedVersion | Persistence. 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
| Returns | Name | Description |
|---|---|---|
void | Init | |
bool | IsValid | |
uint32_t | GetWidth | |
uint32_t | GetHeight | |
const FEditableHeightfield& | GetBase | |
bool | SetBase | Replaces the unlayered floor without disturbing the stack — an import, a procedural regenerate or an offline erosion pass writes here. |
int32_t | GetLayerCount | |
FTerrainEditLayer* | GetLayer | |
const FTerrainEditLayer* | GetLayer | |
int32_t | AddLayer | |
bool | RemoveLayer | |
bool | MoveLayer | |
int32_t | GetActiveLayer | |
bool | SetActiveLayer | |
void | BeginOp | Op capture. |
bool | EndOp | |
void | Composite | Recomputes out from base + visible layers over region (empty = all). |
void | CollapseToBase | Drops every layer's contribution into the base and empties the stack — the "Flatten Layers" command. |
bool | Serialize | |
bool | Deserialize |
Function details
Init
void Init(const FEditableHeightfield& base)IsValid
bool IsValid() constGetWidth
uint32_t GetWidth() constGetHeight
uint32_t GetHeight() constGetBase
const FEditableHeightfield& GetBase() constSetBase
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
int32_t GetLayerCount() constGetLayer
FTerrainEditLayer* GetLayer(int32_t index)GetLayer
const FTerrainEditLayer* GetLayer(int32_t index) constAddLayer
int32_t AddLayer(const std::string& name)RemoveLayer
bool RemoveLayer(int32_t index)MoveLayer
bool MoveLayer(int32_t from, int32_t to)GetActiveLayer
int32_t GetActiveLayer() constSetActiveLayer
bool SetActiveLayer(int32_t index)BeginOp
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
bool EndOp(FEditableHeightfield& composite, const FTerrainTexelRegion& region)Composite
void Composite(FEditableHeightfield& out, const FTerrainTexelRegion& region) constRecomputes out from base + visible layers over region (empty = all).
CollapseToBase
void CollapseToBase(FEditableHeightfield& composite)Drops every layer's contribution into the base and empties the stack — the "Flatten Layers" command.
Serialize
bool Serialize(std::vector<uint8_t>& out) constDeserialize
bool Deserialize(const void* data, size_t size)