diff options
author | clayjohn <claynjohn@gmail.com> | 2023-01-17 14:33:15 -0800 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2023-01-17 14:33:15 -0800 |
commit | b2a31a3bbfe3a51864222e925ab82b38669211cc (patch) | |
tree | 1eb6721de32b3d693e42bf4a424b2395336d1fe0 | |
parent | f0326297b319fb632ba5a28c7c8528b1800132f4 (diff) |
Remove light from dynamic light list when removing scenario
-rw-r--r-- | servers/rendering/renderer_scene_cull.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp index 2ea813aab0..218bb7b736 100644 --- a/servers/rendering/renderer_scene_cull.cpp +++ b/servers/rendering/renderer_scene_cull.cpp @@ -748,6 +748,10 @@ void RendererSceneCull::instance_set_scenario(RID p_instance, RID p_scenario) { switch (instance->base_type) { case RS::INSTANCE_LIGHT: { InstanceLightData *light = static_cast<InstanceLightData *>(instance->base_data); + if (instance->visible && RSG::light_storage->light_get_type(instance->base) != RS::LIGHT_DIRECTIONAL && light->bake_mode == RS::LIGHT_BAKE_DYNAMIC) { + instance->scenario->dynamic_lights.erase(light->instance); + } + #ifdef DEBUG_ENABLED if (light->geometries.size()) { ERR_PRINT("BUG, indexing did not unpair geometries from light."); |