From b941459719d32f3b81798a9abcb95b133417f050 Mon Sep 17 00:00:00 2001 From: Daylily-Zeleen Date: Mon, 6 May 2024 23:20:59 +0800 Subject: [PATCH] Limit icon size in EditorDebuggerTree. --- editor/debugger/editor_debugger_node.cpp | 8 +++++++- editor/debugger/editor_debugger_tree.cpp | 9 +++++++++ editor/debugger/editor_debugger_tree.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 1d3c7aec3fe..2f7183b8834 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -314,12 +314,18 @@ void EditorDebuggerNode::stop(bool p_force) { void EditorDebuggerNode::_notification(int p_what) { switch (p_what) { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - if (tabs->get_tab_count() > 1 && EditorThemeManager::is_generated_theme_outdated()) { + if (!EditorThemeManager::is_generated_theme_outdated()) { + return; + } + + if (tabs->get_tab_count() > 1) { add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SNAME("BottomPanelDebuggerOverride"), EditorStringName(EditorStyles))->get_margin(SIDE_LEFT)); add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SNAME("BottomPanelDebuggerOverride"), EditorStringName(EditorStyles))->get_margin(SIDE_RIGHT)); tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SNAME("DebuggerPanel"), EditorStringName(EditorStyles))); } + + remote_scene_tree->update_icon_max_width(); } break; case NOTIFICATION_READY: { diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index 63053d2574d..12b590da3cd 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -31,6 +31,7 @@ #include "editor_debugger_tree.h" #include "editor/editor_node.h" +#include "editor/editor_string_names.h" #include "editor/gui/editor_file_dialog.h" #include "editor/scene_tree_dock.h" #include "scene/debugger/scene_debugger.h" @@ -62,6 +63,10 @@ void EditorDebuggerTree::_notification(int p_what) { connect("item_collapsed", callable_mp(this, &EditorDebuggerTree::_scene_tree_folded)); connect("item_mouse_selected", callable_mp(this, &EditorDebuggerTree::_scene_tree_rmb_selected)); } break; + + case NOTIFICATION_ENTER_TREE: { + update_icon_max_width(); + } break; } } @@ -293,6 +298,10 @@ Variant EditorDebuggerTree::get_drag_data(const Point2 &p_point) { return vformat("\"%s\"", path); } +void EditorDebuggerTree::update_icon_max_width() { + add_theme_constant_override("icon_max_width", get_theme_constant("class_icon_size", EditorStringName(Editor))); +} + String EditorDebuggerTree::get_selected_path() { if (!get_selected()) { return ""; diff --git a/editor/debugger/editor_debugger_tree.h b/editor/debugger/editor_debugger_tree.h index 895f33f1a26..dbffb0f219b 100644 --- a/editor/debugger/editor_debugger_tree.h +++ b/editor/debugger/editor_debugger_tree.h @@ -72,6 +72,7 @@ public: virtual Variant get_drag_data(const Point2 &p_point) override; + void update_icon_max_width(); String get_selected_path(); ObjectID get_selected_object(); int get_current_debugger(); // Would love to have one tree for every debugger.