Skip to content

GBMetadataResolver

Utility for resolving Grid Building metadata on nodes.

Provides metadata resolution for root node targeting and display name features. This class is stateless and all methods are static for maximum reusability.

Supported Metadata:

  • root_node: Specifies the logical root Node2D for targeting - display_name: Custom display name for UI
static func resolve_root_node( collision_object: CollisionObject2D ) -> Node2D

Resolves the root node for a collision object by checking metadata and Manipulatable components. Uses a priority search strategy for flexible targeting:

Search priority:

  1. Check collision object directly for “root_node” metadata (Node2D or NodePath)

  2. Search sibling nodes for Manipulatable component (uses Manipulatable.root)

  3. Search direct children (1 level deep) for Manipulatable component

  4. Return collision object if no metadata or Manipulatable found

collision_object: The CollisionObject2D to start searching from

Returns: The resolved root node (Node2D) or the collision object itself

static func resolve_display_name( node: Node, fallback: String ) -> String

Resolves display name for a node by checking display_name metadata.

Priority order:

  1. display_name metadata (if present, non-empty string)

  2. Node name (fallback)

node: The node to get display name for fallback: Value to return if node is null (default: “<none>”) Returns: The resolved display name string

addons/grid_building/utils/gb_metadata_resolver.gd


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