mirror of
https://github.com/godotengine/godot.git
synced 2025-01-24 11:32:51 -05:00
Merge pull request #99739 from ydeltastar/fix-default-environment
Fix default `Environment` project setting and loading
This commit is contained in:
commit
cf165a1d29
1 changed files with 30 additions and 17 deletions
|
@ -608,9 +608,21 @@ bool SceneTree::process(double p_time) {
|
|||
#ifdef TOOLS_ENABLED
|
||||
#ifndef _3D_DISABLED
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
//simple hack to reload fallback environment if it changed from editor
|
||||
String env_path = GLOBAL_GET(SNAME("rendering/environment/defaults/default_environment"));
|
||||
env_path = env_path.strip_edges(); //user may have added a space or two
|
||||
env_path = env_path.strip_edges(); // User may have added a space or two.
|
||||
|
||||
bool can_load = true;
|
||||
if (env_path.begins_with("uid://")) {
|
||||
// If an uid path, ensure it is mapped to a resource which could not be
|
||||
// the case if the editor is still scanning the filesystem.
|
||||
ResourceUID::ID id = ResourceUID::get_singleton()->text_to_id(env_path);
|
||||
can_load = ResourceUID::get_singleton()->has_id(id);
|
||||
if (can_load) {
|
||||
env_path = ResourceUID::get_singleton()->get_id_path(id);
|
||||
}
|
||||
}
|
||||
|
||||
if (can_load) {
|
||||
String cpath;
|
||||
Ref<Environment> fallback = get_root()->get_world_3d()->get_fallback_environment();
|
||||
if (fallback.is_valid()) {
|
||||
|
@ -629,6 +641,7 @@ bool SceneTree::process(double p_time) {
|
|||
get_root()->get_world_3d()->set_fallback_environment(fallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
#endif // TOOLS_ENABLED
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue