Merge pull request #91622 from Daylily-Zeleen/daylily-zeleen/limit_icon_size_in_EditorDebuggerTree

Limit icon size in `EditorDebuggerTree`.
This commit is contained in:
Rémi Verschelde 2024-05-28 15:48:37 +02:00
commit b0ba8ac0e2
No known key found for this signature in database
GPG Key ID: C3336907360768E1
3 changed files with 17 additions and 1 deletions

View File

@ -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: {

View File

@ -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 "";

View File

@ -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.