43 lines
1.1 KiB
GDScript
43 lines
1.1 KiB
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()
|
|
)
|
|
|
|
|
|
func fill_from_dictionary(overrides: Dictionary) -> void:
|
|
for override in overrides:
|
|
var item: OverrideEditorSettingsMenuItem = ITEM_SCENE.instantiate()
|
|
add_item(item)
|
|
item.fill(override, overrides[override])
|