Skip to content

ManipulationParent

ManipulationParent - Transform container for preview objects and placement managers.

Serves as the parent node for objects being manipulated and their associated systems.

CRITICAL ARCHITECTURE NOTE: ManipulationParent serves as the parent for objects being placed, moved, rotated, or manipulated (like preview instances), NOT for visual feedback indicators. Rule check indicators should be parented to IndicatorManager instead.

Parent Responsibilities:

  • Child objects: Preview instances, objects being manipulated, IndicatorManager
  • Purpose: Unified transform adjustments for all manipulation-related elements
  • Transform behavior: When transformed, all children (objects + indicators) move together

For detailed architecture documentation, see: docs/systems/parent_node_architecture.md

All child nodes including the node being manipulated and any other nodes that help reflect data to the player will have their global_transforms adjusted simultaneously. This ensures that during manipulation operations (move, rotate, etc.), both the object being manipulated and its associated visual feedback maintain proper spatial relationships.

GridPositioner
└── ManipulationParent ← This node
├── IndicatorManager ← Child: manages indicators
│ ├── RuleCheckIndicator ← Grandchild: visual feedback
│ └── RuleCheckIndicator ← Grandchild: visual feedback
└── PreviewObject ← Child: object being manipulated
├── CollisionShape2D
└── StaticBody2D

CRITICAL: ManipulationParent parents PREVIEW OBJECTS, not indicators

  • Preview Objects (objects being built/manipulated) are parented to ManipulationParent

    • This allows them to be rotated, moved, and scaled as a unit
    • Transform operations affect the preview object appropriately
    • Maintains proper manipulation behavior during build/edit modes
  • IndicatorManager is typically also a child of ManipulationParent

    • IndicatorManager itself can be transformed along with preview objects
    • However, IndicatorManager’s indicator children remain independently positioned
    • This creates the proper hierarchy for coordinated movement
World
└── GridPositioner
└── ManipulationParent ← This node handles transforms
├── IndicatorManager ← Can move with manipulation
│ ├── RuleCheckIndicator ← Independently positioned
│ ├── RuleCheckIndicator ← Independently positioned
│ └── ...
└── PreviewObject ← Moves/rotates with manipulation
├── CollisionShape2D
└── ...
  • When manipulation starts: resets to identity transform
  • During manipulation: accumulates rotation, translation, scale
  • When manipulation ends/cancels: resets to identity transform
  • All child nodes inherit these transform changes automatically
  • ManipulationParent: Handles preview object transforms and manipulation
  • IndicatorManager: Handles validation feedback and indicator positioning
  • Indicators: Remain stable and provide consistent visual feedback

This design ensures that validation indicators remain visually stable and correctly positioned even when preview objects are being manipulated or transformed.

reset( )

Resets the transform of the node to identity. This is called at the start, end, and cancellation of manipulation operations to ensure consistent positioning and prevent transform accumulation issues.

resolve_gb_dependencies( p_container: GBCompositionContainer ) -> void
get_runtime_issues( ) -> Array[String]

Validates that manipulation state is properly configured. Returns validation issues if state is missing or incorrectly configured.

Ensures that:

return: Array[String] - List of validation issues (empty if valid)

addons/grid_building/systems/manipulation/manipulation_parent.gd


This page was auto-generated from GDScript source. Edit the source file to improve documentation.

Generated on 2025-09-07