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
This commit is contained in:
Kévin Dietrich 2021-06-08 10:17:07 +02:00
parent d75e45d10c
commit b313525c1b
Notes: blender-bot 2023-05-03 10:14:48 +02:00
Referenced by commit befb9d99f8, Fix T89331: Cycles lights flicker when transformed
Referenced by issue #89331, Cycles - Lights flicker while being moved or rotated in viewport
Referenced by issue #88515, Viewport Cycles does not update the position of lights from linked collections, from at least 2.91 to 2.93
1 changed files with 7 additions and 2 deletions

View File

@ -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())