From 679474c576faf163871299dce5a8aa46ddb85b96 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 12 Mar 2020 21:35:52 +0100 Subject: [PATCH] Tweak the built-in script naming for resources with custom names This makes the script name appear before the scene file name, which ensures it's always visible even if the list of scripts is too narrow to display the full name. This only impacts built-in scripts with custom resource names. Unnamed resources will still use `::` naming in the list of scripts. (cherry picked from commit e90beade153f0ace450e3ec57b5eb44898023c1f) --- editor/plugins/script_editor_plugin.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index e43ac32d2b8..db48421b546 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1834,9 +1834,11 @@ void ScriptEditor::_update_script_names() { if (built_in) { name = path.get_file(); - String resource_name = se->get_edited_resource()->get_name(); + const String &resource_name = se->get_edited_resource()->get_name(); if (resource_name != "") { - name = name.substr(0, name.find("::", 0) + 2) + resource_name; + // If the built-in script has a custom resource name defined, + // display the built-in script name as follows: `ResourceName (scene_file.tscn)` + name = vformat("%s (%s)", resource_name, name.substr(0, name.find("::", 0))); } } else {