ManipulationParent
Summary
Section titled “Summary”ManipulationParent - Transform container for preview objects during manipulation.
Applies rotation, translation, and scale transforms to preview objects during building/manipulation. All child nodes automatically inherit these transforms through Godot’s scene tree.
Indicators are ALWAYS parented to IndicatorManager.
IMPORTANT: IndicatorManager should be parented to ManipulationParent (not as a sibling). This ensures indicators inherit rotation and transform from ManipulationParent via scene tree.
Top-Down/Platformer: IndicatorManager as child of ManipulationParent (indicators rotate with preview) Isometric: IndicatorManager as child of ManipulationParent (indicators maintain correct orientation)
Key Methods - apply_rotation(degrees) - Rotate this node and all children - apply_horizontal_flip() - Flip horizontally - apply_vertical_flip() - Flip vertically - reset() - Reset to identity transform
Section titled “Key Methods - apply_rotation(degrees) - Rotate this node and all children - apply_horizontal_flip() - Flip horizontally - apply_vertical_flip() - Flip vertically - reset() - Reset to identity transform”Transform Behavior - Manipulation start: Resets to identity - During manipulation: Accumulates transforms - Manipulation end/cancel: Resets to identity
Section titled “Transform Behavior - Manipulation start: Resets to identity - During manipulation: Accumulates transforms - Manipulation end/cancel: Resets to identity”For detailed parenting decisions, isometric considerations, and architectural patterns: See docs/v5-0/guides/isometric_implementation.mdx
For system architecture: See docs/systems/parent_node_architecture.md
Methods
Section titled “Methods”func 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.
func apply_rotation( degrees: float ) -> voidApplies rotation to this ManipulationParent node. All child nodes will automatically inherit this rotation through Godot’s scene tree.
Architecture Reasoning: - ManipulationParent is a Node2D, so transforming it automatically transforms all children - Preview objects are typically children of ManipulationParent - Indicators are parented to IndicatorManager; IndicatorManager should be child of ManipulationParent - IndicatorManager as child of ManipulationParent: indicators inherit rotation/scale/flip transforms - No need for complex child-finding logic - Godot handles transform inheritance - Cleaner separation of concerns: ManipulationSystem handles logic, ManipulationParent handles transforms
degrees: Rotation amount in degrees to apply to this node and all childrenfunc apply_horizontal_flip( ) -> voidApplies horizontal flip to this ManipulationParent node. All child nodes will automatically inherit this scale change through transform inheritance.
[param] None - applies horizontal flip (scale.x *= -1) to this node and all children
func apply_vertical_flip( ) -> voidApplies vertical flip to this ManipulationParent node. All child nodes will automatically inherit this scale change through transform inheritance.
[param] None - applies vertical flip (scale.y *= -1) to this node and all children
func _unhandled_input( event: InputEvent ) -> void— FLIP H / V —
Handles input events for manipulation transform operations. Processes transform inputs directly at the point where transform methods are defined.
Architecture Reasoning: - ManipulationParent owns transform methods and should handle related input - Eliminates delegation chain: Input → ManipulationSystem → ManipulationParent - Creates self-contained transform handling in one place - ManipulationSystem can focus on higher-level manipulation logic
func _input( event: InputEvent ) -> voidRoute standard input to unhandled to support tests or scenes that call _input directly.
func _get_manipulation_settings( ) -> ManipulationSettingsGets manipulation settings from dependency context.
func _get_actions( ) -> GBActionsGets actions from dependency context.
func _get_target_map_from_states( states: GBStates ) -> TileMapLayerGets the target map from the targeting state for grid-aware rotation.
states: The complete states container Returns: TileMapLayer for grid calculations, or null if not availablefunc resolve_gb_dependencies( p_container: GBCompositionContainer ) -> voidfunc get_runtime_issues( ) -> Array[String]Validates that manipulation state is properly configured. Returns validation issues if state is missing or incorrectly configured.
Ensures that: - ManipulationState is properly assigned - This node is registered as the parent in ManipulationState - Transform operations will function correctly
return: Array[String] - List of validation issues (empty if valid)func _on_started( p_data: ManipulationData )func _on_finished( p_data: ManipulationData )func _on_canceled( p_data: ManipulationData )
Source
Section titled “Source”addons/grid_building/systems/manipulation/manipulation_parent.gd
This API reference is automatically generated from the plugin source code. For implementation examples and usage guides, see the guides section.