diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 8f3d91cdb96..34777bfc1ac 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2085,7 +2085,7 @@ void EditorNode::_dialog_action(String p_file) { load_scene(p_file); } break; case SETTINGS_PICK_MAIN_SCENE: { - ProjectSettings::get_singleton()->set("application/run/main_scene", p_file); + ProjectSettings::get_singleton()->set("application/run/main_scene", ResourceUID::path_to_uid(p_file)); ProjectSettings::get_singleton()->save(); // TODO: Would be nice to show the project manager opened with the highlighted field. @@ -2134,7 +2134,7 @@ void EditorNode::_dialog_action(String p_file) { } break; case FILE_SAVE_AND_RUN_MAIN_SCENE: { - ProjectSettings::get_singleton()->set("application/run/main_scene", p_file); + ProjectSettings::get_singleton()->set("application/run/main_scene", ResourceUID::path_to_uid(p_file)); ProjectSettings::get_singleton()->save(); if (file->get_file_mode() == EditorFileDialog::FILE_MODE_SAVE_FILE) { @@ -3962,25 +3962,25 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b return OK; } + String lpath = ResourceUID::ensure_path(p_scene); if (!p_set_inherited) { for (int i = 0; i < editor_data.get_edited_scene_count(); i++) { - if (editor_data.get_scene_path(i) == p_scene) { + if (editor_data.get_scene_path(i) == lpath) { _set_current_scene(i); return OK; } } - if (!p_force_open_imported && FileAccess::exists(p_scene + ".import")) { - open_imported->set_text(vformat(TTR("Scene '%s' was automatically imported, so it can't be modified.\nTo make changes to it, a new inherited scene can be created."), p_scene.get_file())); + if (!p_force_open_imported && FileAccess::exists(lpath + ".import")) { + open_imported->set_text(vformat(TTR("Scene '%s' was automatically imported, so it can't be modified.\nTo make changes to it, a new inherited scene can be created."), lpath.get_file())); open_imported->popup_centered(); new_inherited_button->grab_focus(); - open_import_request = p_scene; + open_import_request = lpath; return OK; } } - String lpath = ProjectSettings::get_singleton()->localize_path(p_scene); - + lpath = ProjectSettings::get_singleton()->localize_path(lpath); if (!lpath.begins_with("res://")) { show_accept(TTR("Error loading scene, it must be inside the project path. Use 'Import' to open the scene, then save it inside the project path."), TTR("OK")); opening_prev = false; @@ -4081,7 +4081,7 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b set_edited_scene(new_scene); - String config_file_path = EditorPaths::get_singleton()->get_project_settings_dir().path_join(p_scene.get_file() + "-editstate-" + p_scene.md5_text() + ".cfg"); + String config_file_path = EditorPaths::get_singleton()->get_project_settings_dir().path_join(lpath.get_file() + "-editstate-" + lpath.md5_text() + ".cfg"); Ref editor_state_cf; editor_state_cf.instantiate(); Error editor_state_cf_err = editor_state_cf->load(config_file_path); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 6c807095572..718b62d6612 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -270,7 +270,7 @@ void FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory // Create all items for the files in the subdirectory. if (display_mode == DISPLAY_MODE_TREE_ONLY) { - String main_scene = GLOBAL_GET("application/run/main_scene"); + const String main_scene = ResourceUID::ensure_path(GLOBAL_GET("application/run/main_scene")); // Build the list of the files to display. List file_list; @@ -1099,7 +1099,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) { sort_file_info_list(file_list, file_sort); // Fills the ItemList control node from the FileInfos. - String main_scene = GLOBAL_GET("application/run/main_scene"); + const String main_scene = ResourceUID::ensure_path(GLOBAL_GET("application/run/main_scene")); for (FileInfo &E : file_list) { FileInfo *finfo = &(E); String fname = finfo->name; @@ -2353,7 +2353,7 @@ void FileSystemDock::_file_option(int p_option, const Vector &p_selected case FILE_MAIN_SCENE: { // Set as main scene with selected scene file. if (p_selected.size() == 1) { - ProjectSettings::get_singleton()->set("application/run/main_scene", p_selected[0]); + ProjectSettings::get_singleton()->set("application/run/main_scene", ResourceUID::path_to_uid(p_selected[0])); ProjectSettings::get_singleton()->save(); _update_tree(get_uncollapsed_paths()); _update_file_list(true); diff --git a/main/main.cpp b/main/main.cpp index b3b6d960e7a..b8dec2154b2 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -3817,8 +3817,8 @@ int Main::start() { #endif // TOOLS_ENABLED - if (script.is_empty() && game_path.is_empty() && String(GLOBAL_GET("application/run/main_scene")) != "") { - game_path = GLOBAL_GET("application/run/main_scene"); + if (script.is_empty() && game_path.is_empty()) { + game_path = ResourceUID::ensure_path(GLOBAL_GET("application/run/main_scene")); } #ifdef TOOLS_ENABLED