diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-06-03 17:34:02 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-06-03 17:34:02 +0400 |
commit | 05a1c144ad3ece78a641401be1193905c3db49f5 (patch) | |
tree | bb7b57972af679be41202068f2d3b4fa7221e167 /source/blender/blenkernel/intern/fmodifier.c | |
parent | fbff066a70c23077c16899a74feb29096ce5a2e9 (diff) |
Experimental Feature: Frame Range Masks for FModifiers
Using this feature, it is now possible to for example have different
noise-profiles for different parts of a curve, which makes it possible
to do animate camera shake for example.
Or perhaps, for having greater control of mixing and matching
different parts of F-Modifier effects, such as combining several
generator modifiers to get multi-case functions for instance.
See http://aligorith.blogspot.com/2011/06/gsoc11-fmodifier-range-
masks.html for details.
Diffstat (limited to 'source/blender/blenkernel/intern/fmodifier.c')
-rw-r--r-- | source/blender/blenkernel/intern/fmodifier.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 844f25e6d21..4a1a0f9ac6b 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -1230,11 +1230,21 @@ float evaluate_time_fmodifiers (ListBase *modifiers, FCurve *fcu, float cvalue, for (fcm= modifiers->last; fcm; fcm= fcm->prev) { FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm); - /* only evaluate if there's a callback for this */ - // TODO: implement the 'influence' control feature... - if (fmi && fmi->evaluate_modifier_time) { - if ((fcm->flag & (FMODIFIER_FLAG_DISABLED|FMODIFIER_FLAG_MUTED)) == 0) - evaltime= fmi->evaluate_modifier_time(fcu, fcm, cvalue, evaltime); + if (fmi == NULL) + continue; + + /* if modifier cannot be applied on this frame (whatever scale it is on, it won't affect the results) + * hence we shouldn't bother seeing what it would do given the chance + */ + if ((fcm->flag & FMODIFIER_FLAG_RANGERESTRICT)==0 || + ((fcm->sfra <= evaltime) && (fcm->efra >= evaltime)) ) + { + /* only evaluate if there's a callback for this */ + // TODO: implement the 'influence' control feature... + if (fmi->evaluate_modifier_time) { + if ((fcm->flag & (FMODIFIER_FLAG_DISABLED|FMODIFIER_FLAG_MUTED)) == 0) + evaltime= fmi->evaluate_modifier_time(fcu, fcm, cvalue, evaltime); + } } } @@ -1257,11 +1267,18 @@ void evaluate_value_fmodifiers (ListBase *modifiers, FCurve *fcu, float *cvalue, for (fcm= modifiers->first; fcm; fcm= fcm->next) { FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm); - /* only evaluate if there's a callback for this */ + if (fmi == NULL) + continue; + + /* only evaluate if there's a callback for this, and if F-Modifier can be evaluated on this frame */ // TODO: implement the 'influence' control feature... - if (fmi && fmi->evaluate_modifier) { - if ((fcm->flag & (FMODIFIER_FLAG_DISABLED|FMODIFIER_FLAG_MUTED)) == 0) - fmi->evaluate_modifier(fcu, fcm, cvalue, evaltime); + if ((fcm->flag & FMODIFIER_FLAG_RANGERESTRICT)==0 || + ((fcm->sfra <= evaltime) && (fcm->efra >= evaltime)) ) + { + if (fmi->evaluate_modifier) { + if ((fcm->flag & (FMODIFIER_FLAG_DISABLED|FMODIFIER_FLAG_MUTED)) == 0) + fmi->evaluate_modifier(fcu, fcm, cvalue, evaltime); + } } } } |