ManipulationParent
AUTO-GENERATED FILE — DO NOT EDIT MANUALLY
Source: systems/manipulation/manipulation_parent.gd
Version: 5.1
class_name: ManipulationParent
extends: GBNode2D
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.
IndicatorManager Parenting
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 childrenapply_horizontal_flip()- Flip horizontallyapply_vertical_flip()- Flip verticallyreset()- Reset to identity transform
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 [b]docs/v5-0-0/guides/isometric_implementation.mdx[/b]
For system architecture: See [b]docs/systems/parent_node_architecture.md[/b]
Signals
(none)
Exports
(none)
Methods
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.
apply_rotation()- Applies 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
[param degrees] Rotation amount in degrees to apply to this node and all children
apply_grid_rotation_clockwise()- Apply grid-aware clockwise rotation to this ManipulationParent. Uses cardinal direction rotation (90-degree increments) for grid-aligned objects.
IMPORTANT: When ManipulationParent rotates, all child nodes inherit the rotation transform. Indicators are always parented to IndicatorManager. IndicatorManager should be a child of ManipulationParent so indicators inherit the same rotation/scale/flip transforms as the preview object.
See [b]docs/v5-0-0/guides/isometric_implementation.mdx[/b] for parenting strategies.
[param target_map] TileMapLayer for grid alignment calculations [param increment_degrees] Rotation increment in degrees (default 90.0 for 4-direction) [return] The new rotation angle in degrees (0-360 range)
apply_grid_rotation_counter_clockwise()- Apply grid-aware counter-clockwise rotation to this ManipulationParent. Uses the rotation increment from parameter (default 90° for 4-direction). Supports configurable increments: 45° for 8-direction, 30° for 12-direction, etc.
[param target_map] TileMapLayer for grid alignment calculations [param increment_degrees] Rotation increment in degrees (default 90.0 for 4-direction) [return] The new rotation angle in degrees (0-360 range)
apply_horizontal_flip()- Applies 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
apply_vertical_flip()- Applies 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
handle_transform_input()- Handles transformation input events for manipulation operations. This method processes rotation and flip inputs, applying transforms to this ManipulationParent which automatically coordinate transforms for all child nodes (objects + indicators).
Architecture Reasoning:
- ManipulationParent owns the transform methods (apply_rotation, apply_*_flip)
- Input handling should be where transform methods are defined
- Keeps transform logic centralized in one class
- ManipulationSystem delegates input to the appropriate transform coordinator
[param event] The input event to process for transformation [param manipulation_settings] Global manipulation settings (rotation increments, enable flags) [param actions] Input action configuration [param manipulatable_settings] Settings specific to the object being manipulated [param messages] Message resources for error reporting [param states] System states for mode management and failed signal emission
_unhandled_input()- 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
_input()- Route standard input to unhandled to support tests or scenes that call _input directly.
_get_manipulation_settings()- Gets manipulation settings from dependency context.
_get_actions()- Gets actions from dependency context.
_get_target_map_from_states()- Gets the target map from the targeting state for grid-aware rotation. [param states] The complete states container [return] TileMapLayer for grid calculations, or null if not available
resolve_gb_dependencies()get_runtime_issues()- 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
[code]return[/code]: [i]Array[String][/i] - List of validation issues (empty if valid)
_on_started()_on_finished()_on_canceled()