[Bf-blender-cvs] [a415d521dbe] blender2.8: Fix object motion paths not updating correct after filtering optimization.
Brecht Van Lommel
noreply at git.blender.org
Fri Sep 14 17:46:17 CEST 2018
Commit: a415d521dbe217b1a670f6d2f3ddcade5029db79
Author: Brecht Van Lommel
Date: Fri Sep 14 14:32:41 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBa415d521dbe217b1a670f6d2f3ddcade5029db79
Fix object motion paths not updating correct after filtering optimization.
===================================================================
M source/blender/blenkernel/BKE_anim.h
M source/blender/blenkernel/intern/anim.c
M source/blender/editors/armature/pose_edit.c
M source/blender/editors/object/object_edit.c
===================================================================
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 */
More information about the Bf-blender-cvs
mailing list