PlaceableSelectionUI
AUTO-GENERATED FILE — DO NOT EDIT MANUALLY
Source: ui/placeable/single/placeable_selection_ui.gd
Version: 5.0
class_name: PlaceableSelectionUI
extends: Control
Summary
Unified UI component for selecting placeable objects and placeable sequences to build.
Provides a tabbed, grid-based interface for selecting placeables and placeable sequences to place in the world. Supports folder-based asset loading with [GBAssetResolver] for automatic discovery of content and category tags. Integrates with [BuildingSystem] to initiate placement mode when items are selected.
[b]Key Features:[/b] [ul]
- Mixed content grids supporting both individual placeables and sequences
- Configurable sizing for consistent template height and icon dimensions
- Variant cycling for sequences through enhanced [PlaceableListEntry] components
- Automatic asset loading from configured folders
- Category-based organization with tabs [/ul]
[b]Usage:[/b] [codeblock] var selection_ui = PlaceableSelectionUI.new() selection_ui.placeables_folder = “res://my_placeables” selection_ui.category_tags_folder = “res://my_categories” selection_ui.fixed_template_height = 48 selection_ui.fixed_icon_size = 40 [/codeblock]
Signals
valid_changed- Emitted when the UI validation state changes.[br] [param is_valid] True if the UI is properly configured and ready for use.
Exports
category_tags- Category tags to include alongside folder-loaded ones.[br] These tags are combined with tags loaded from [member category_tags_folder].
placeables- Individual placeables to include alongside folder-loaded ones.[br] These are displayed in grids alongside sequences. Combined with placeables from [member placeables_folder].
sequences- Placeable sequences to include alongside folder-loaded ones.[br] Sequences allow variant cycling within a single grid slot. Combined with sequences from [member sequences_folder].
placeable_entry_template- Template scene for individual placeable entries.[br] Should be a [PlaceableView] that displays icon and name.
sequence_entry_template- Template scene for sequence entries with variant cycling.[br] Should be a [PlaceableListEntry] that supports cycling through sequence variants.
fixed_template_height- Fixed height for all templates to prevent resizing when cycling through sequence variants.[br][br] When set to a positive value, enforces consistent height for all template entries.[br] When set to 0, disables PlaceableSelectionUI-level height enforcement and allows templates to size naturally.[br] Note: Individual PlaceableView instances may still enforce their own height via their fixed_view_height property.[br] Default: 48 pixels for consistent template sizing.
fixed_icon_size- Fixed icon size for all placeable view icons to ensure consistent icon dimensions.[br][br] When set to a positive value, enforces both width and height for all icon TextureRects in PlaceableView instances.[br] When set to 0, icon sizing is not enforced and will use template defaults.[br] Default: 40 pixels for standard icon sizing.
show_category_tab_names- Whether category tab titles should be visible for manual category selection.[br] When false, tabs are hidden and only grid content is shown.
hide_ui_on_selection- Whether to hide the selection UI when an item is selected.[br] When true, the UI automatically hides after the user selects a placeable or sequence.
ui_root- Root control node for showing and hiding the entire UI.
tab_container- Tab container that handles category-based organization.[br] Each tab represents a category tag and contains a grid of matching placeables/sequences.
Methods
_ready()resolve_gb_dependencies()- Called by GBChildInjector to resolve dependencies on the UI.[br][br] [code]p_container[/code]: [i]GBCompositionContainer[/i] - Container with system dependencies and configuration
_load_assets()- Load assets using GBAssetResolver for both placeables and sequences
rebuild()- Rebuild the UI after changing content type or assets at runtime
clear()_setup_tabs()- Generate tabs for each category and populate each tab with content in unified grid layout
_get_placeables_with_tag()_get_sequences_with_tag()_create_mixed_content_grid()- Creates a mixed content grid containing both placeables and sequences
_on_placeable_selected()_on_sequence_entry_selected()_on_sequence_variant_changed()add_placeables()- Adds placeable options to the UI and updates the corresponding visuals.[br][br] [code]new_placeables[/code]: [i]Array[Placeable][/i] - Array of new placeable resources to add to the UI
remove_placeables()- Removes placeable options from the UI and updates the corresponding visuals.[br][br] [code]rem_placeables[/code]: [i]Array[Placeable][/i] - Array of placeable resources to remove from the UI
get_runtime_issues()- Run setup checks on the UI to ensure proper setup. Returns validation issues found during setup checks.[br][br] [code]return[/code]: [i]Array[String][/i] - List of validation issues (empty if valid)
_on_mode_changed()_on_hidden()- When hidden, if in build mode, automatically switch to off mode
_validate_basic_components()- Get the current building system from systems context Validates basic required components are properly assigned
_validate_required_templates()- Validates only the templates that are needed based on loaded content
_get_building_system()_enforce_template_height()- Enforces fixed height for consistent template sizing when fixed_template_height > 0.[br] When fixed_template_height is 0, height enforcement is disabled at the PlaceableSelectionUI level.
_constrain_template_icons()- Constrains icon/image elements within templates to prevent height expansion
_find_nodes_by_type()- Recursively finds all nodes of a specific type within a parent node