diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-20 13:19:46 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-25 15:40:05 +0300 |
commit | c77a0d7dc62ee1b07ba50cdb3870ad5dbed3450a (patch) | |
tree | 3f1bba5eae37da31b433416b28081caae253b66e /source/blender/editors/animation | |
parent | 7b83ea5c6d1e9b24d2b3f65a69504e16a1a42d67 (diff) |
Motion paths: Cleanup, de-duplicate code
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_motion_paths.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/source/blender/editors/animation/anim_motion_paths.c b/source/blender/editors/animation/anim_motion_paths.c index bd4886817cd..33be56ce870 100644 --- a/source/blender/editors/animation/anim_motion_paths.c +++ b/source/blender/editors/animation/anim_motion_paths.c @@ -201,6 +201,15 @@ static void motionpaths_calc_bake_targets(ListBase *targets, int cframe) } } +/* Get pointer to animviz settings for the given target. */ +static bAnimVizSettings *animviz_target_settings_get(MPathTarget *mpt) +{ + if (mpt->pchan != NULL) { + return &mpt->ob->pose->avs; + } + return &mpt->ob->avs; +} + /* 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 @@ -272,15 +281,8 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph, BLI_dlrbTree_init(&mpt->keys); if (adt) { - bAnimVizSettings *avs; - /* get pointer to animviz settings for each target */ - if (mpt->pchan) { - avs = &mpt->ob->pose->avs; - } - else { - avs = &mpt->ob->avs; - } + bAnimVizSettings *avs = animviz_target_settings_get(mpt); /* it is assumed that keyframes for bones are all grouped in a single group * unless an option is set to always use the whole action @@ -334,16 +336,10 @@ void animviz_calc_motionpaths(Depsgraph *depsgraph, /* clear recalc flags from targets */ for (MPathTarget *mpt = targets->first; mpt; mpt = mpt->next) { - bAnimVizSettings *avs; bMotionPath *mpath = mpt->mpath; /* get pointer to animviz settings for each target */ - if (mpt->pchan) { - avs = &mpt->ob->pose->avs; - } - else { - avs = &mpt->ob->avs; - } + bAnimVizSettings *avs = animviz_target_settings_get(mpt); /* clear the flag requesting recalculation of targets */ avs->recalc &= ~ANIMVIZ_RECALC_PATHS; |