ManipulationParent
AUTO-GENERATED FILE – DO NOT EDIT MANUALLY
ManipulationParent - Transform container for preview objects during manipulation.
Source File: addons/grid_building/systems/manipulation/manipulation_parent.gd
Extends: GBNode2D
Private Properties
- Property:
_manipulation_state : [ManipulationState](./manipulation-state/):(private) - The state where this node should set itself as the parent at runtime - Property:
_manipulation_settings: [ManipulationSettings](./manipulation-settings/)(private) - Manipulation settings - used to check reset_transform_on_manipulation - Property:
_container: [GBCompositionContainer](./gb-composition-container/)(private) - Container for dependency injection
Public 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
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.
target_map TileMapLayer for grid alignment calculations
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.
target_map TileMapLayer for grid alignment calculations
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
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
return: Array[String] - List of validation issues (empty if valid)
Private Methods
_unhandled_input
Flags: private
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
Flags: private
Route standard input to unhandled to support tests or scenes that call _input directly.
_get_manipulation_settings
Flags: private
Gets manipulation settings from dependency context.
_get_actions
Flags: private
Gets actions from dependency context.
_get_target_map_from_states
Flags: private
Gets the target map from the targeting state for grid-aware rotation.
states The complete states container
[return] TileMapLayer for grid calculations, or null if not available
_on_started
Flags: private
_on_finished
Flags: private
_on_canceled
Flags: private