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>2009-06-25 16:30:49 +0400
committerJoshua Leung <aligorith@gmail.com>2009-06-25 16:30:49 +0400
commit6510da4ce2c7d3ffef9d95d7adedd31f59c1fc4b (patch)
tree8451f2b706d2561743d7997d9ba8748388c832f9 /source/blender/makesrna/intern/rna_nla.c
parentdeffe4a315f30a8f8a2a2e2f23f16cfcb0ac5f18 (diff)
NLA SoC: Fix transforms for transition strips.
Diffstat (limited to 'source/blender/makesrna/intern/rna_nla.c')
-rw-r--r--source/blender/makesrna/intern/rna_nla.c49
1 files changed, 38 insertions, 11 deletions
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index dacd257dc17..84a84492ea3 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -40,17 +40,30 @@
#include <stdio.h>
#include <math.h>
+/* temp constant defined for these funcs only... */
+#define NLASTRIP_MIN_LEN_THRESH 0.1f
+
static void rna_NlaStrip_start_frame_set(PointerRNA *ptr, float value)
{
NlaStrip *data= (NlaStrip*)ptr->data;
/* clamp value to lie within valid limits
* - cannot start past the end of the strip + some flexibility threshold
- * - cannot start before the previous strip (if present) ends
+ * - cannot start before the previous strip (if present) ends
+ * -> but if it was a transition, we could go up to the start of the strip + some flexibility threshold
+ * as long as we re-adjust the transition afterwards
* - minimum frame is -MAXFRAME so that we don't get clipping on frame 0
*/
if (data->prev) {
- CLAMP(value, data->prev->end, data->end-0.1f);
+ if (data->prev->type == NLASTRIP_TYPE_TRANSITION) {
+ CLAMP(value, data->prev->start+NLASTRIP_MIN_LEN_THRESH, data->end-NLASTRIP_MIN_LEN_THRESH);
+
+ /* readjust the transition to stick to the endpoints of the action-clips */
+ data->prev->end= value;
+ }
+ else {
+ CLAMP(value, data->prev->end, data->end-NLASTRIP_MIN_LEN_THRESH);
+ }
}
else {
CLAMP(value, -MAXFRAME, data->end);
@@ -61,28 +74,42 @@ static void rna_NlaStrip_start_frame_set(PointerRNA *ptr, float value)
static void rna_NlaStrip_end_frame_set(PointerRNA *ptr, float value)
{
NlaStrip *data= (NlaStrip*)ptr->data;
- float len, actlen;
/* clamp value to lie within valid limits
* - must not have zero or negative length strip, so cannot start before the first frame
* + some minimum-strip-length threshold
* - cannot end later than the start of the next strip (if present)
+ * -> but if it was a transition, we could go up to the start of the end - some flexibility threshold
+ * as long as we re-adjust the transition afterwards
*/
if (data->next) {
- CLAMP(value, data->start+0.1f, data->next->start);
+ if (data->next->type == NLASTRIP_TYPE_TRANSITION) {
+ CLAMP(value, data->start+NLASTRIP_MIN_LEN_THRESH, data->next->end-NLASTRIP_MIN_LEN_THRESH);
+
+ /* readjust the transition to stick to the endpoints of the action-clips */
+ data->next->start= value;
+ }
+ else {
+ CLAMP(value, data->start+NLASTRIP_MIN_LEN_THRESH, data->next->start);
+ }
}
else {
- CLAMP(value, data->start+0.1f, MAXFRAME);
+ CLAMP(value, data->start+NLASTRIP_MIN_LEN_THRESH, MAXFRAME);
}
data->end= value;
- /* calculate the lengths the strip and its action (if applicable) */
- len= data->end - data->start;
- actlen= data->actend - data->actstart;
- if (IS_EQ(actlen, 0.0f)) actlen= 1.0f;
- /* now, adjust the 'scale' setting to reflect this (so that this change can be valid) */
- data->scale= len / ((actlen) * data->repeat);
+ /* calculate the lengths the strip and its action (if applicable) */
+ if (data->type == NLASTRIP_TYPE_CLIP) {
+ float len, actlen;
+
+ len= data->end - data->start;
+ actlen= data->actend - data->actstart;
+ if (IS_EQ(actlen, 0.0f)) actlen= 1.0f;
+
+ /* now, adjust the 'scale' setting to reflect this (so that this change can be valid) */
+ data->scale= len / ((actlen) * data->repeat);
+ }
}
static void rna_NlaStrip_scale_set(PointerRNA *ptr, float value)