yagvm/UI/Components/OverrideEditorSettingsMenu/OverrideEditorSettingsMenu.gd

36 lines
867 B
GDScript

extends VBoxContainer
class_name OverrideEditorSettingsMenu
const ITEM_SCENE := preload("res://UI/Components/OverrideEditorSettingsMenu/OverrideEditorSettingsMenuItem.tscn")
@onready var override_item_container: VBoxContainer = %OverrideItemContainer
@onready var new_override_button: Button = %NewOverrideButton
func _ready() -> void:
new_override_button.pressed.connect(
func():
add_item(ITEM_SCENE.instantiate())
)
func add_item(item: OverrideEditorSettingsMenuItem) -> void:
override_item_container.add_child(item)
func get_overrides() -> Dictionary:
var res := {}
for item in override_item_container.get_children():
item = item as OverrideEditorSettingsMenuItem
res.merge(item.get_property())
return res
func clear() -> void:
override_item_container.get_children().map(
func(c: OverrideEditorSettingsMenuItem):
c.queue_free()
)