Updated dialogic

This commit is contained in:
MaddoScientisto 2026-01-05 16:00:41 +01:00
commit cbb82512ee
483 changed files with 5743 additions and 2177 deletions

View file

@ -23,6 +23,7 @@ var resource_icon: Texture:
var max_width := 200
var current_value: String
var hide_reset := false
var show_editing_button := false
#endregion
@ -36,6 +37,9 @@ func _ready() -> void:
%OpenButton.icon = get_theme_icon("Folder", "EditorIcons")
%OpenButton.button_down.connect(_on_OpenButton_pressed)
%EditButton.icon = get_theme_icon("Edit", "EditorIcons")
%EditButton.button_down.connect(_on_EditButton_pressed)
%ClearButton.icon = get_theme_icon("Reload", "EditorIcons")
%ClearButton.button_up.connect(clear_path)
%ClearButton.visible = !hide_reset
@ -72,6 +76,8 @@ func _set_value(value: Variant) -> void:
%Field.custom_minimum_size.x = 0
%Field.expand_to_text_length = true
%EditButton.visible = show_editing_button and value
if not %Field.text == text:
value_changed.emit(property_name, current_value)
%Field.text = text
@ -94,6 +100,11 @@ func _on_file_dialog_selected(path:String) -> void:
value_changed.emit(property_name, path)
func _on_EditButton_pressed() -> void:
if ResourceLoader.exists(current_value):
EditorInterface.inspect_object(load(current_value), "", true)
func clear_path() -> void:
_set_value("")
value_changed.emit(property_name, "")
@ -134,6 +145,8 @@ func _on_field_focus_entered() -> void:
func _on_field_focus_exited() -> void:
$FocusStyle.hide()
var field_text: String = %Field.text
if current_value == field_text or (file_mode != EditorFileDialog.FILE_MODE_OPEN_DIR and current_value.get_file() == field_text):
return
_on_file_dialog_selected(field_text)
#endregion