diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-11-05 16:34:07 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-11-05 16:34:07 +0300 |
commit | 16767c4e2294c505d74bdfd99b57700cb9b87338 (patch) | |
tree | d8bf277ddb156b33cd2a27f705cbf828aee0461b /source/blender/editors/animation | |
parent | 3d5d7cff30391fe8473433a4b1fa51c616f758cb (diff) | |
parent | 8dfe2801ace57798f2df24a0c5b462a0b9c52443 (diff) |
Merge branch 'blender-v2.81-release'
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_motion_paths.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/source/blender/editors/animation/anim_motion_paths.c b/source/blender/editors/animation/anim_motion_paths.c index 30bf837f6c0..e6ab3609507 100644 --- a/source/blender/editors/animation/anim_motion_paths.c +++ b/source/blender/editors/animation/anim_motion_paths.c @@ -236,10 +236,8 @@ static void motionpath_get_global_framerange(ListBase *targets, int *r_sfra, int static int motionpath_get_prev_keyframe(MPathTarget *mpt, DLRBT_Tree *fcu_keys, int current_frame) { - /* If the current frame is outside of the configured motion path range we ignore update of this - * motion path by using invalid frame range where start frame is above the end frame. */ if (current_frame <= mpt->mpath->start_frame) { - return INT_MAX; + return mpt->mpath->start_frame; } float current_frame_float = current_frame; @@ -262,10 +260,8 @@ static int motionpath_get_prev_prev_keyframe(MPathTarget *mpt, static int motionpath_get_next_keyframe(MPathTarget *mpt, DLRBT_Tree *fcu_keys, int current_frame) { - /* If the current frame is outside of the configured motion path range we ignore update of this - * motion path by using invalid frame range where start frame is above the end frame. */ if (current_frame >= mpt->mpath->end_frame) { - return INT_MIN; + return mpt->mpath->end_frame; } float current_frame_float = current_frame; @@ -305,6 +301,15 @@ static void motionpath_calculate_update_range(MPathTarget *mpt, int *r_sfra, int *r_efra) { + *r_sfra = INT_MAX; + *r_efra = INT_MIN; + + /* If the current frame is outside of the configured motion path range we ignore update of this + * motion path by using invalid frame range where start frame is above the end frame. */ + if (current_frame < mpt->mpath->start_frame || current_frame > mpt->mpath->end_frame) { + return; + } + /* Similar to the case when there is only a single keyframe: need to update en entire range to * a constant value. */ if (!motionpath_check_can_use_keyframe_range(mpt, adt, fcurve_list)) { @@ -313,9 +318,6 @@ static void motionpath_calculate_update_range(MPathTarget *mpt, return; } - *r_sfra = INT_MAX; - *r_efra = INT_MIN; - /* NOTE: Iterate over individual f-curves, and check their keyframes individually and pick a * widest range from them. This is because it's possible to have more narrow keyframe on a * channel which wasn't edited. @@ -344,6 +346,13 @@ static void motionpath_calculate_update_range(MPathTarget *mpt, } } +static void motionpath_free_free_tree_data(ListBase *targets) +{ + for (MPathTarget *mpt = targets->first; mpt; mpt = mpt->next) { + BLI_dlrbTree_free(&mpt->keys); + } +} + /* Perform baking of the given object's and/or its bones' transforms to motion paths * - scene: current scene * - ob: object whose flagged motionpaths should get calculated @@ -444,6 +453,7 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph, } if (sfra > efra) { + motionpath_free_free_tree_data(targets); return; } |