Skip to content

Class

ObjectDragShapePreview

Generated GDScript class reference for GridPlacement.ObjectDragShapePreview.

Status
Current
Version
v6.2.0
Source updated
2026-09-24
Generated on
2026-10-01

Live shape indicator for object multi-cell drags (LINE, RECTANGLE_FILL, RECTANGLE_OUTLINE). Terrain brushes already ghost the full pending shape while dragging (TerrainPreview); object drags previously showed only the single cursor ghost, so the area a release stamps was invisible. This node draws the pending shape from the session brush state's drag start to the live cursor cell: the exact generated cell path for LINE, a map-aligned polygon for rectangle shapes, and translucent fill only for RECTANGLE_FILL. On top of the span geometry, the overlay marks the ordered-simulation candidates: each shape cell, in commit order, whose footprint rect is anchored on mapped tile data and free of committed records plus already-accepted cells. Only these cells get placement markers, so a multi-cell drag shows the sparse subset it will actually stamp. Full rules still gate each commit, so commit results are always a subset of the preview — never more. The OBJECT_GHOSTS style draws a translucent copy of the live preview's sprites on those same cells instead of the square markers, which read badly on isometric maps. Wiring: place one under World next to TerrainPreview. The host binder calls resolve_placement_runtime(host, session); the node then polls the session brush lifecycle every physics frame and hides itself whenever no object drag is active, so release, cancel, mode-exit, and session paths need no explicit teardown calls. 2D GRID TileMapLayer sessions only: without a target map (3D sessions) the node stays hidden.

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

Syntax

class ObjectDragShapePreview extends RefCounted

Members

NameKindSummary
PREVIEW_GROUPFieldScene-tree group so the host or tools can refresh all shape previews.
FALLBACK_OUTLINEFieldFallback outline color when no highlight settings resolve.
FILL_ALPHAFieldFill alpha applied over the resolved outline color.
kindPropertyDraw geometry for one drag frame. [member kind] is &"line", &"rect", or &"none"; [member points] and [member rect] are world space.
pointsProperty
rectPropertyWorld-space AABB of [member points].
fillPropertyTrue only for RECTANGLE_FILL.
accepted_cellsPropertyOrdered-simulation candidates, in commit order.
accepted_rectsPropertyWorld footprint rects, parallel to [member accepted_cells].
current_cellPropertyThe live cursor cell (where the live preview already draws).
stylePropertyThe resolved [enum PlacementSettings.DragGhostStyle].
is_noneMethod
draws_same_asMethod
SIM_REFRESH_INTERVAL_TICKSField
resolve_placement_dependenciesMethod
resolve_placement_runtimeMethod
request_refreshMethod
update_previewMethod
get_last_geometryMethod
is_shape_visibleMethod
emptyProperty
serviceProperty
entryProperty
coordinatorProperty
capProperty
placement_budgetProperty
settingsProperty
tile_sizeProperty
placement_capProperty
previewProperty
rotationProperty
statesProperty
placed_countProperty
tickProperty
keyProperty
cellsProperty
resultProperty
geometry_for_cellsMethod
noneProperty
line_cellsProperty
line_pointsProperty
min_cellProperty
max_cellProperty
cornersProperty
basis_xProperty
basis_yProperty
basis_xProperty
basis_yProperty
top_leftProperty
top_rightProperty
bottom_rightProperty
bottom_leftProperty
outlineProperty