GBMetadataResolver
Summary
Section titled “Summary”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
Methods
Section titled “Methods”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:
-
Check collision object directly for “root_node” metadata (Node2D or NodePath)
-
Search sibling nodes for Manipulatable component (uses Manipulatable.root)
-
Search direct children (1 level deep) for Manipulatable component
-
Return collision object if no metadata or Manipulatable found
collision_object
: The CollisionObject2D to start searching fromReturns: 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:
-
display_name metadata (if present, non-empty string)
-
Node name (fallback)
node
: The node to get display name forfallback
: Value to return if node is null (default: “<none>”) Returns: The resolved display name string-
Source
Section titled “Source”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.