Chris' Tutorials
Docs/Grid Placement

Class

BrushShapeGenerator

Generated GDScript class reference for GridPlacement.BrushShapeGenerator.

StatusDraft
Versionv6.0
UpdatedDevelopment docs generated from GDScript source

This is unreleased documentation in active development. APIs, class names, and behavior may change before the final release.

Draft — Unreleased:This page is in active development. APIs, class names, and behavior may change before the release is finalized. Use it as a preview of what's coming — not as a stable integration target.

Generates cell arrays for brush shapes used in terrain painting and object multi-placement. Shape math is abstracted here so both terrain and object paths share the same cell-generation logic. Shapes: SINGLE — the target cell only (pass-through) LINE — Bresenham's line algorithm from start to end (hex: cube-coordinate lerp) RECTANGLE_FILL — all cells in the inclusive rectangle between corners (hex: axial-range parallelogram) RECTANGLE_OUTLINE — perimeter cells of the rectangle (hex: axial-range perimeter) FLOOD_FILL — BFS from target cell, bounded by a predicate AND a region (hex: 6-directional) [enum FloodFillMode] controls the boundary predicate: SAME_TERRAIN — fill connected cells sharing the same terrain EMPTY_CELLS — fill connected empty cells Flood fills are always region-bounded: explicit bounds, else the map's used_rect. An unbounded empty-cell fill would walk the infinite plane (empty matches empty forever) and freeze the game. Hex support: when [param p_tile_shape] is [code]TileSet.TILE_SHAPE_HEXAGON[/code], the generator uses hex-aware algorithms (cube-coordinate lerp for LINE, axial-range iteration for RECTANGLE, 6-directional neighbors for FLOOD_FILL). Godot's default hex layout is pointy-top, odd-row offset.

Source: addons/grid_placement/systems/building/brush_shape_generator.gd

Syntax

class BrushShapeGenerator extends RefCounted

Members

NameKindSummary
MAX_FLOOD_CELLSFieldDispatch: generate the cell array for [param p_shape] between [param p_start] and [param p_end] (end is ignored for SINGLE/FLOOD). [param p_map] must be provided for FLOOD_FILL; used to auto-detect tile_shape when [param p_tile_shape] is not provided. [param p_tile_shape] Optional — set to [code]TileSet.TILE_SHAPE_HEXAGON[/code] to enable hex-aware algorithms. Defaults to SQUARE when omitted and no map is available. Hard safety cap on flood-fill expansion regardless of bounds.
MAX_BRUSH_CELLSFieldHard safety ceiling for all brush shapes (line, rect fill, rect outline, flood). Designer-configurable via PlacementSettings.max_terrain_brush_cells; this is the runtime upper bound to prevent unbounded work from misconfiguration.
generateMethod
tile_shapeProperty
is_hexProperty
generate_lineMethod
cellsProperty
x0Property
y0Property
x1Property
y1Property
dxProperty
dyProperty
sxProperty
syProperty
errProperty
e2Property
generate_rect_fillMethod
cellsProperty
min_xProperty
max_xProperty
min_yProperty
max_yProperty
generate_rect_outlineMethod
cellsProperty
min_xProperty
max_xProperty
min_yProperty
max_yProperty
colProperty
rowProperty
qProperty
rProperty
sProperty
qProperty
rProperty
colProperty
rqProperty
rrProperty
rsProperty
dqProperty
drProperty
dsProperty
generate_hex_lineMethod
cellsProperty
aProperty
bProperty
distProperty
afProperty
bfProperty
tProperty
pProperty
roundedProperty
generate_hex_rect_fillMethod
cellsProperty
caProperty
cbProperty
min_qProperty
max_qProperty
min_rProperty
max_rProperty
generate_hex_rect_outlineMethod
cellsProperty
caProperty
cbProperty
min_qProperty
max_qProperty
min_rProperty
max_rProperty
generate_flood_fillMethod
cellsProperty
boundsProperty
start_infoProperty
queueProperty
visitedProperty
currentProperty
neighborsProperty
can_fillProperty
infoProperty
cubeProperty

Source

addons/grid_placement/systems/building/brush_shape_generator.gd

Plugin docs root:gdscript/plugins/grid_placement_dev/docs