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:
authorJoshua Leung <aligorith@gmail.com>2010-01-24 09:28:53 +0300
committerJoshua Leung <aligorith@gmail.com>2010-01-24 09:28:53 +0300
commitac38eba721a5c0d8c9cf47c0222b38212acb9ae6 (patch)
treee962e250a9f6348f51befddbdf63228a0d14d53a /source/blender/blenkernel/intern/nla.c
parent351d239ac7cdc028549ae84f2ff1acd594570a07 (diff)
NLA Editor: Sync Action Extents with Referenced Range
This operator can be accessed from the "Action Clip" panel, and is used to include keyframes that have been added to a strip already in the NLA. Although this is not a recommended workflow, having this ability is useful at times.
Diffstat (limited to 'source/blender/blenkernel/intern/nla.c')
-rw-r--r--source/blender/blenkernel/intern/nla.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index c9008e91646..2af9159f70f 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -1035,6 +1035,31 @@ short BKE_nlastrip_within_bounds (NlaStrip *strip, float min, float max)
return 1;
}
+/* Recalculate the start and end frames for the current strip, after changing
+ * the extents of the action or the mapping (repeats or scale factor) info
+ */
+void BKE_nlastrip_recalculate_bounds (NlaStrip *strip)
+{
+ float actlen, mapping;
+
+ /* sanity checks
+ * - must have a strip
+ * - can only be done for action clips
+ */
+ if ((strip == NULL) || (strip->type != NLASTRIP_TYPE_CLIP))
+ return;
+
+ /* calculate new length factors */
+ actlen= strip->actend - strip->actstart;
+ if (IS_EQ(actlen, 0.0f)) actlen= 1.0f;
+
+ mapping= strip->scale * strip->repeat;
+
+ /* adjust endpoint of strip in response to this */
+ if (IS_EQ(mapping, 0.0f) == 0)
+ strip->end = (actlen * mapping) + strip->start;
+}
+
/* Is the given NLA-strip the first one to occur for the given AnimData block */
// TODO: make this an api method if necesary, but need to add prefix first
static short nlastrip_is_first (AnimData *adt, NlaStrip *strip)