From 95b4f972e6f71ef366330f944820a430b272f287 Mon Sep 17 00:00:00 2001 From: Tomasz Chabora Date: Mon, 6 Jul 2020 00:06:37 +0200 Subject: [PATCH] Support built-in scripts for inspector categories --- editor/editor_inspector.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 77423820480..cf32ffb4e07 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -1592,7 +1592,9 @@ void EditorInspector::update_tree() { } } if (category->icon.is_null()) { - category->icon = EditorNode::get_singleton()->get_class_icon(type, "Object"); + if (type != String()) { // Can happen for built-in scripts. + category->icon = EditorNode::get_singleton()->get_class_icon(type, "Object"); + } } category->label = type; @@ -2405,9 +2407,12 @@ void EditorInspector::_update_script_class_properties(const Object &p_object, Li String n = EditorNode::get_editor_data().script_class_get_name(script->get_path()); if (n.length()) { classes.push_front(n); - } else { + } else if (script->get_path() != String() && script->get_path().find("::") == -1) { n = script->get_path().get_file(); classes.push_front(n); + } else { + n = TTR("Built-in script"); + classes.push_front(n); } paths[n] = script->get_path(); script = script->get_base_script(); @@ -2436,7 +2441,14 @@ void EditorInspector::_update_script_class_properties(const Object &p_object, Li for (List::Element *E = classes.front(); E; E = E->next()) { StringName name = E->get(); String path = paths[name]; - Ref