2023-03-06 08:26:42 +00:00
|
|
|
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.
|
2023-03-06 09:03:14 +00:00
|
|
|
# update: convert() is fucking broken.
|
|
|
|
# for type in TYPE_MAX:
|
|
|
|
# property_type_option_button.add_item(TYPE_NAMES[type])
|
2023-03-06 08:26:42 +00:00
|
|
|
|
|
|
|
delete_item_button.pressed.connect(queue_free)
|
|
|
|
|
|
|
|
|
|
|
|
func get_property() -> Dictionary:
|
|
|
|
var prop_name = property_name_line_edit.text
|
2023-03-08 07:24:34 +00:00
|
|
|
var value = str_to_var(property_value_line_edit.text)
|
2023-03-06 08:26:42 +00:00
|
|
|
|
|
|
|
return {prop_name: value}
|
2023-03-08 07:24:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
func fill(key: String, value: Variant) -> void:
|
|
|
|
property_name_line_edit.text = key
|
|
|
|
property_value_line_edit.text = var_to_str(value)
|