Fix object motion paths not updating correct after filtering optimization.

This commit is contained in:
Brecht Van Lommel 2018-09-14 14:32:41 +02:00
parent 898c780633
commit a415d521db
4 changed files with 18 additions and 9 deletions

View File

@ -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 */

View File

@ -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) {

View File

@ -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);

View File

@ -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 */