Skip to content

Class

BrushState

Generated GDScript class reference for GridPlacement.BrushState.

Status
Current
Version
v6.0
Source updated
Active v6.0 guide line from Grid Placement repo
Generated on
2026-09-01

Owns all brush-shape, drag, and pending-shape state for the building system. Extracted from the building system to reduce the god-class footprint. The building system delegates state queries and mutations to this class instead of tracking half a dozen raw boolean/Vector2i flags. Lifecycle invariants: Only one of (TERRAIN_DRAG, OBJECT_LINE_DRAG, PENDING_SHAPE) can be active at a time. The previous design tracked independent booleans which made impossible composite states observable. This file now derives all is_() queries from a single [_current_lifecycle] enum. Lifecycle rules enforced here:

  • Setting a new brush shape cancels all pending/drag state (IDLE).
  • Starting a drag cancels any pending state and enters TERRAIN_DRAG.
  • Starting an object LINE drag cancels any pending state and enters OBJECT_LINE_DRAG.
  • Anchoring a pending shape cancels any drag/state and enters PENDING_SHAPE.
  • Committing or canceling clears the relevant state and returns to IDLE.

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

Syntax

class BrushState extends RefCounted

Members

NameKindSummary
activePropertyMutually exclusive lifecycle state for the brush. Stored in [_current_lifecycle]; all is_() getters derive from this single field. Pending multi-cell shape (see PendingShapePlacement inner class below).
shapeProperty
cellsProperty
is_activeMethod
anchorMethod
clearMethod
brush_shapeProperty-- Brush shape ------------------------------------------------
get_brush_shapeMethod
set_brush_shapeMethod
get_lifecycleMethod
is_terrain_draggingMethod
is_object_line_draggingMethod
is_pendingMethod
is_idleMethod
start_terrain_dragMethod
complete_terrain_dragMethod
get_drag_startMethod
start_object_line_dragMethod
complete_object_line_dragMethod
get_object_line_drag_startMethod
anchor_pendingMethod
get_pending_cellsMethod
commit_pendingMethod
cancel_pendingMethod
cancel_allMethod