From b313525c1bd031792dbfb82979eb62d9a927b111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Tue, 8 Jun 2021 10:17:07 +0200 Subject: Fix T88515: Cycles does not update light transform from linked collections When moving a linked collection, we seem to only receive a depsgraph update for an empty object so the Blender synchronization cannot discriminate it and tag the object(s) (light or geometry) for an update through id_map.set_recalc. This missing transform update only affects lights since we do not check manually if the transformations were modified like we do for objects. To fix this, add a check to see if the transformation is different provided that a light was already created. Reviewed By: brecht Maniphest Tasks: T88515 Differential Revision: https://developer.blender.org/D11574 --- intern/cycles/blender/blender_light.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/intern/cycles/blender/blender_light.cpp b/intern/cycles/blender/blender_light.cpp index 283ed7d0adc..ae353b32633 100644 --- a/intern/cycles/blender/blender_light.cpp +++ b/intern/cycles/blender/blender_light.cpp @@ -34,12 +34,17 @@ void BlenderSync::sync_light(BL::Object &b_parent, bool *use_portal) { /* test if we need to sync */ - Light *light; ObjectKey key(b_parent, persistent_id, b_ob_instance, false); BL::Light b_light(b_ob.data()); + Light *light = light_map.find(key); + + /* Check if the transform was modified, in case a linked collection is moved we do not get a + * specific depsgraph update (T88515). This also mimics the behavior for Objects. */ + const bool tfm_updated = (light && light->get_tfm() != tfm); + /* Update if either object or light data changed. */ - if (!light_map.add_or_update(&light, b_ob, b_parent, key)) { + if (!tfm_updated && !light_map.add_or_update(&light, b_ob, b_parent, key)) { Shader *shader; if (!shader_map.add_or_update(&shader, b_light)) { if (light->get_is_portal()) -- cgit v1.2.3