diff options
author | Wayde Moss <wbmoss_dev@yahoo.com> | 2021-01-15 02:46:28 +0300 |
---|---|---|
committer | Wayde Moss <wbmoss_dev@yahoo.com> | 2021-01-15 02:47:12 +0300 |
commit | 32e4ded24b6b3e515ee11c706bb1e6bbdb1f823e (patch) | |
tree | 0408c061bb29960567ec4a491d23e0c435159629 /source/blender/blenkernel/intern/anim_sys.c | |
parent | 09709a7e64ff0b225e16f97926b54c6441d94499 (diff) |
Nla Refactor: is_fcurve_evaluatable()
No functional changes.
Future patches {D8867} {D8296} make use of it.
Reviewed by: sybren, ChrisLend
Differential Revision: http://developer.blender.org/D9691
Diffstat (limited to 'source/blender/blenkernel/intern/anim_sys.c')
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index c8a4a125693..9fb3e8ea1f1 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -362,6 +362,20 @@ void BKE_keyingsets_blend_read_expand(BlendExpander *expander, ListBase *list) /* ***************************************** */ /* Evaluation Data-Setting Backend */ +static bool is_fcurve_evaluatable(FCurve *fcu) +{ + if (fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) { + return false; + } + if (fcu->grp != NULL && (fcu->grp->flag & AGRP_MUTED)) { + return false; + } + if (BKE_fcurve_is_empty(fcu)) { + return false; + } + return true; +} + bool BKE_animsys_store_rna_setting(PointerRNA *ptr, /* typically 'fcu->rna_path', 'fcu->array_index' */ const char *rna_path, @@ -594,18 +608,11 @@ static void animsys_evaluate_fcurves(PointerRNA *ptr, { /* Calculate then execute each curve. */ LISTBASE_FOREACH (FCurve *, fcu, list) { - /* Check if this F-Curve doesn't belong to a muted group. */ - if ((fcu->grp != NULL) && (fcu->grp->flag & AGRP_MUTED)) { - continue; - } - /* Check if this curve should be skipped. */ - if ((fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED))) { - continue; - } - /* Skip empty curves, as if muted. */ - if (BKE_fcurve_is_empty(fcu)) { + + if (!is_fcurve_evaluatable(fcu)) { continue; } + PathResolvedRNA anim_rna; if (BKE_animsys_store_rna_setting(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) { const float curval = calculate_fcurve(&anim_rna, fcu, anim_eval_context); @@ -1902,16 +1909,8 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr, /* Evaluate all the F-Curves in the action, * saving the relevant pointers to data that will need to be used. */ for (fcu = strip->act->curves.first; fcu; fcu = fcu->next) { - float value = 0.0f; - /* check if this curve should be skipped */ - if (fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) { - continue; - } - if ((fcu->grp) && (fcu->grp->flag & AGRP_MUTED)) { - continue; - } - if (BKE_fcurve_is_empty(fcu)) { + if (!is_fcurve_evaluatable(fcu)) { continue; } @@ -1919,7 +1918,7 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr, * NOTE: we use the modified time here, since strip's F-Curve Modifiers * are applied on top of this. */ - value = evaluate_fcurve(fcu, evaltime); + float value = evaluate_fcurve(fcu, evaltime); /* apply strip's F-Curve Modifiers on this value * NOTE: we apply the strip's original evaluation time not the modified one @@ -2144,13 +2143,7 @@ static void nla_eval_domain_action(PointerRNA *ptr, LISTBASE_FOREACH (FCurve *, fcu, &act->curves) { /* check if this curve should be skipped */ - if (fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) { - continue; - } - if ((fcu->grp) && (fcu->grp->flag & AGRP_MUTED)) { - continue; - } - if (BKE_fcurve_is_empty(fcu)) { + if (!is_fcurve_evaluatable(fcu)) { continue; } |