VisualBoundsHelper

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

Static utility class for visual bounds detection and validation.

Source File: addons/grid_building/placement/placement_rules/helpers/visual_bounds_helper.gd

Extends: RefCounted

Public Methods

get_visual_bounding_box

1
get_visual_bounding_box(node: Node) -> Variant

Flags: static

Gets the global bounding box of all visual components in a node hierarchy. Returns Rect2 if visual components found, null if none.

node: Node - The root node to search for visual components [returns]: Rect2 - Union of all visual bounding boxes, or null if no visual components found


has_visual_components

1
has_visual_components(node: Node) -> bool

Flags: static

Checks if a node has any visual components in its hierarchy.

node: Node - The node to check [returns]: bool - True if any visual components found, false otherwise


get_rect_corners

1
get_rect_corners(rect: Rect2) -> Array[Vector2]

Flags: static

Gets the 4 corner points of a bounding rectangle.

rect: Rect2 - The rectangle to get corners from [returns]: Array[Vector2] - Array of 4 corner points in order: top-left, top-right, bottom-left, bottom-right


is_point_over_valid_tile

1
2
3
4
is_point_over_valid_tile(
    global_point: Vector2,
    target_map: TileMapLayer
) -> bool

Flags: static

Checks if a point is over a valid tile in a tilemap.

global_point: Vector2 - The global point to check target_map: TileMapLayer - The tilemap to check against [returns]: bool - True if the point is over a valid tile, false otherwise


get_out_of_bounds_corners

1
2
3
4
get_out_of_bounds_corners(
    rect: Rect2,
    target_map: TileMapLayer
) -> Array[Vector2]

Flags: static

Gets all corners of a bounding box that are outside the tilemap bounds.

rect: Rect2 - The bounding box to check target_map: TileMapLayer - The tilemap to check against [returns]: Array[Vector2] - Array of corner points that are outside the tilemap bounds


Private Methods

_collect_visual_rects

1
2
3
4
_collect_visual_rects(
    node: Node,
    out_rects: Array[Rect2]
) -> void

Flags: static, private

Recursively collects bounding rectangles from visual components.

node: Node - The node to search out_rects: Array[Rect2] - Output array to collect rectangles into


_get_sprite_global_rect

1
_get_sprite_global_rect(sprite: Sprite2D) -> Rect2

Flags: static, private

Computes the global bounding rect for a Sprite2D by transforming its local rect corners.


_get_polygon_global_rect

1
_get_polygon_global_rect(polygon: Polygon2D) -> Rect2

Flags: static, private

Computes the global bounding rect for a Polygon2D by transforming its polygon vertices.