From dc13750189090e6df5608b260e2eaa3e29eb3665 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Fri, 29 Nov 2019 07:41:25 +0100 Subject: Viewport environment is updated properly when set to own world When own_world property is set, the viewport stores a unique resource for the world. With this change it keeps being updated from changes made to the world property instead of storing a default empty world with environment settings that can't be modified. Fixes #23412 --- scene/resources/world.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'scene/resources') diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp index 2c22f45f9d..e734b7d9f3 100644 --- a/scene/resources/world.cpp +++ b/scene/resources/world.cpp @@ -268,12 +268,17 @@ RID World::get_scenario() const { } void World::set_environment(const Ref &p_environment) { + if (environment == p_environment) { + return; + } environment = p_environment; if (environment.is_valid()) VS::get_singleton()->scenario_set_environment(scenario, environment->get_rid()); else VS::get_singleton()->scenario_set_environment(scenario, RID()); + + emit_changed(); } Ref World::get_environment() const { @@ -282,12 +287,17 @@ Ref World::get_environment() const { } void World::set_fallback_environment(const Ref &p_environment) { + if (fallback_environment == p_environment) { + return; + } fallback_environment = p_environment; if (fallback_environment.is_valid()) VS::get_singleton()->scenario_set_fallback_environment(scenario, p_environment->get_rid()); else VS::get_singleton()->scenario_set_fallback_environment(scenario, RID()); + + emit_changed(); } Ref World::get_fallback_environment() const { -- cgit v1.2.3