From 8c372f4109f1bcf75a02923aca4292e2bee38b3a Mon Sep 17 00:00:00 2001 From: kobewi Date: Sun, 9 Apr 2023 09:40:14 +0200 Subject: Fix method dialog label (cherry picked from commit c399d4f26c6f0836d90455defc7f2cee1d1b9678) --- editor/connections_dialog.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'editor') diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index fc7a9b05d3..ddbbdb1c6a 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -338,11 +338,6 @@ void ConnectDialog::_update_method_tree() { // If a script is attached, get methods from it. ScriptInstance *si = target->get_script_instance(); if (si) { - TreeItem *si_item = method_tree->create_item(root_item); - si_item->set_text(0, TTR("Attached Script")); - si_item->set_icon(0, get_theme_icon(SNAME("Script"), SNAME("EditorIcons"))); - si_item->set_selectable(0, false); - if (si->get_script()->is_built_in()) { si->get_script()->reload(); } @@ -350,9 +345,12 @@ void ConnectDialog::_update_method_tree() { si->get_method_list(&methods); methods = _filter_method_list(methods, signal_info, search_string); - if (methods.is_empty()) { - si_item->set_custom_color(0, disabled_color); - } else { + if (!methods.is_empty()) { + TreeItem *si_item = method_tree->create_item(root_item); + si_item->set_text(0, TTR("Attached Script")); + si_item->set_icon(0, get_theme_icon(SNAME("Script"), SNAME("EditorIcons"))); + si_item->set_selectable(0, false); + _create_method_tree_items(methods, si_item); } } @@ -687,8 +685,10 @@ ConnectDialog::ConnectDialog() { method_tree->connect("item_activated", callable_mp((Window *)method_popup, &Window::hide)); empty_tree_label = memnew(Label(TTR("No method found matching given filters."))); - method_tree->add_child(empty_tree_label); - empty_tree_label->set_anchors_and_offsets_preset(Control::PRESET_CENTER); + method_popup->add_child(empty_tree_label); + empty_tree_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER); + empty_tree_label->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER); + empty_tree_label->set_autowrap_mode(TextServer::AUTOWRAP_WORD); script_methods_only = memnew(CheckButton(TTR("Script Methods Only"))); method_vbc->add_child(script_methods_only); -- cgit v1.2.3