diff options
-rw-r--r-- | source/blender/blenkernel/BKE_anim.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 17 | ||||
-rw-r--r-- | source/blender/editors/armature/pose_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 2 |
4 files changed, 18 insertions, 9 deletions
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h index 998f0dd09b8..91f936c6eca 100644 --- a/source/blender/blenkernel/BKE_anim.h +++ b/source/blender/blenkernel/BKE_anim.h @@ -57,7 +57,11 @@ void animviz_free_motionpath(struct bMotionPath *mpath); struct bMotionPath *animviz_verify_motionpaths(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan); void animviz_get_object_motionpaths(struct Object *ob, ListBase *targets); -void animviz_calc_motionpaths(struct Depsgraph *depsgraph, struct Main *bmain, struct Scene *scene, ListBase *targets); +void animviz_calc_motionpaths(struct Depsgraph *depsgraph, + struct Main *bmain, + struct Scene *scene, + ListBase *targets, + bool restore); /* ---------------------------------------------------- */ /* Curve Paths */ diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 68f691e4b1c..02f871e6ccf 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -401,7 +401,11 @@ static void motionpaths_calc_bake_targets(ListBase *targets, int cframe) * - recalc: whether we need to */ /* TODO: include reports pointer? */ - void animviz_calc_motionpaths(Depsgraph *depsgraph, Main *bmain, Scene *scene, ListBase *targets) +void animviz_calc_motionpaths(Depsgraph *depsgraph, + Main *bmain, + Scene *scene, + ListBase *targets, + bool restore) { MPathTarget *mpt; int sfra, efra; @@ -476,12 +480,13 @@ static void motionpaths_calc_bake_targets(ListBase *targets, int cframe) } /* reset original environment */ - /* NOTE: We shouldn't need to reevaluate the main scene, - * as the depsgraph passed in calculates the results on a - * a copy-on-write copy of the data. That said, we have to - * restore the current frame settings - */ + /* NOTE: We don't always need to reevaluate the main scene, as the depsgraph + * may be a temporary one that works on a subset of the data. We always have + * to resoture the current frame though. */ CFRA = cfra; + if (restore) { + motionpaths_calc_update_scene(bmain, depsgraph); + } /* clear recalc flags from targets */ for (mpt = targets->first; mpt; mpt = mpt->next) { diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 8acac47706f..d0ca809f196 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -226,7 +226,7 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob) /* recalculate paths, then free */ TIMEIT_START(pose_path_calc); - animviz_calc_motionpaths(depsgraph, bmain, scene, &targets); + animviz_calc_motionpaths(depsgraph, bmain, scene, &targets, false); TIMEIT_END(pose_path_calc); BLI_freelistN(&targets); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 58ecd7fb472..cd572c9e93f 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1239,7 +1239,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene) CTX_DATA_END; /* recalculate paths, then free */ - animviz_calc_motionpaths(depsgraph, bmain, scene, &targets); + animviz_calc_motionpaths(depsgraph, bmain, scene, &targets, true); BLI_freelistN(&targets); /* tag objects for copy on write - so paths will draw/redraw */ |