Skip to content

Class

TerrainSaveData

Generated GDScript class reference for GridPlacement.TerrainSaveData.

Status
Current
Version
v6.2.1
Source updated
2026-09-24
Generated on
2026-10-22

Resource holding serialized terrain cell data for a TileMapLayer. Each entry in terrain_cells records one painted cell: {"x": int, "y": int, "terrain_set": int, "terrain": int, "layer": String (optional)} The on-disk shape is the dictionary form for backward compatibility with saves produced by . New save/load helpers in TerrainPersistence convert between the dictionary wire shape and the typed TerrainCellRecord view used at runtime. Usage: var data = TerrainSaveData.new() data.add_cell(Vector2i(3, 4), 0, 1) ResourceSaver.save(data, "user://terrain_save.res")

Source: addons/grid_placement/placement/terrain/terrain_save_data.gd

Syntax

class TerrainSaveData extends Resource

Members

NameKindSummary
cellPropertyTyped read-only view of one painted cell record. The save format remains dictionary-based for backward compatibility, but the persistence code now exposes this typed record so callers do not thread entry.get("x", 0) reads through the codebase.
terrain_setProperty
terrainProperty
layerProperty
terrain_cellsPropertyArray of cell records. Each dictionary has keys: - "x" (int) — cell x coordinate - "y" (int) — cell y coordinate - "terrain_set" (int) — terrain set index in the TileSet - "terrain" (int) — terrain index within the terrain set - "layer" (String, optional) — source TileMapLayer node path
source_layer_pathPropertyTileMapLayer path (from the scene root) that these cells belong to. Stored for documentation / validation; not required for load.
format_versionPropertySave-format version for forward-compat. Increment this when the cell-record shape changes so loaders can branch on it. The wire shape remains the dictionary form so pre-v1 saves still load.
add_cellMethod
as_typed_recordsMethod
is_emptyMethod
clearMethod