From ab04d76e0e4e95430a0d0dc4e0067286f3832e66 Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Wed, 4 Sep 2024 17:00:57 +0200 Subject: [PATCH] [Editor] Prevent duplicate `Open in Editor` buttons in scene tree dock Duplicate buttons were added when editor description changed --- editor/gui/scene_tree_editor.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/editor/gui/scene_tree_editor.cpp b/editor/gui/scene_tree_editor.cpp index 52ba98b4d5c..07629270291 100644 --- a/editor/gui/scene_tree_editor.cpp +++ b/editor/gui/scene_tree_editor.cpp @@ -491,10 +491,14 @@ void SceneTreeEditor::_update_node_tooltip(Node *p_node, TreeItem *p_item) { String tooltip = p_node->get_name(); if (p_node == get_scene_node() && p_node->get_scene_inherited_state().is_valid()) { - p_item->add_button(0, get_editor_theme_icon(SNAME("InstanceOptions")), BUTTON_SUBSCENE, false, TTR("Open in Editor")); + if (p_item->get_button_by_id(0, BUTTON_SUBSCENE) == -1) { + p_item->add_button(0, get_editor_theme_icon(SNAME("InstanceOptions")), BUTTON_SUBSCENE, false, TTR("Open in Editor")); + } tooltip += String("\n" + TTR("Inherits:") + " " + p_node->get_scene_inherited_state()->get_path()); } else if (p_node != get_scene_node() && !p_node->get_scene_file_path().is_empty() && can_open_instance) { - p_item->add_button(0, get_editor_theme_icon(SNAME("InstanceOptions")), BUTTON_SUBSCENE, false, TTR("Open in Editor")); + if (p_item->get_button_by_id(0, BUTTON_SUBSCENE) == -1) { + p_item->add_button(0, get_editor_theme_icon(SNAME("InstanceOptions")), BUTTON_SUBSCENE, false, TTR("Open in Editor")); + } tooltip += String("\n" + TTR("Instance:") + " " + p_node->get_scene_file_path()); }