2023-03-06 08:26:42 +00:00
|
|
|
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(
|
2023-03-06 09:03:52 +00:00
|
|
|
func():
|
|
|
|
add_item(ITEM_SCENE.instantiate())
|
|
|
|
)
|
2023-03-06 08:26:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
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
|
2023-03-06 13:33:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
func clear() -> void:
|
|
|
|
override_item_container.get_children().map(
|
|
|
|
func(c: OverrideEditorSettingsMenuItem):
|
|
|
|
c.queue_free()
|
|
|
|
)
|