diff options
author | kobewi <kobewi4e@gmail.com> | 2023-04-09 09:40:14 +0200 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-04-24 14:04:19 +0200 |
commit | 8c372f4109f1bcf75a02923aca4292e2bee38b3a (patch) | |
tree | 6f0c43f413961d72773cd506f786048e7e9facf6 /editor | |
parent | d0c50d820be88882161093b76846e0a9995b4e0a (diff) |
Fix method dialog label
(cherry picked from commit c399d4f26c6f0836d90455defc7f2cee1d1b9678)
Diffstat (limited to 'editor')
-rw-r--r-- | editor/connections_dialog.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
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); |