Merge pull request #71584 from clayjohn/SDFGI-error

Remove light from dynamic light list when removing scenario
This commit is contained in:
Rémi Verschelde 2023-01-18 08:43:06 +01:00
commit e514e3732a
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 4 additions and 0 deletions

View File

@ -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.");