diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-01-06 15:26:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-06 15:26:52 +0100 |
commit | ce75a2f33d4000e3ecba0fe8281ca335f5528c86 (patch) | |
tree | 4eadac234c5c4443f9e0ff96c3941f4e28246ed5 /scene/resources | |
parent | f5d1177fcbe6c948c54896dcb0e613ba0b3ffa80 (diff) | |
parent | dc13750189090e6df5608b260e2eaa3e29eb3665 (diff) |
Merge pull request #33987 from nekomatata/own-world-environment
Viewport environment is updated properly when set to own world
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/world.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scene/resources/world.cpp b/scene/resources/world.cpp index b498acd707..1099852098 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<Environment> &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<Environment> World::get_environment() const { @@ -282,12 +287,17 @@ Ref<Environment> World::get_environment() const { } void World::set_fallback_environment(const Ref<Environment> &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<Environment> World::get_fallback_environment() const { |