mirror of https://github.com/godotengine/godot
Fix default environment project setting and loading
This commit is contained in:
parent
bbc54692c0
commit
8793764ba6
|
|
@ -608,9 +608,21 @@ bool SceneTree::process(double p_time) {
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
#ifndef _3D_DISABLED
|
#ifndef _3D_DISABLED
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
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"));
|
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;
|
String cpath;
|
||||||
Ref<Environment> fallback = get_root()->get_world_3d()->get_fallback_environment();
|
Ref<Environment> fallback = get_root()->get_world_3d()->get_fallback_environment();
|
||||||
if (fallback.is_valid()) {
|
if (fallback.is_valid()) {
|
||||||
|
|
@ -629,6 +641,7 @@ bool SceneTree::process(double p_time) {
|
||||||
get_root()->get_world_3d()->set_fallback_environment(fallback);
|
get_root()->get_world_3d()->set_fallback_environment(fallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif // _3D_DISABLED
|
#endif // _3D_DISABLED
|
||||||
#endif // TOOLS_ENABLED
|
#endif // TOOLS_ENABLED
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue