Fix T65630: Paste pose doesn't work with motion paths enabled
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 14 Jun 2019 15:12:47 +0000 (17:12 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 14 Jun 2019 15:35:01 +0000 (17:35 +0200)
source/blender/editors/animation/anim_motion_paths.c

index e3c4e2a..d3c6109 100644 (file)
@@ -250,8 +250,20 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph,
   /* get copies of objects/bones to get the calculated results from
    * (for copy-on-write evaluation), so that we actually get some results
    */
-  // TODO: Create a copy of background depsgraph that only contain these entities,
-  // and only evaluates them.
+
+  /* TODO: Create a copy of background depsgraph that only contain these entities,
+   * and only evaluates them.
+   *
+   * For until that is done we force dependency graph to not be active, so we don't loose unkeyed
+   * changes during updating the motion path.
+   * This still doesn't include unkeyed changes to the path itself, but allows to have updates in
+   * an environment when auto-keying and pose paste is used. */
+
+  const bool is_active_depsgraph = DEG_is_active(depsgraph);
+  if (is_active_depsgraph) {
+    DEG_make_inactive(depsgraph);
+  }
+
   for (MPathTarget *mpt = targets->first; mpt; mpt = mpt->next) {
     mpt->ob_eval = DEG_get_evaluated_object(depsgraph, mpt->ob);
 
@@ -317,6 +329,10 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph,
     motionpaths_calc_update_scene(bmain, depsgraph);
   }
 
+  if (is_active_depsgraph) {
+    DEG_make_active(depsgraph);
+  }
+
   /* clear recalc flags from targets */
   for (MPathTarget *mpt = targets->first; mpt; mpt = mpt->next) {
     bAnimVizSettings *avs;