summaryrefslogtreecommitdiffstats
path: root/editor/editor_data.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-08-29 12:41:03 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-08-29 12:41:03 +0200
commit91c5273ec58aafd3b86e9a1e21640b0949842a78 (patch)
tree10848c3b63f19f27d184e958cfcd6dfb640a6cf1 /editor/editor_data.cpp
parent31cfa603a552c11c397c48500b1af3f0e77049c9 (diff)
parent2c77f07aaa4c04c6f439a4636156ba234f6d2e13 (diff)
downloadredot-engine-91c5273ec58aafd3b86e9a1e21640b0949842a78.tar.gz
Merge pull request #75656 from YuriSizov/core-iconic-builtins
Add a script method to get its class icon
Diffstat (limited to 'editor/editor_data.cpp')
-rw-r--r--editor/editor_data.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 5ea5553cd3..d8749aa290 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -1122,8 +1122,14 @@ Ref<Texture2D> EditorData::get_script_icon(const Ref<Script> &p_script) {
Ref<Script> base_scr = p_script;
while (base_scr.is_valid()) {
// Check for scripted classes.
+ String icon_path;
StringName class_name = script_class_get_name(base_scr->get_path());
- String icon_path = script_class_get_icon_path(class_name);
+ if (base_scr->is_built_in() || class_name == StringName()) {
+ icon_path = base_scr->get_class_icon_path();
+ } else {
+ icon_path = script_class_get_icon_path(class_name);
+ }
+
Ref<Texture2D> icon = _load_script_icon(icon_path);
if (icon.is_valid()) {
_script_icon_cache[p_script] = icon;