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-27 16:35:11 +0400
committerJoshua Leung <aligorith@gmail.com>2009-06-27 16:35:11 +0400
commitd3557fc487bc5e5c02c9758b6a05200575e82e84 (patch)
tree0b894d24989f94d0ce519837cc6006dc666adfdf /source/blender/makesrna/intern/rna_nla.c
parentf508319fc8c54e918446482392ab6e1b01c63fe6 (diff)
NLA SoC: Recoded the strip<->global time conversion code
* Strip evaluation now takes into account repeats * Increasing the number of repeats lengthens the strip, while decreasing the number of repeats does the opposite. TODO: - inverse correction doesn't take into account repeats != 1, so tweaking strips with repeats is currently not recommended!
Diffstat (limited to 'source/blender/makesrna/intern/rna_nla.c')
-rw-r--r--source/blender/makesrna/intern/rna_nla.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index 84a84492ea3..5dc624b67bc 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -133,6 +133,27 @@ static void rna_NlaStrip_scale_set(PointerRNA *ptr, float value)
printf("NlaStrip Set Scale Error (in RNA): Scale = %0.4f, Repeat = %0.4f \n", data->scale, data->repeat);
}
+static void rna_NlaStrip_repeat_set(PointerRNA *ptr, float value)
+{
+ NlaStrip *data= (NlaStrip*)ptr->data;
+ float actlen, mapping;
+
+ /* set scale value */
+ CLAMP(value, 0.01f, 1000.0f); /* NOTE: these need to be synced with the values in the property definition in rna_def_nlastrip() */
+ data->repeat= value;
+
+ /* calculate existing factors */
+ actlen= data->actend - data->actstart;
+ if (IS_EQ(actlen, 0.0f)) actlen= 1.0f;
+ mapping= data->scale * data->repeat;
+
+ /* adjust endpoint of strip in response to this */
+ if (IS_EQ(mapping, 0.0f) == 0)
+ data->end = (actlen * mapping) + data->start;
+ else
+ printf("NlaStrip Set Repeat Error (in RNA): Scale = %0.4f, Repeat = %0.4f \n", data->scale, data->repeat);
+}
+
static void rna_NlaStrip_blend_in_set(PointerRNA *ptr, float value)
{
NlaStrip *data= (NlaStrip*)ptr->data;
@@ -265,7 +286,8 @@ void rna_def_nlastrip(BlenderRNA *brna)
/* Action Reuse */
prop= RNA_def_property(srna, "repeat", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "repeat");
- RNA_def_property_range(prop, 1.0f, 1000.0f); /* these limits have currently be chosen arbitarily, but could be extended (minimum should still be > 0 though) if needed... */
+ RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_repeat_set", NULL);
+ RNA_def_property_range(prop, 0.1f, 1000.0f); /* these limits have currently be chosen arbitarily, but could be extended (minimum should still be > 0 though) if needed... */
RNA_def_property_ui_text(prop, "Repeat", "Number of times to repeat the ");
prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);