30 lines
991 B
GDScript
30 lines
991 B
GDScript
extends HBoxContainer
|
|
class_name OverrideEditorSettingsMenuItem
|
|
|
|
@onready var property_name_line_edit: LineEdit = %PropertyNameLineEdit
|
|
@onready var property_type_option_button: OptionButton = %PropertyTypeOptionButton
|
|
@onready var property_value_line_edit: LineEdit = %PropertyValueLineEdit
|
|
@onready var delete_item_button: Button = %DeleteItemButton
|
|
|
|
|
|
func _ready() -> void:
|
|
# for now, type is just a hint for the convert function.
|
|
# in the future, there will be custom editors for types, like godot's inspector.
|
|
# update: convert() is fucking broken.
|
|
# for type in TYPE_MAX:
|
|
# property_type_option_button.add_item(TYPE_NAMES[type])
|
|
|
|
delete_item_button.pressed.connect(queue_free)
|
|
|
|
|
|
func get_property() -> Dictionary:
|
|
var prop_name = property_name_line_edit.text
|
|
var value = str_to_var(property_value_line_edit.text)
|
|
|
|
return {prop_name: value}
|
|
|
|
|
|
func fill(key: String, value: Variant) -> void:
|
|
property_name_line_edit.text = key
|
|
property_value_line_edit.text = var_to_str(value)
|