Fix T82129: Cycles "Persistent Images" incorrectly retains scene data

The issue stems from the fact that scene arrays are not cleared when rendering is done. This was not really an issue before the introduction of the ownership system (rB429afe0c626a) as the id_map would recreate scene data arrays based on their new content. However, now that the id_maps do not have access to the scene data anymore the arrays are never created.

Another related issue is that the BlenderSync instance is never freed when the persistent data option is activated.

To fix this, we delete nodes created by the id_maps in their destructors, and delete the BlenderSync instance before creating a new one, so the id_maps destructors are actually called.

Reviewed By: brecht

Maniphest Tasks: T82129

Differential Revision: https://developer.blender.org/D9378
This commit is contained in:
2020-10-29 14:40:29 +01:00
parent 2e41db5277
commit 8c3d42bd0f
9 changed files with 114 additions and 26 deletions

View File

@@ -207,7 +207,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
/* test if we need to sync */
bool object_updated = false;
if (object_map.add_or_update(scene, &object, b_ob, b_parent, key))
if (object_map.add_or_update(&object, b_ob, b_parent, key))
object_updated = true;
/* mesh sync */
@@ -405,10 +405,10 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
sync_background_light(b_v3d, use_portal);
/* handle removed data and modified pointers */
light_map.post_sync(scene);
geometry_map.post_sync(scene);
object_map.post_sync(scene);
particle_system_map.post_sync(scene);
light_map.post_sync();
geometry_map.post_sync();
object_map.post_sync();
particle_system_map.post_sync();
}
if (motion)