From fb58ea6c89ff3f9e970e436982c76e96adccdefc Mon Sep 17 00:00:00 2001 From: Bogdan Inculet Date: Sat, 17 Feb 2024 06:06:09 +0200 Subject: [PATCH] Fixed Remote Nodes missing custom icons --- editor/debugger/editor_debugger_tree.cpp | 5 ++++- editor/editor_node.cpp | 10 +++++++++- scene/debugger/scene_debugger.cpp | 16 +++++++++++++++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index c4d7899b2d1..a9008426514 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -277,11 +277,14 @@ Variant EditorDebuggerTree::get_drag_data(const Point2 &p_point) { } String path = selected->get_text(0); + const int icon_size = get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)); HBoxContainer *hb = memnew(HBoxContainer); TextureRect *tf = memnew(TextureRect); tf->set_texture(selected->get_icon(0)); - tf->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED); + tf->set_custom_minimum_size(Size2(icon_size, icon_size)); + tf->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED); + tf->set_expand_mode(TextureRect::EXPAND_IGNORE_SIZE); hb->add_child(tf); Label *label = memnew(Label(path)); hb->add_child(label); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 95b3c30d1b0..dd6c88ef25f 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4771,7 +4771,13 @@ Ref EditorNode::_get_class_or_script_icon(const String &p_class, cons // Look for the native base type in the editor theme. This is relevant for // scripts extending other scripts and for built-in classes. String script_class_name = p_script->get_language()->get_global_class_name(p_script->get_path()); - String base_type = ScriptServer::get_global_class_native_base(script_class_name); + String base_type; + if (script_class_name.is_empty()) { + base_type = p_script->get_instance_base_type(); + } else { + base_type = ScriptServer::get_global_class_native_base(script_class_name); + } + if (theme.is_valid() && theme->has_icon(base_type, EditorStringName(EditorIcons))) { return theme->get_icon(base_type, EditorStringName(EditorIcons)); } @@ -4836,6 +4842,8 @@ Ref EditorNode::get_class_icon(const String &p_class, const String &p Ref