Chris' Tutorials
Docs/Grid Placement

Class

BrushState

Generated GDScript class reference for GridPlacement.BrushState.

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.

Owns all brush-shape, drag, and pending-shape state for PlacementSystem. Extracted from PlacementSystem to reduce the god-class footprint. PlacementSystem 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

Source

addons/grid_placement/systems/building/brush_state.gd

Plugin docs root:gdscript/plugins/grid_placement_dev/docs