Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2021-05-03 00:03:00 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2021-11-24 15:58:32 +0300
commit5d59b38605d61b2aeabfa1cb572b5a0d9158424b (patch)
tree82b0a19eb0e5dd7290ae81c10427082576d8dfb5 /source/blender/editors/space_nla/nla_edit.c
parent057cb7e5e77bcf932882292a774156b5d8c90ab4 (diff)
Animation: allow manually setting the intended playback range for actions.
Some operations, e.g. adding a new action strip to NLA, require knowing the active frame range of an action. However, currently it can only be deduced by scanning the keyframes of the curves within it. This is not ideal if e.g. curves are staggered for overlap. As suggested by Nathan Vegdahl in comments to T54724, this patch adds Action properties that allow manually specifying its active frame range. The settings are exposed via a panel in the Dopesheet and Action Editor. When enabled, the range is highlighted in the background using a striped fill to distinguish it from the solid filled regular playback range. When set, the frame range is used when adding or updating NLA tracks, and by add-ons using `Action.frame_range`, e.g. FBX exporter. Differential Revision: https://developer.blender.org/D11803
Diffstat (limited to 'source/blender/editors/space_nla/nla_edit.c')
-rw-r--r--source/blender/editors/space_nla/nla_edit.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index 62f8906d136..9f42e6378ca 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -2193,8 +2193,19 @@ static int nlaedit_apply_scale_exec(bContext *C, wmOperator *UNUSED(op))
* and recalculate the extents of the action now that it has been scaled
* but leave everything else alone
*/
+ const float start = nlastrip_get_frame(strip, strip->actstart, NLATIME_CONVERT_MAP);
+ const float end = nlastrip_get_frame(strip, strip->actend, NLATIME_CONVERT_MAP);
+
+ if (strip->act->flag & ACT_FRAME_RANGE) {
+ strip->act->frame_start = nlastrip_get_frame(
+ strip, strip->act->frame_start, NLATIME_CONVERT_MAP);
+ strip->act->frame_end = nlastrip_get_frame(
+ strip, strip->act->frame_end, NLATIME_CONVERT_MAP);
+ }
+
strip->scale = 1.0f;
- calc_action_range(strip->act, &strip->actstart, &strip->actend, 0);
+ strip->actstart = start;
+ strip->actend = end;
ale->update |= ANIM_UPDATE_DEPS;
}