diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml
index 915972b1405..2bc6cf5b379 100644
--- a/doc/classes/EditorPlugin.xml
+++ b/doc/classes/EditorPlugin.xml
@@ -430,7 +430,7 @@
- Adds a control to the bottom panel (together with Output, Debug, Animation, etc.). Returns a reference to the button added. It's up to you to hide/show the button when needed. When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_bottom_panel] and free it with [method Node.queue_free].
+ Adds a control to the bottom panel (together with Output, Debug, Animation, etc.). Returns a reference to a button that is outside the scene tree. It's up to you to hide/show the button when needed. When your plugin is deactivated, make sure to remove your custom control with [method remove_control_from_bottom_panel] and free it with [method Node.queue_free].
Optionally, you can specify a shortcut parameter. When pressed, this shortcut will toggle the bottom panel's visibility. See the default editor bottom panel shortcuts in the Editor Settings for inspiration. Per convention, they all use [kbd]Alt[/kbd] modifier.
diff --git a/editor/debugger/debugger_editor_plugin.cpp b/editor/debugger/debugger_editor_plugin.cpp
index ba036d2ad45..630de7a6861 100644
--- a/editor/debugger/debugger_editor_plugin.cpp
+++ b/editor/debugger/debugger_editor_plugin.cpp
@@ -55,8 +55,7 @@ DebuggerEditorPlugin::DebuggerEditorPlugin(PopupMenu *p_debug_menu) {
file_server = memnew(EditorFileServer);
EditorDebuggerNode *debugger = memnew(EditorDebuggerNode);
- Button *db = EditorNode::get_bottom_panel()->add_item(TTRC("Debugger"), debugger, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_debugger_bottom_panel", TTRC("Toggle Debugger Bottom Panel"), KeyModifierMask::ALT | Key::D));
- debugger->set_tool_button(db);
+ EditorNode::get_bottom_panel()->add_item(TTRC("Debugger"), debugger, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_debugger_bottom_panel", TTRC("Toggle Debugger Bottom Panel"), KeyModifierMask::ALT | Key::D));
// Main editor debug menu.
debug_menu = p_debug_menu;
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp
index e30b6d671d7..b162347edfc 100644
--- a/editor/debugger/editor_debugger_node.cpp
+++ b/editor/debugger/editor_debugger_node.cpp
@@ -441,26 +441,35 @@ void EditorDebuggerNode::_update_errors() {
dbg->update_tabs();
});
- if (error_count == 0 && warning_count == 0) {
- debugger_button->set_text(TTR("Debugger"));
- debugger_button->remove_theme_color_override(SceneStringName(font_color));
- debugger_button->set_button_icon(Ref());
- } else {
- debugger_button->set_text(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")");
- if (error_count >= 1 && warning_count >= 1) {
- debugger_button->set_button_icon(get_editor_theme_icon(SNAME("ErrorWarning")));
- // Use error color to represent the highest level of severity reported.
- debugger_button->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
- } else if (error_count >= 1) {
- debugger_button->set_button_icon(get_editor_theme_icon(SNAME("Error")));
- debugger_button->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
- } else {
- debugger_button->set_button_icon(get_editor_theme_icon(SNAME("Warning")));
- debugger_button->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
- }
- }
last_error_count = error_count;
last_warning_count = warning_count;
+
+ // TODO: Replace logic when EditorDock class is merged to be more flexible.
+ TabContainer *parent = Object::cast_to(get_parent());
+ if (!parent) {
+ return;
+ }
+
+ int idx = parent->get_tab_idx_from_control(this);
+
+ if (error_count == 0 && warning_count == 0) {
+ set_name(TTR("Debugger"));
+ parent->set_tab_icon(idx, Ref());
+ parent->get_tab_bar()->set_font_color_override_all(idx, Color(0, 0, 0, 0));
+ } else {
+ set_name(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")");
+ if (error_count >= 1 && warning_count >= 1) {
+ parent->set_tab_icon(idx, get_editor_theme_icon(SNAME("ErrorWarning")));
+ // Use error color to represent the highest level of severity reported.
+ parent->get_tab_bar()->set_font_color_override_all(idx, get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ } else if (error_count >= 1) {
+ parent->set_tab_icon(idx, get_editor_theme_icon(SNAME("Error")));
+ parent->get_tab_bar()->set_font_color_override_all(idx, get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
+ } else {
+ parent->set_tab_icon(idx, get_editor_theme_icon(SNAME("Warning")));
+ parent->get_tab_bar()->set_font_color_override_all(idx, get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
+ }
+ }
}
}
diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h
index 7e573368f47..a2b9ab2d84b 100644
--- a/editor/debugger/editor_debugger_node.h
+++ b/editor/debugger/editor_debugger_node.h
@@ -93,7 +93,6 @@ private:
Ref server;
TabContainer *tabs = nullptr;
- Button *debugger_button = nullptr;
MenuButton *script_menu = nullptr;
Ref