GBInjectorSystem

[b]Private helper: Report warnings through direct print or push_warning.[/b][br]

sort Weight: 10

[b]Private helper: Report warnings through direct print or push_warning.[/b][br]

Version: v5.0.0

STABLE

Inherits: GBSystem
Source: gb_injector_system.gd
Parsing: AST-based for maximum accuracy with symbol typing


Constants

INJECTION_META_KEY

Type: String

Value: "gb_injection_meta"


RESOLVE_METHOD

Type: StringName

Value: "resolve_gb_dependencies"


ORPHAN_MESSAGE

Type: String

Value: "[ORPHANED NODE]"


Variables

_debug: GBDebugSettings

Debug settings for logging and warnings.

Type: GBDebugSettings


_logger: GBLogger

Type: GBLogger


_initialized: bool

Tracks whether initial recursive injection has completed

Type: bool

Default: false


_scene_node_added_connected: bool

Type: bool

Default: false


_initial_injection_count: int

Tracks the number of nodes injected during initial injection

Type: int

Default: 0


Signals

initial_injection_completed()

Emits when the initial scene injection is completed


node_injected(node : Node: Variant)

Emit whenever a node is injected

Parameters:

  • node : Node: Variant

Methods

_init

Signature: _init(p_composition_container : GBCompositionContainer = null: Variant) -> void

Returns: void

Parameters:

  • p_composition_container : GBCompositionContainer = null: Variant

_ready

Signature: _ready() -> void

Returns: void


_initialize

Signature: _initialize() -> void

host code after owner/context are available (see top-level notes).

Returns: void


get_injection_roots

Signature: get_injection_roots() -> Array

Gets the scoped root nodes for injection

Returns: Array


validate_runtime

Signature: validate_runtime() -> bool

been injected and GBLevelContext / GBOwner are available.

Returns: bool


run_validation

Signature: run_validation() -> bool

logging side-effects.

Returns: bool


get_editor_issues

Signature: get_editor_issues() -> Array

Returns: Array


get_runtime_issues

Signature: get_runtime_issues() -> Array

Returns: Array


_inject_existing

Signature: _inject_existing(p_node: Node) -> void

Returns: void

Parameters:

  • p_node: Node

_on_node_added_to_scope

Signature: _on_node_added_to_scope(p_scope: Node, p_node : Node: Variant) -> void

p_node: The newly added child node.

Returns: void

Parameters:

  • p_scope: Node
  • p_node : Node: Variant

create_with_injection

Signature: static create_with_injection(p_parent : Node: Variant, container: GBCompositionContainer) -> GBInjectorSystem

Creates a GBInjectorSystem with dependency injection from container.

Returns: GBInjectorSystem

Static: true

Parameters:

  • p_parent : Node: Variant
  • container: GBCompositionContainer

resolve_gb_dependencies

Signature: resolve_gb_dependencies(p_config : GBCompositionContainer: Variant) -> void

prints a small diagnostic.

Returns: void

Parameters:

  • p_config : GBCompositionContainer: Variant

inject_node

Signature: inject_node(p_node: Node) -> bool

Also connects signals to monitor future children and node exiting.

Returns: bool

Parameters:

  • p_node: Node

inject_recursive

Signature: inject_recursive(p_node: Node) -> void

Used only on startup to cover existing tree nodes.

Returns: void

Parameters:

  • p_node: Node

set_injection_meta

Signature: set_injection_meta(p_node : Node: Variant) -> void

Sets the meta data on the object following a successful injection.

Returns: void

Parameters:

  • p_node : Node: Variant

remove_injection_meta

Signature: remove_injection_meta(p_node: Node) -> void

Removes the injection meta data from the object.

Returns: void

Parameters:

  • p_node: Node

_on_child_entered_tree

Signature: _on_child_entered_tree(p_node: Node) -> void

Injects only the single node; child nodes will trigger their own injections.

Returns: void

Parameters:

  • p_node: Node

_on_node_exiting_tree

Signature: _on_node_exiting_tree(p_node: Node) -> void

Handler for node exiting tree to clean up signal connections[br]

Returns: void

Parameters:

  • p_node: Node

_connect_child_entered_tree

Signature: _connect_child_entered_tree(p_node: Node) -> void

Private helper: Connect child_entered_tree signal if not already connected.[br]

Returns: void

Parameters:

  • p_node: Node

_disconnect_child_entered_tree

Signature: _disconnect_child_entered_tree(p_node: Node) -> void

Private helper: Disconnect child_entered_tree signal if connected.[br]

Returns: void

Parameters:

  • p_node: Node

_connect_tree_exiting

Signature: _connect_tree_exiting(p_node: Node) -> void

Private helper: Connect tree_exiting signal if not already connected.[br]

Returns: void

Parameters:

  • p_node: Node

_disconnect_tree_exiting

Signature: _disconnect_tree_exiting(p_node: Node) -> void

Private helper: Disconnect tree_exiting signal if connected.[br]

Returns: void

Parameters:

  • p_node: Node

_connect_scene_tree_node_added

Signature: _connect_scene_tree_node_added() -> void

Returns: void


_on_scene_tree_node_added

Signature: _on_scene_tree_node_added(p_node: Node) -> void

Returns: void

Parameters:

  • p_node: Node

_validate_after_injection

Signature: _validate_after_injection() -> void

nodes are properly injected and GBLevelContext/GBOwner are configured.

Returns: void


_report_warning

Signature: _report_warning(message: String) -> void

Private helper: Report warnings through direct print or push_warning.[br]

Returns: void

Parameters:

  • message: String