[Bf-blender-cvs] [f7fce002976] master: Depsgraph: Allow non-keyed changes from frame_change_post handler

Sergey Sharybin noreply at git.blender.org
Wed Sep 11 10:59:21 CEST 2019


Commit: f7fce002976998531849f32180d44dcbaa878f61
Author: Sergey Sharybin
Date:   Tue Sep 10 11:13:19 2019 +0200
Branches: master
https://developer.blender.org/rBf7fce002976998531849f32180d44dcbaa878f61

Depsgraph: Allow non-keyed changes from frame_change_post handler

Makes it possible to do custom edits to animated properties from a
python handler.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5738

===================================================================

M	source/blender/blenkernel/intern/scene.c

===================================================================

diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index cd10713897a..3ea009b0014 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1377,9 +1377,17 @@ void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph, Main *bmain)
 #endif
     /* Update all objects: drivers, matrices, displists, etc. flags set
      * by depgraph or manual, no layer check here, gets correct flushed.
-     */
-    const float ctime = BKE_scene_frame_get(scene);
-    DEG_evaluate_on_framechange(bmain, depsgraph, ctime);
+     *
+     * NOTE: Only update for new frame on first iteration. Second iteration is for ensuring user
+     * edits from callback are properly taken into account. Doing a time update on those would
+     * loose any possible unkeyed changes made by the handler. */
+    if (pass == 0) {
+      const float ctime = BKE_scene_frame_get(scene);
+      DEG_evaluate_on_framechange(bmain, depsgraph, ctime);
+    }
+    else {
+      DEG_evaluate_on_refresh(bmain, depsgraph);
+    }
     /* Update sound system animation. */
     BKE_scene_update_sound(depsgraph, bmain);



More information about the Bf-blender-cvs mailing list