Merge pull request #26080 from qarmin/fix_error_default_environment

Fix error when deleting default environment
This commit is contained in:
Rémi Verschelde 2019-02-20 10:54:45 +01:00 committed by GitHub
commit 3c70a4a83a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -496,11 +496,15 @@ void DependencyRemoveDialog::ok_pressed() {
res->set_path(""); res->set_path("");
} }
// If the file we are deleting is the main scene, clear its definition. // If the file we are deleting is the main scene or default environment, clear its definition.
if (files_to_delete[i] == ProjectSettings::get_singleton()->get("application/run/main_scene")) { if (files_to_delete[i] == ProjectSettings::get_singleton()->get("application/run/main_scene")) {
ProjectSettings::get_singleton()->set("application/run/main_scene", ""); ProjectSettings::get_singleton()->set("application/run/main_scene", "");
} }
if (files_to_delete[i] == ProjectSettings::get_singleton()->get("rendering/environment/default_environment")) {
ProjectSettings::get_singleton()->set("rendering/environment/default_environment", "");
}
String path = OS::get_singleton()->get_resource_dir() + files_to_delete[i].replace_first("res://", "/"); String path = OS::get_singleton()->get_resource_dir() + files_to_delete[i].replace_first("res://", "/");
print_verbose("Moving to trash: " + path); print_verbose("Moving to trash: " + path);
Error err = OS::get_singleton()->move_to_trash(path); Error err = OS::get_singleton()->move_to_trash(path);