From be5293d3ad38ba5f9f32ac8585d012bc44a9e684 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 8 Jul 2009 05:00:10 +0000 Subject: NLA SoC: Influence/Time properties for strips can now be animated * These settings can now be edited + keyframed (using IKEY over the button only for now... other cases will fail) * Reshuffled some of the keyframing code to make this sort of thing easier to do. Also, restored corrections for NLA-mapping when inserting/removing keyframes. TODOS: * animation editors don't show these keyframes yet * the buttons don't change colour yet to reflect this state. How to do this efficiently? * allow keyframing of these in more places * more robust UI handling for this. --- source/blender/makesrna/intern/rna_nla.c | 36 +++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'source/blender/makesrna/intern/rna_nla.c') diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index b0149d29e69..219feaad09b 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -40,6 +40,9 @@ #include #include +/* needed for some of the validation stuff... */ +#include "BKE_nla.h" + /* temp constant defined for these funcs only... */ #define NLASTRIP_MIN_LEN_THRESH 0.1f @@ -196,6 +199,32 @@ static void rna_NlaStrip_action_end_frame_set(PointerRNA *ptr, float value) data->actend= value; } +static void rna_NlaStrip_animated_influence_set(PointerRNA *ptr, int value) +{ + NlaStrip *data= (NlaStrip*)ptr->data; + + if (value) { + /* set the flag, then make sure a curve for this exists */ + data->flag |= NLASTRIP_FLAG_USR_INFLUENCE; + BKE_nlastrip_validate_fcurves(data); + } + else + data->flag &= ~NLASTRIP_FLAG_USR_INFLUENCE; +} + +static void rna_NlaStrip_animated_time_set(PointerRNA *ptr, int value) +{ + NlaStrip *data= (NlaStrip*)ptr->data; + + if (value) { + /* set the flag, then make sure a curve for this exists */ + data->flag |= NLASTRIP_FLAG_USR_TIME; + BKE_nlastrip_validate_fcurves(data); + } + else + data->flag &= ~NLASTRIP_FLAG_USR_TIME; +} + #else void rna_def_nlastrip(BlenderRNA *brna) @@ -321,14 +350,15 @@ void rna_def_nlastrip(BlenderRNA *brna) prop= RNA_def_property(srna, "strip_time", PROP_FLOAT, PROP_NONE); RNA_def_property_ui_text(prop, "Strip Time", "Frame of referenced Action to evaluate."); + // TODO: should the animated_influence/time settings be animatable themselves? prop= RNA_def_property(srna, "animated_influence", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX for now, not editable RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_INFLUENCE); + RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_animated_influence_set"); RNA_def_property_ui_text(prop, "Animated Influence", "Influence setting is controlled by an F-Curve rather than automatically determined."); prop= RNA_def_property(srna, "animated_time", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX for now, not editable - RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_INFLUENCE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME); + RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_animated_time_set"); RNA_def_property_ui_text(prop, "Animated Strip Time", "Strip time is controlled by an F-Curve rather than automatically determined."); /* settings */ -- cgit v1.2.3