diff --git a/source/blender/blenkernel/intern/anim_visualization.cc b/source/blender/blenkernel/intern/anim_visualization.cc index 940d63f6c06..a0807285901 100644 --- a/source/blender/blenkernel/intern/anim_visualization.cc +++ b/source/blender/blenkernel/intern/anim_visualization.cc @@ -141,8 +141,9 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, return nullptr; } - const int expected_length = avs->path_ef - avs->path_sf; - BLI_assert(expected_length > 0); /* Because the `if` above. */ + /* Adding 1 because the avs range is inclusive on both ends. */ + const int expected_length = (avs->path_ef - avs->path_sf) + 1; + BLI_assert(expected_length > 1); /* Because the `if` above. */ /* If there is already a motionpath, just return that, provided its settings * are ok (saves extra free+alloc). */ @@ -159,7 +160,7 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, /* Only reuse a path if it was already a valid path, and of the expected length. */ if (mpath->start_frame != mpath->end_frame && mpath->length == expected_length) { mpath->start_frame = avs->path_sf; - mpath->end_frame = avs->path_ef; + mpath->end_frame = avs->path_ef + 1; return mpath; } @@ -173,7 +174,7 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, /* Copy mpath settings from the viz settings. */ mpath->start_frame = avs->path_sf; - mpath->end_frame = avs->path_ef; + mpath->end_frame = avs->path_ef + 1; mpath->length = expected_length; if (avs->path_bakeflag & MOTIONPATH_BAKE_HEADS) { diff --git a/source/blender/draw/engines/overlay/overlay_motion_path.cc b/source/blender/draw/engines/overlay/overlay_motion_path.cc index 0968d76bac5..770674b3a71 100644 --- a/source/blender/draw/engines/overlay/overlay_motion_path.cc +++ b/source/blender/draw/engines/overlay/overlay_motion_path.cc @@ -93,7 +93,7 @@ static void motion_path_get_frame_range_to_draw(bAnimVizSettings *avs, } else { start = avs->path_sf; - end = avs->path_ef; + end = avs->path_ef + 1; } if (start > end) { diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 21bebd01555..b15758caecb 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -57,9 +57,9 @@ typedef struct bMotionPath { /** The number of cached verts. */ int length; - /** For drawing paths, the start frame number. */ + /** For drawing paths, the start frame number. Inclusive.*/ int start_frame; - /** For drawing paths, the end frame number. */ + /** For drawing paths, the end frame number. Exclusive. */ int end_frame; /** Optional custom color. */ @@ -113,7 +113,7 @@ typedef struct bAnimVizSettings { short path_bakeflag; char _pad[4]; - /** Start and end frames of path-calculation range. */ + /** Start and end frames of path-calculation range. Both are inclusive.*/ int path_sf, path_ef; /** Number of frames before/after current frame to show. */ int path_bc, path_ac;