Resource holding serialized terrain cell data for a TileMapLayer. Each entry in [member 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: [codeblock] var data = TerrainSaveData.new() data.add_cell(Vector2i(3, 4), 0, 1) ResourceSaver.save(data, "user://terrain_save.res") [/codeblock]
Source: addons/grid_placement/placement/terrain/terrain_save_data.gd
Syntax
class TerrainSaveData extends ResourceMembers
| Name | Kind | Summary |
|---|---|---|
cell | Property | Typed 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 [code]entry.get("x", 0)[/code] reads through the codebase. |
terrain_set | Property | |
terrain | Property | |
layer | Property | |
terrain_cells | Property | Array 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_path | Property | TileMapLayer path (from the scene root) that these cells belong to. Stored for documentation / validation; not required for load. |
format_version | Property | Save-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_cell | Method | |
entry | Property | |
as_typed_records | Method | |
typed | Property | |
rec | Property | |
get_cell_count | Method | |
is_empty | Method | |
clear | Method |
Source
addons/grid_placement/placement/terrain/terrain_save_data.gd
Plugin docs root:gdscript/plugins/grid_placement_dev/docs