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

1
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

1
apply_rotation(degrees: float) -> void

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

1
2
3
4
apply_grid_rotation_clockwise(
    target_map: TileMapLayer,
    increment_degrees: float = 90.0
) -> float

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

1
2
3
4
apply_grid_rotation_counter_clockwise(
    target_map: TileMapLayer,
    increment_degrees: float = 90.0
) -> float

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

1
apply_horizontal_flip() -> void

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

1
apply_vertical_flip() -> void

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

1
resolve_gb_dependencies(p_container : GBCompositionContainer) -> void

get_runtime_issues

1
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)


Private Methods

_unhandled_input

1
_unhandled_input(event: InputEvent) -> void

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

1
_input(event: InputEvent) -> void

Flags: private

Route standard input to unhandled to support tests or scenes that call _input directly.


_get_manipulation_settings

1
_get_manipulation_settings() -> ManipulationSettings

Flags: private

Gets manipulation settings from dependency context.


_get_actions

1
_get_actions() -> GBActions

Flags: private

Gets actions from dependency context.


_get_target_map_from_states

1
_get_target_map_from_states(states: GBStates) -> TileMapLayer

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

1
_on_started(p_data : ManipulationData)

Flags: private


_on_finished

1
_on_finished(p_data : ManipulationData)

Flags: private


_on_canceled

1
_on_canceled(p_data : ManipulationData)

Flags: private