Don't apply World override in the editor.

This commit is contained in:
Relintai 2022-08-30 01:48:19 +02:00
parent 9b3714a274
commit 338cc9c93d

View File

@ -1,5 +1,6 @@
#include "world.h"
#include "core/config/engine.h"
#include "core/core_string_names.h"
#include "scene/3d/spatial.h"
#include "scene/3d/world_environment_3d.h"
@ -116,7 +117,7 @@ void World::set_override_in_parent_viewport(const bool value) {
return;
}
if (is_inside_tree()) {
if (!Engine::get_singleton()->is_editor_hint() && is_inside_tree()) {
World *w = get_viewport();
if (w) {
@ -174,6 +175,10 @@ World *World::get_override_world_or_this() {
return _override_world;
}
void World::set_override_world(World *p_world) {
if (Engine::get_singleton()->is_editor_hint()) {
return;
}
if (p_world == _override_world || p_world == this) {
return;
}
@ -431,7 +436,7 @@ void World::_notification(int p_what) {
}
} break;
case NOTIFICATION_READY: {
if (_override_in_parent_viewport) {
if (_override_in_parent_viewport && !Engine::get_singleton()->is_editor_hint()) {
if (get_parent()) {
World *w = get_parent()->get_viewport();
@ -442,6 +447,7 @@ void World::_notification(int p_what) {
}
} break;
case NOTIFICATION_EXIT_TREE: {
if (!Engine::get_singleton()->is_editor_hint()) {
set_override_world(NULL);
while (_overriding_worlds.size() > 0) {
@ -449,6 +455,7 @@ void World::_notification(int p_what) {
w->set_override_world(NULL);
}
}
} break;
}
}