From 91e2e0c622dd1183134978cd92a1e03838e3abe3 Mon Sep 17 00:00:00 2001 From: Jowan-Spooner Date: Tue, 9 Jan 2024 12:40:15 +0100 Subject: [PATCH] Small fixes --- addons/dialogic/Editor/Events/Fields/field_file.gd | 8 ++++++-- addons/dialogic/Editor/Events/Fields/field_file.tscn | 2 +- .../Editor/Events/Fields/field_options_dynamic.gd | 6 ------ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/addons/dialogic/Editor/Events/Fields/field_file.gd b/addons/dialogic/Editor/Events/Fields/field_file.gd index c24d71648..15d3dd8b9 100644 --- a/addons/dialogic/Editor/Events/Fields/field_file.gd +++ b/addons/dialogic/Editor/Events/Fields/field_file.gd @@ -20,7 +20,7 @@ var resource_icon:Texture: else: %Field.theme_type_variation = "LineEditWithIcon" -var max_text_length := 16 +var max_width := 200 var current_value : String var hide_reset:bool = false @@ -59,8 +59,12 @@ func _set_value(value:Variant) -> void: if file_mode != EditorFileDialog.FILE_MODE_OPEN_DIR: text = value.get_file() %Field.tooltip_text = value - if len(text) > max_text_length: + + if %Field.get_theme_font('font').get_string_size( + text, 0, -1, + %Field.get_theme_font_size('font_size')).x > max_width: %Field.expand_to_text_length = false + %Field.custom_minimum_size.x = max_width %Field.size.x = 0 else: %Field.custom_minimum_size.x = 0 diff --git a/addons/dialogic/Editor/Events/Fields/field_file.tscn b/addons/dialogic/Editor/Events/Fields/field_file.tscn index 7c0d73c93..c0e51dace 100644 --- a/addons/dialogic/Editor/Events/Fields/field_file.tscn +++ b/addons/dialogic/Editor/Events/Fields/field_file.tscn @@ -34,7 +34,7 @@ border_width_bottom = 2 corner_detail = 1 [node name="Field_File" type="MarginContainer"] -offset_right = 160.0 +offset_right = 314.0 offset_bottom = 40.0 theme_type_variation = &"DialogicEventEdit" script = ExtResource("1_0grcf") diff --git a/addons/dialogic/Editor/Events/Fields/field_options_dynamic.gd b/addons/dialogic/Editor/Events/Fields/field_options_dynamic.gd index 323ab83c0..7356194b9 100644 --- a/addons/dialogic/Editor/Events/Fields/field_options_dynamic.gd +++ b/addons/dialogic/Editor/Events/Fields/field_options_dynamic.gd @@ -9,8 +9,6 @@ extends DialogicVisualEditorField @export var empty_text := "" enum Modes {PURE_STRING, PRETTY_PATH, IDENTIFIER} @export var mode := Modes.PURE_STRING - -#@export var enable_pretty_name := false @export var fit_text_length := true var collapse_when_empty := false var valid_file_drop_extension := "" @@ -158,10 +156,6 @@ func suggestion_selected(index : int, position:=Vector2(), button_index:=MOUSE_B if %Suggestions.get_item_metadata(index) == null: current_value = "" - ## if this is a resource, then load it instead of assigning the string: - #elif file_extension != "" and file_extension != ".dch" and file_extension != ".dtl": - #var file = load(%Suggestions.get_item_metadata(index)) - #current_value = file else: current_value = %Suggestions.get_item_metadata(index)