@@ -65,12 +65,6 @@ EditorDebuggerNode::EditorDebuggerNode() {
6565 singleton = this ;
6666 }
6767
68- Ref<StyleBox> bottom_panel_margins = EditorNode::get_singleton ()->get_editor_theme ()->get_stylebox (SNAME (" BottomPanel" ), EditorStringName (EditorStyles));
69- add_theme_constant_override (" margin_top" , -bottom_panel_margins->get_margin (SIDE_TOP));
70- add_theme_constant_override (" margin_left" , -bottom_panel_margins->get_margin (SIDE_LEFT));
71- add_theme_constant_override (" margin_right" , -bottom_panel_margins->get_margin (SIDE_RIGHT));
72- add_theme_constant_override (" margin_bottom" , -bottom_panel_margins->get_margin (SIDE_BOTTOM));
73-
7468 tabs = memnew (TabContainer);
7569 tabs->set_tabs_visible (false );
7670 tabs->connect (" tab_changed" , callable_mp (this , &EditorDebuggerNode::_debugger_changed));
@@ -332,17 +326,19 @@ void EditorDebuggerNode::_notification(int p_what) {
332326 if (tabs->get_tab_count () > 1 ) {
333327 tabs->add_theme_style_override (SceneStringName (panel), EditorNode::get_singleton ()->get_editor_theme ()->get_stylebox (SNAME (" DebuggerPanel" ), EditorStringName (EditorStyles)));
334328 }
335-
336- Ref<StyleBox> bottom_panel_margins = EditorNode::get_singleton ()->get_editor_theme ()->get_stylebox (SNAME (" BottomPanel" ), EditorStringName (EditorStyles));
337- add_theme_constant_override (" margin_top" , -bottom_panel_margins->get_margin (SIDE_TOP));
338- add_theme_constant_override (" margin_left" , -bottom_panel_margins->get_margin (SIDE_LEFT));
339- add_theme_constant_override (" margin_right" , -bottom_panel_margins->get_margin (SIDE_RIGHT));
340- add_theme_constant_override (" margin_bottom" , -bottom_panel_margins->get_margin (SIDE_BOTTOM));
329+ _update_margins ();
341330
342331 remote_scene_tree->update_icon_max_width ();
343332 } break ;
344333
345334 case NOTIFICATION_READY: {
335+ // TODO: Replace this hack once EditorDebuggerNode is converted to a dock. It should be in the constructor.
336+ EditorDock *parent = Object::cast_to<EditorDock>(get_parent ());
337+ if (parent) {
338+ parent->set_clip_contents (false );
339+ _update_margins ();
340+ }
341+
346342 _update_debug_options ();
347343 initializing = false ;
348344 } break ;
@@ -444,35 +440,41 @@ void EditorDebuggerNode::_update_errors() {
444440 last_error_count = error_count;
445441 last_warning_count = warning_count;
446442
447- // TODO: Replace logic when EditorDock class is merged to be more flexible .
448- TabContainer *parent = Object::cast_to<TabContainer >(get_parent ());
443+ // TODO: Replace this hack once EditorDebuggerNode is converted to a dock .
444+ EditorDock *parent = Object::cast_to<EditorDock >(get_parent ());
449445 if (!parent) {
450446 return ;
451447 }
452448
453- int idx = parent->get_tab_idx_from_control (this );
454-
455449 if (error_count == 0 && warning_count == 0 ) {
456450 set_name (TTR (" Debugger" ));
457- parent->set_tab_icon (idx, Ref<Texture2D>());
458- parent->get_tab_bar ()-> set_font_color_override_all (idx, Color (0 , 0 , 0 , 0 ));
451+ parent->set_dock_icon ( Ref<Texture2D>());
452+ parent->set_title_color ( Color (0 , 0 , 0 , 0 ));
459453 } else {
460454 set_name (TTR (" Debugger" ) + " (" + itos (error_count + warning_count) + " )" );
461455 if (error_count >= 1 && warning_count >= 1 ) {
462- parent->set_tab_icon (idx, get_editor_theme_icon (SNAME (" ErrorWarning" )));
456+ parent->set_dock_icon ( get_editor_theme_icon (SNAME (" ErrorWarning" )));
463457 // Use error color to represent the highest level of severity reported.
464- parent->get_tab_bar ()-> set_font_color_override_all (idx, get_theme_color (SNAME (" error_color" ), EditorStringName (Editor)));
458+ parent->set_title_color ( get_theme_color (SNAME (" error_color" ), EditorStringName (Editor)));
465459 } else if (error_count >= 1 ) {
466- parent->set_tab_icon (idx, get_editor_theme_icon (SNAME (" Error" )));
467- parent->get_tab_bar ()-> set_font_color_override_all (idx, get_theme_color (SNAME (" error_color" ), EditorStringName (Editor)));
460+ parent->set_dock_icon ( get_editor_theme_icon (SNAME (" Error" )));
461+ parent->set_title_color ( get_theme_color (SNAME (" error_color" ), EditorStringName (Editor)));
468462 } else {
469- parent->set_tab_icon (idx, get_editor_theme_icon (SNAME (" Warning" )));
470- parent->get_tab_bar ()-> set_font_color_override_all (idx, get_theme_color (SNAME (" warning_color" ), EditorStringName (Editor)));
463+ parent->set_dock_icon ( get_editor_theme_icon (SNAME (" Warning" )));
464+ parent->set_title_color ( get_theme_color (SNAME (" warning_color" ), EditorStringName (Editor)));
471465 }
472466 }
473467 }
474468}
475469
470+ void EditorDebuggerNode::_update_margins () {
471+ Ref<StyleBox> bottom_panel_margins = EditorNode::get_singleton ()->get_editor_theme ()->get_stylebox (SNAME (" BottomPanel" ), EditorStringName (EditorStyles));
472+ add_theme_constant_override (" margin_top" , -bottom_panel_margins->get_margin (SIDE_TOP));
473+ add_theme_constant_override (" margin_left" , -bottom_panel_margins->get_margin (SIDE_LEFT));
474+ add_theme_constant_override (" margin_right" , -bottom_panel_margins->get_margin (SIDE_RIGHT));
475+ add_theme_constant_override (" margin_bottom" , -bottom_panel_margins->get_margin (SIDE_BOTTOM));
476+ }
477+
476478void EditorDebuggerNode::_debugger_stopped (int p_id) {
477479 ScriptEditorDebugger *dbg = get_debugger (p_id);
478480 ERR_FAIL_NULL (dbg);
0 commit comments