Skip to content

ManipulationState

The manipulation state holds reference to the object being manipulated and its temporary manipulated copy. It also is the source of signals regarding object manipulation like when moving or demolishing an object is started, canceled, or stopped.

signal data_changed( manipulation: ManipulationData )

The manipulation state holds reference to the object being manipulated and its temporary manipulated copy. It also is the source of signals regarding object manipulation like when moving or demolishing an object is started, canceled, or stopped.

Emitted when the active manipulation on an object changes Null means there is no manipulation currently active on the state.

signal active_manipulatable_changed( active: Manipulatable )

The manipulatable that is being hovered over

signal parent_changed( parent: ManipulationParent )

When the node for performing transform adjustments to (rotate, flip, etc) during a manipulation changes

signal started( data: ManipulationData )

Emitted when a manipulation action is started

signal confirmed( data: ManipulationData )

Emitted when a manipulation action is confirmed

signal finished( data: ManipulationData )

Emitted when a manipulation action is finished

signal canceled( data: ManipulationData )

Emitted when a manipulation action is canceled

signal failed( data: ManipulationData )

Emitted when a manipulation action fails

data: ManipulationData:

Data of the active manipulation

active_manipulatable: Manipulatable:

The current targeted (hovered, etc) manipulatable component, if any

parent: ManipulationParent:

Node which is actually manipulated to effect all children including the active manipulatable and any other nodes that need to move to be updated with the base The ManipulationParent node responsible for coordinating transforms during manipulation. Enforces ManipulationParent class to ensure proper transform coordination methods are available. This ensures indicators rotate/flip with manipulated objects via transform inheritance.

func _init( p_owner_context: GBOwnerContext ) -> void
func get_manipulator( ) -> GBOwner

Gets the active manipulator from the _owner_context GBOwnerContext.

func get_active_root( ) -> Node

Gets the root node of the active manipulatable, or null if none is set. This is a convenience method that safely accesses active_manipulatable.root with proper null checking. Returns: The root Node of the active manipulatable, or null if no manipulatable is active or it has no root

func set_targeted( p_node: Node ) -> void

Sets the active manipulatable. Either takes a Manipulatable directly or a node that contains a Manipulatable component (searches via GBSearchUtils).

Note: For setting the “target” (what is being aimed at), use GridTargetingState instead. This method is for setting what is being manipulated/hovered.

func is_targeted_movable( ) -> bool

Checks if the currently targeted manipulatable is movable.

return: bool - True if targeted object can be moved, false otherwise

func validate_setup( ) -> bool

Checks if the state is ready for manipulation.

func _on_data_status_changed( p_status: GBEnums.Status )

Private handler for status changes in manipulation data. Emits specific signals for each status so other nodes like UI can respond.

p_status: GBEnums.Status - New status of the manipulation data

func get_editor_issues( ) -> Array[String]

Returns an array of editor-time validation issues for this resource

func get_runtime_issues( ) -> Array[String]

Returns an array of runtime validation issues for this resource

addons/grid_building/systems/manipulation/manipulation_state.gd


This API reference is automatically generated from the plugin source code. For implementation examples and usage guides, see the guides section.