소스 검색

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 `<scene_file>::<id>` naming
in the list of scripts.
Hugo Locurcio 5 년 전
부모
커밋
e90beade15
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      editor/plugins/script_editor_plugin.cpp

+ 4 - 2
editor/plugins/script_editor_plugin.cpp

@@ -1783,9 +1783,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 {