From cb0e500d2798a015ec9027ed46301f26a0d7e2c7 Mon Sep 17 00:00:00 2001 From: UziMonkey Date: Wed, 2 Jan 2019 00:54:51 -0500 Subject: [PATCH] Add sub-resource name when available to script editor (cherry picked from commit 7056c825a3d54111b1a1b960ffabefdd72db3793) --- editor/plugins/script_editor_plugin.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 2fe657f2105..6c0d57cc228 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1689,7 +1689,19 @@ void ScriptEditor::_update_script_names() { Ref icon = se->get_icon(); String path = se->get_edited_resource()->get_path(); bool built_in = !path.is_resource_file(); - String name = built_in ? path.get_file() : se->get_name(); + String name; + + if (built_in) { + + name = path.get_file(); + String resource_name = se->get_edited_resource()->get_name(); + if (resource_name != "") { + name = name.substr(0, name.find("::", 0) + 2) + resource_name; + } + } else { + + name = se->get_name(); + } _ScriptEditorItemData sd; sd.icon = icon;