diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-08-25 05:46:05 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-08-25 05:46:05 +0400 |
commit | e2eaf269350d972daec1f19ae5aa5ee7fbad4685 (patch) | |
tree | 31142b1fb2246b1581feccc679a8b23a1e906742 /source/blender/blenkernel/intern/action.c | |
parent | 4a78b9e9046567e86ed3ccada83a50c43684facd (diff) |
2.5 - NLA Bugfixes:
* F-Modifiers on F-Curves can now taken into account when calculating the extents of actions. This is used when there are some NLA strips and some action with some F-Modifiers is being played back on top of those.
* The toggles in the NLA channels list now respect the width of the list instead of using a hardcoded position. This means that clicking on these toggles when the list is resized works again.
Diffstat (limited to 'source/blender/blenkernel/intern/action.c')
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 6a39139d250..47de044ea25 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -838,14 +838,15 @@ short action_has_motion(const bAction *act) } /* Calculate the extents of given action */ -void calc_action_range(const bAction *act, float *start, float *end, int incl_hidden) +void calc_action_range(const bAction *act, float *start, float *end, short incl_modifiers) { FCurve *fcu; float min=999999999.0f, max=-999999999.0f; - short foundvert=0; + short foundvert=0, foundmod=0; if (act) { for (fcu= act->curves.first; fcu; fcu= fcu->next) { + /* if curve has keyframes, consider them first */ if (fcu->totvert) { float nmin, nmax; @@ -858,10 +859,53 @@ void calc_action_range(const bAction *act, float *start, float *end, int incl_hi foundvert= 1; } + + /* if incl_modifiers is enabled, need to consider modifiers too + * - only really care about the last modifier + */ + if ((incl_modifiers) && (fcu->modifiers.last)) { + FModifier *fcm= fcu->modifiers.last; + + /* only use the maximum sensible limits of the modifiers if they are more extreme */ + switch (fcm->type) { + case FMODIFIER_TYPE_LIMITS: /* Limits F-Modifier */ + { + FMod_Limits *fmd= (FMod_Limits *)fcm->data; + + if (fmd->flag & FCM_LIMIT_XMIN) { + min= MIN2(min, fmd->rect.xmin); + } + if (fmd->flag & FCM_LIMIT_XMAX) { + max= MAX2(max, fmd->rect.xmax); + } + } + break; + + case FMODIFIER_TYPE_CYCLES: /* Cycles F-Modifier */ + { + FMod_Cycles *fmd= (FMod_Cycles *)fcm->data; + + if (fmd->before_mode != FCM_EXTRAPOLATE_NONE) + min= MINAFRAMEF; + if (fmd->after_mode != FCM_EXTRAPOLATE_NONE) + max= MAXFRAMEF; + } + break; + + // TODO: function modifier may need some special limits + + default: /* all other standard modifiers are on the infinite range... */ + min= MINAFRAMEF; + max= MAXFRAMEF; + break; + } + + foundmod= 1; + } } } - if (foundvert) { + if (foundvert || foundmod) { if(min==max) max+= 1.0f; *start= min; *end= max; |