From 2d03275c88b277a3adcd2066ba7f1fed33949ec4 Mon Sep 17 00:00:00 2001 From: fkeyz Date: Tue, 23 Sep 2025 01:47:05 +0300 Subject: [PATCH] Add drag and drop info label --- doc/classes/EditorSettings.xml | 3 ++ editor/script/script_text_editor.cpp | 71 ++++++++++++++++++++++++++++ editor/script/script_text_editor.h | 4 ++ editor/settings/editor_settings.cpp | 3 ++ 4 files changed, 81 insertions(+) diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 3ff97c399e..b6fe3b6363 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -1366,6 +1366,9 @@ The shape of the caret to use in the script editor. [b]Line[/b] displays a vertical line to the left of the current character, whereas [b]Block[/b] displays an outline over the current character. + + If [code]true[/code], shows an info label listing available drop options when dragging an object into the script text editor. + If [code]true[/code], displays a colored button before any [Color] constructor in the script editor. Clicking on them allows the color to be modified through a color picker. diff --git a/editor/script/script_text_editor.cpp b/editor/script/script_text_editor.cpp index 14b03b9aee..4ebfbfb4ca 100644 --- a/editor/script/script_text_editor.cpp +++ b/editor/script/script_text_editor.cpp @@ -54,6 +54,7 @@ #include "scene/gui/menu_button.h" #include "scene/gui/rich_text_label.h" #include "scene/gui/split_container.h" +#include "scene/resources/style_box_flat.h" void ConnectionInfoDialog::ok_pressed() { } @@ -296,6 +297,14 @@ void ScriptTextEditor::_load_theme_settings() { folded_code_region_color = updated_folded_code_region_color; } + Ref drag_info_sb = drag_info_label->get_theme_stylebox(CoreStringName(normal)); + drag_info_sb->set_bg_color(EDITOR_GET("text_editor/theme/highlighting/completion_background_color")); + Color info_color = EDITOR_GET("text_editor/theme/highlighting/text_color"); + info_color.a = 0.5f; + drag_info_sb->set_border_color(info_color); + info_color.a = 0.7f; + drag_info_label->add_theme_color_override(SceneStringName(font_color), info_color); + theme_loaded = true; Ref