remove types and convert() function usage from OverrideEditorSettingsMenuItem

see https://github.com/godotengine/godot/issues/65919 for details
This commit is contained in:
Lera Elvoé 2023-03-06 12:03:14 +03:00
parent 2321735df8
commit c3fd701491
Signed by: yagich
SSH Key Fingerprint: SHA256:6xjGb6uA7lAVcULa7byPEN//rQ0wPoG+UzYVMfZnbvc
2 changed files with 5 additions and 45 deletions

View File

@ -1,48 +1,6 @@
extends HBoxContainer
class_name OverrideEditorSettingsMenuItem
# god help me
const TYPE_NAMES := {
TYPE_NIL: "Type: Nil",
TYPE_BOOL: "Type: Bool",
TYPE_INT: "Type: Int",
TYPE_FLOAT: "Type: Float",
TYPE_STRING: "Type: String",
TYPE_VECTOR2: "Type: Vector2",
TYPE_VECTOR2I: "Type: Vector2i",
TYPE_RECT2: "Type: Rect2",
TYPE_RECT2I: "Type: Rect2i",
TYPE_VECTOR3: "Type: Vector3",
TYPE_VECTOR3I: "Type: Vector3i",
TYPE_TRANSFORM2D: "Type: Transform2D",
TYPE_VECTOR4: "Type: Vector4",
TYPE_VECTOR4I: "Type: Vector4i",
TYPE_PLANE: "Type: Plane",
TYPE_QUATERNION: "Type: Quaternion",
TYPE_AABB: "Type: AABB",
TYPE_BASIS: "Type: Basis",
TYPE_TRANSFORM3D: "Type: Transform3D",
TYPE_PROJECTION: "Type: Projection",
TYPE_COLOR: "Type: Color",
TYPE_STRING_NAME: "Type: StringName",
TYPE_NODE_PATH: "Type: NodePath",
TYPE_RID: "Type: RID",
TYPE_OBJECT: "Type: Object",
TYPE_CALLABLE: "Type: Callable",
TYPE_SIGNAL: "Type: Signal",
TYPE_DICTIONARY: "Type: Dictionary",
TYPE_ARRAY: "Type: Array",
TYPE_PACKED_BYTE_ARRAY: "Type: PackedByteArray",
TYPE_PACKED_INT32_ARRAY: "Type: PackedInt32Array",
TYPE_PACKED_INT64_ARRAY: "Type: PackedInt64Array",
TYPE_PACKED_FLOAT32_ARRAY: "Type: PackedFloat32Array",
TYPE_PACKED_FLOAT64_ARRAY: "Type: PackedFloat64Array",
TYPE_PACKED_STRING_ARRAY: "Type: PackedStringArray",
TYPE_PACKED_VECTOR2_ARRAY: "Type: PackedVector2Array",
TYPE_PACKED_VECTOR3_ARRAY: "Type: PackedVector3Array",
TYPE_PACKED_COLOR_ARRAY: "Type: PackedColorArray",
}
@onready var property_name_line_edit: LineEdit = %PropertyNameLineEdit
@onready var property_type_option_button: OptionButton = %PropertyTypeOptionButton
@onready var property_value_line_edit: LineEdit = %PropertyValueLineEdit
@ -52,14 +10,15 @@ const TYPE_NAMES := {
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.
for type in TYPE_MAX:
property_type_option_button.add_item(TYPE_NAMES[type])
# 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 = convert(property_value_line_edit.text, property_type_option_button.get_selected_id())
var value = str_to_var(prop_name)
return {prop_name: value}

View File

@ -15,6 +15,7 @@ placeholder_text = "Property name"
[node name="PropertyTypeOptionButton" type="OptionButton" parent="."]
unique_name_in_owner = true
visible = false
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.72