Bug fix, own collection.
authorTon Roosendaal <ton@blender.org>
Fri, 17 May 2013 13:15:43 +0000 (13:15 +0000)
committerTon Roosendaal <ton@blender.org>
Fri, 17 May 2013 13:15:43 +0000 (13:15 +0000)
Shapekey drivers were executed for every call to derivedmesh, which shouldn't happen.
It now only runs on the object_update() function, once for every depsgraph change.

Error was found while testing preview render in viewport. On each render, the
animsys sent a 'changed data' because of the shapekey drivers being called,
causing eternal re-render loops (without showing anything).

source/blender/blenkernel/intern/key.c
source/blender/blenkernel/intern/object.c

index 5c25469facc975d9dfdea69290fbd05bbf164fa7..74bf36adc6e1d3bbc36c97d0ec486b810b0b0626 100644 (file)
@@ -1389,10 +1389,6 @@ float *BKE_key_evaluate_object(Scene *scene, Object *ob, int *r_totelem)
                        cp_cu_key(ob->data, key, actkb, kb, 0, tot, out, tot);
        }
        else {
-               /* do shapekey local drivers */
-               float ctime = BKE_scene_frame_get(scene);
-
-               BKE_animsys_evaluate_animdata(scene, &key->id, key->adt, ctime, ADT_RECALC_DRIVERS);
                
                if (ob->type == OB_MESH) do_mesh_key(scene, ob, key, out, tot);
                else if (ob->type == OB_LATTICE) do_latt_key(scene, ob, key, out, tot);
index 57fd555d57e7e9442f363951c9e976421430796e..741c4f5429e9d864300ba6db29d502e8c0323e6f 100644 (file)
@@ -2621,6 +2621,7 @@ void BKE_object_handle_update_ex(Scene *scene, Object *ob,
                if (ob->recalc & OB_RECALC_DATA) {
                        ID *data_id = (ID *)ob->data;
                        AnimData *adt = BKE_animdata_from_id(data_id);
+                       Key *key;
                        float ctime = BKE_scene_frame_get(scene);
                        
                        if (G.debug & G_DEBUG)
@@ -2631,6 +2632,12 @@ void BKE_object_handle_update_ex(Scene *scene, Object *ob,
                                /* XXX: for mesh types, should we push this to derivedmesh instead? */
                                BKE_animsys_evaluate_animdata(scene, data_id, adt, ctime, ADT_RECALC_DRIVERS);
                        }
+                       
+                       key = BKE_key_from_object(ob);
+                       if (key && key->block.first) {
+                               if (!(ob->shapeflag & OB_SHAPE_LOCK))
+                                       BKE_animsys_evaluate_animdata(scene, &key->id, key->adt, ctime, ADT_RECALC_DRIVERS);
+                       }
 
                        /* includes all keys and modifiers */
                        switch (ob->type) {