Class PlaceableListEntry
- Namespace
- GridPlacement.GDScript
- Assembly
- MoonBark.GridPlacement.GDScript.dll
Rich, keyboard- and mouse-friendly list entry for selecting a Placeable or sequence variant.\n\nPurpose - Drop-in UI cell meant to replace a plain ItemList row with a richer control that shows an icon, name, and optional variant index with left/right arrows. - Works either with a single placeable Resource or with a sequence of variants (for example a PlaceableSequence containing multiple Placeable resources).\n\nKey Features - Emits selected when the user clicks or presses Enter/Space. - Emits variant_changed when cycling variants via arrow buttons or Left/Right keys. - Provides public getters so documentation and examples never rely on private helpers: - get_active_placeable() returns the currently active resource in this entry. - get_active_variant_index() returns the active variant index. - get_active_display_name() resolves a display name from the active object.\n\nInput and Accessibility - Mouse: left click selects; on-screen left/right buttons cycle variants. - Keyboard: when focused, Left/Right cycle variants; Enter/Space select.\n\nData requirements - The active object should provide a display_name: String and optional icon: Texture2D. - When sequence is used, it should expose count() and get_variant(index).
class PlaceableListEntry extends HBoxContainer
Properties
placeable
Single placeable resource to display/select when no sequence is provided.
@export var placeable: Resource:
sequence
Optional sequence wrapper providing variants (e.g. PlaceableSequence). Should implement count() and get_variant(index).
@export var sequence: Resource:
icon_size
@export var icon_size: Vector2 = Vector2(48, 48):
fixed_entry_height
Fixed height for list entries to maintain consistent sizing.[br][br] When set to a positive value, enforces a fixed height regardless of content.[br] When set to 0, height enforcement is disabled and the entry will size naturally.[br] Default: 56 pixels to match template standard sizing.
@export var fixed_entry_height: int = 56
total
var total = _sequence_count()
obj
var obj = _active_object()
dn
var dn = _get_property(obj, "display_name")
nprop
var nprop = _get_property(obj, "name")
show_variants
var show_variants = _sequence_count() > 1
obj
var obj = _active_object()
name_text
var name_text = "<Unnamed>"
icon_tex
var icon_tex: Texture2D = null
dn
var dn = _get_property(obj, "display_name")
nprop
var nprop = _get_property(obj, "name")
it
var it = _get_property(obj, "icon")
total
var total = _sequence_count()
total_variants
var total_variants = _sequence_count()
Methods
set_selected
func set_selected(v: bool):
Parameters
v
is_selected
func is_selected() -> bool:
Returns
get_active_placeable
func get_active_placeable() -> Resource:
Returns
get_active_variant_index
func get_active_variant_index() -> int:
Returns
get_active_display_name
func get_active_display_name() -> String:
Returns
Events
selected
Emitted when this entry is selected by the user.
signal selected(entry: PlaceableListEntry)
variant_changed
Emitted after cycling to a different variant. Use variant_index to query the active object.
signal variant_changed(entry: PlaceableListEntry, variant_index: int)