diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-06-08 11:17:07 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-06-12 05:13:43 +0300 |
commit | b313525c1bd031792dbfb82979eb62d9a927b111 (patch) | |
tree | 05db66b26e74a73e987669b651fa641d51e1d76e | |
parent | d75e45d10cbf7d93742f8c746cdb61de32edb42b (diff) |
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
-rw-r--r-- | intern/cycles/blender/blender_light.cpp | 9 |
1 files 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()) |