@@ -286,8 +286,6 @@ void FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
286286
287287 // Create all items for the files in the subdirectory.
288288 if (display_mode == DISPLAY_MODE_TREE_ONLY) {
289- const String main_scene = ResourceUID::ensure_path (GLOBAL_GET (" application/run/main_scene" ));
290-
291289 // Build the list of the files to display.
292290 List<FileInfo> file_list;
293291 for (int i = 0 ; i < p_dir->get_file_count (); i++) {
@@ -336,7 +334,7 @@ void FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
336334 file_item->select (0 );
337335 file_item->set_as_cursor (0 );
338336 }
339- if (main_scene == file_metadata) {
337+ if (main_scene_path == file_metadata) {
340338 file_item->set_custom_color (0 , get_theme_color (SNAME (" accent_color" ), EditorStringName (Editor)));
341339 }
342340 EditorResourcePreview::get_singleton ()->queue_resource_preview (file_metadata, callable_mp (this , &FileSystemDock::_tree_thumbnail_done).bind (tree_update_id, file_item->get_instance_id ()));
@@ -1129,7 +1127,6 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
11291127 sort_file_info_list (file_list, file_sort);
11301128
11311129 // Fills the ItemList control node from the FileInfos.
1132- const String main_scene = ResourceUID::ensure_path (GLOBAL_GET (" application/run/main_scene" ));
11331130 for (FileInfo &E : file_list) {
11341131 FileInfo *finfo = &(E);
11351132 String fname = finfo->name ;
@@ -1163,7 +1160,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) {
11631160 files->set_item_metadata (item_index, fpath);
11641161 }
11651162
1166- if (fpath == main_scene ) {
1163+ if (fpath == main_scene_path ) {
11671164 files->set_item_custom_fg_color (item_index, get_theme_color (SNAME (" accent_color" ), EditorStringName (Editor)));
11681165 }
11691166
@@ -2390,7 +2387,8 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
23902387 case FILE_MENU_MAIN_SCENE: {
23912388 // Set as main scene with selected scene file.
23922389 if (p_selected.size () == 1 ) {
2393- ProjectSettings::get_singleton ()->set (" application/run/main_scene" , ResourceUID::path_to_uid (p_selected[0 ]));
2390+ main_scene_path = ResourceUID::path_to_uid (p_selected[0 ]);
2391+ ProjectSettings::get_singleton ()->set (" application/run/main_scene" , main_scene_path);
23942392 ProjectSettings::get_singleton ()->save ();
23952393 _update_tree (get_uncollapsed_paths ());
23962394 _update_file_list (true );
@@ -3311,7 +3309,7 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, const Vect
33113309 if (filenames.size () == 1 ) {
33123310 p_popup->add_icon_item (get_editor_theme_icon (SNAME (" Load" )), TTRC (" Open Scene" ), FILE_MENU_OPEN);
33133311 p_popup->add_icon_item (get_editor_theme_icon (SNAME (" CreateNewSceneFrom" )), TTRC (" New Inherited Scene" ), FILE_MENU_INHERIT);
3314- if (ResourceUID::ensure_path ( GLOBAL_GET ( " application/run/main_scene " )) != filenames[0 ]) {
3312+ if (main_scene_path != filenames[0 ]) {
33153313 p_popup->add_icon_item (get_editor_theme_icon (SNAME (" PlayScene" )), TTRC (" Set as Main Scene" ), FILE_MENU_MAIN_SCENE);
33163314 }
33173315 } else {
@@ -3994,6 +3992,13 @@ void FileSystemDock::_feature_profile_changed() {
39943992
39953993void FileSystemDock::_project_settings_changed () {
39963994 assigned_folder_colors = ProjectSettings::get_singleton ()->get_setting (" file_customization/folder_colors" );
3995+
3996+ const String ¤t_main_scene_path = ResourceUID::ensure_path (GLOBAL_GET (" application/run/main_scene" ));
3997+ if (main_scene_path != current_main_scene_path) {
3998+ main_scene_path = current_main_scene_path;
3999+ _update_tree (get_uncollapsed_paths ());
4000+ _update_file_list (true );
4001+ }
39974002}
39984003
39994004void FileSystemDock::set_file_sort (FileSortOption p_file_sort) {
@@ -4453,6 +4458,8 @@ FileSystemDock::FileSystemDock() {
44534458 file_list_display_mode = FILE_LIST_DISPLAY_THUMBNAILS;
44544459
44554460 ProjectSettings::get_singleton ()->connect (" settings_changed" , callable_mp (this , &FileSystemDock::_project_settings_changed));
4461+ main_scene_path = ResourceUID::ensure_path (GLOBAL_GET (" application/run/main_scene" ));
4462+
44564463 add_resource_tooltip_plugin (memnew (EditorTextureTooltipPlugin));
44574464 add_resource_tooltip_plugin (memnew (EditorAudioStreamTooltipPlugin));
44584465}
0 commit comments