diff options
author | Peter Schlaile <peter@schlaile.de> | 2009-11-22 23:22:35 +0300 |
---|---|---|
committer | Peter Schlaile <peter@schlaile.de> | 2009-11-22 23:22:35 +0300 |
commit | 42f99939f62de85069251f88a2ce26f78f4b02c9 (patch) | |
tree | f3f9543e56a2e23e275861771d56406adfc68622 /source/blender | |
parent | 85080f9e3fea0177e24f01a8f636d4b13b99714d (diff) |
== Sequencer ==
This should make animations in sequencer work again at most
places.
It removes facf0 and facf1 and replaces them by
* effect_fader (the fader position for transition effects
limited 0-1 value range)
* speed_fader (full range fader for speed effect)
Also: default transitions should work again.
Still not working: non-IPO-locked curves. (Don't really know,
if we can / want to bring them back in new animation system.)
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/seqeffects.c | 78 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequence.c | 84 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_sequence_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequence.c | 14 |
4 files changed, 78 insertions, 101 deletions
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 68edc00de23..a1f81bf6166 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -246,7 +246,6 @@ static void do_plugin_effect(Sequence * seq,int cfra, if(seq->plugin->cfra) *(seq->plugin->cfra)= cfra; -// XXX *(seq->plugin->cfra)= frame_to_float(scene, cfra); cp = PIL_dynlib_find_symbol( seq->plugin->handle, "seqname"); @@ -2781,10 +2780,8 @@ static void store_icu_yrange_speed(struct Sequence * seq, } } } -extern float frame_to_float (Scene *scene, int cfra); void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force) { - float facf0 = seq->facf0; float ctime, div; int cfra; float fallback_fac; @@ -2804,7 +2801,7 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force) /* XXX - new in 2.5x. should we use the animation system this way? * The fcurve is needed because many frames need evaluating at once - campbell */ - fcu= id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "factor_0", 0); + fcu= id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "speed_fader", 0); if (!v->frameMap || v->length != seq->len) { @@ -2838,32 +2835,29 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force) if ((v->flags & SEQ_SPEED_INTEGRATE) != 0) { float cursor = 0; + float facf; v->frameMap[0] = 0; v->lastValidFrame = 0; for (cfra = 1; cfra < v->length; cfra++) { if(fcu) { - if((seq->flag & SEQ_IPO_FRAME_LOCKED) != 0) { - ctime = frame_to_float(scene, seq->startdisp + cfra); - div = 1.0; - } else { - ctime= frame_to_float(scene, cfra); - div= v->length / 100.0f; - if(div==0.0) return; - } - -//XXX OLD ANIMSYS -// calc_ipo(seq->ipo, ctime/div); -// execute_ipo((ID *)seq, seq->ipo); - seq->facf0 = evaluate_fcurve(fcu, ctime/div); - } else - { - seq->facf0 = fallback_fac; + if((seq->flag & SEQ_IPO_FRAME_LOCKED) != 0) { + ctime = seq->startdisp + cfra; + div = 1.0; + } else { + ctime= cfra; + div= v->length / 100.0f; + if(div==0.0) return; + } + + facf = evaluate_fcurve(fcu, ctime/div); + } else { + facf = fallback_fac; } - seq->facf0 *= v->globalSpeed; + facf *= v->globalSpeed; - cursor += seq->facf0; + cursor += facf; if (cursor >= v->length) { v->frameMap[cfra] = v->length - 1; @@ -2873,41 +2867,39 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force) } } } else { + float facf; + v->lastValidFrame = 0; for (cfra = 0; cfra < v->length; cfra++) { if(fcu) { - if((seq->flag & SEQ_IPO_FRAME_LOCKED) != 0) { - ctime = frame_to_float(scene, seq->startdisp + cfra); - div = 1.0; - } else { - ctime= frame_to_float(scene, cfra); - div= v->length / 100.0f; - if(div==0.0) return; - } + if((seq->flag & SEQ_IPO_FRAME_LOCKED) != 0) { + ctime = seq->startdisp + cfra; + div = 1.0; + } else { + ctime= cfra; + div= v->length / 100.0f; + if(div==0.0) return; + } -// XXX old animation system -// calc_ipo(seq->ipo, ctime/div); -// execute_ipo((ID *)seq, seq->ipo); - seq->facf0 = evaluate_fcurve(fcu, ctime/div); + facf = evaluate_fcurve(fcu, ctime / div); + if (v->flags & SEQ_SPEED_COMPRESS_IPO_Y) { + facf *= v->length; + } } - if (v->flags & SEQ_SPEED_COMPRESS_IPO_Y) { - seq->facf0 *= v->length; - } if (!fcu) { - seq->facf0 = (float) cfra * fallback_fac; + facf = (float) cfra * fallback_fac; } - seq->facf0 *= v->globalSpeed; - if (seq->facf0 >= v->length) { - seq->facf0 = v->length - 1; + facf *= v->globalSpeed; + if (facf >= v->length) { + facf = v->length - 1; } else { v->lastValidFrame = cfra; } - v->frameMap[cfra] = seq->facf0; + v->frameMap[cfra] = facf; } } - seq->facf0 = facf0; } /* diff --git a/source/blender/blenkernel/intern/sequence.c b/source/blender/blenkernel/intern/sequence.c index e3e1debfa96..5266ab0e2e1 100644 --- a/source/blender/blenkernel/intern/sequence.c +++ b/source/blender/blenkernel/intern/sequence.c @@ -38,12 +38,15 @@ #include "DNA_listBase.h" #include "DNA_sequence_types.h" #include "DNA_scene_types.h" +#include "DNA_anim_types.h" #include "BKE_global.h" #include "BKE_image.h" #include "BKE_main.h" #include "BKE_sequence.h" +#include "BKE_fcurve.h" #include "BKE_utildefines.h" +#include "RNA_access.h" #include "BLI_blenlib.h" #include "BLI_util.h" @@ -809,25 +812,26 @@ static void do_effect(Scene *scene, int cfra, Sequence *seq, TStripElem * se) int x, y; int early_out; struct SeqEffectHandle sh = get_sequence_effect(seq); + FCurve *fcu= NULL; if (!sh.execute) { /* effect not supported in this version... */ make_black_ibuf(se->ibuf); return; } -#if 0 // XXX old animation system - if(seq->ipo && seq->ipo->curve.first) { - do_seq_ipo(scene, seq, cfra); - fac= seq->facf0; - facf= seq->facf1; - } else -#endif // XXX old animation system - { + fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, + "effect_fader", 0); + + if (!fcu) { sh.get_default_fac(seq, cfra, &fac, &facf); + if( scene->r.mode & R_FIELDS ); else facf= fac; + } else { + fac = facf = evaluate_fcurve(fcu, cfra); + if( scene->r.mode & R_FIELDS ) { + facf = evaluate_fcurve(fcu, cfra + 0.5); + } } - if( !(scene->r.mode & R_FIELDS) ) facf = fac; - early_out = sh.early_out(seq, fac, facf); if (early_out == -1) { /* no input needed */ @@ -1565,12 +1569,6 @@ static int input_have_to_preprocess(Scene *scene, Sequence * seq, TStripElem* se if(seq->blend_mode == SEQ_BLEND_REPLACE && !(seq->type & SEQ_EFFECT)) { -#if 0 // XXX old animation system - if (seq->ipo && seq->ipo->curve.first) { - do_seq_ipo(scene, seq, cfra); - mul *= seq->facf0; - } -#endif // XXX old animation system mul *= seq->blend_opacity / 100.0; } @@ -1655,12 +1653,6 @@ static void input_preprocess(Scene *scene, Sequence *seq, TStripElem *se, int cf mul = seq->mul; if(seq->blend_mode == SEQ_BLEND_REPLACE) { -#if 0 // XXX old animation system - if (seq->ipo && seq->ipo->curve.first) { - do_seq_ipo(scene, seq, cfra); - mul *= seq->facf0; - } -#endif // XXX old animation system mul *= seq->blend_opacity / 100.0; } @@ -2138,24 +2130,25 @@ static void do_effect_seq_recursively(Scene *scene, Sequence *seq, TStripElem *s float fac, facf; struct SeqEffectHandle sh = get_sequence_effect(seq); int early_out; + FCurve *fcu= NULL; se->se1 = 0; se->se2 = 0; se->se3 = 0; -#if 0 // XXX old animation system - if(seq->ipo && seq->ipo->curve.first) { - do_seq_ipo(scene, seq, cfra); - fac= seq->facf0; - facf= seq->facf1; - } else -#endif // XXX old animation system - { + fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, + "effect_fader", 0); + + if (!fcu) { sh.get_default_fac(seq, cfra, &fac, &facf); - } + if( scene->r.mode & R_FIELDS ); else facf= fac; + } else { + fac = facf = evaluate_fcurve(fcu, cfra); + if( scene->r.mode & R_FIELDS ) { + facf = evaluate_fcurve(fcu, cfra + 0.5); + } + } - if( scene->r.mode & R_FIELDS ); else facf= fac; - early_out = sh.early_out(seq, fac, facf); switch (early_out) { case -1: @@ -2389,6 +2382,7 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene, int early_out; Sequence * seq = seq_arr[i]; struct SeqEffectHandle sh; + float facf; se = give_tstripelem(seq, cfra); @@ -2415,21 +2409,9 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene, sh = get_sequence_blend(seq); -#if 0 // XXX old animation system - seq->facf0 = seq->facf1 = 1.0; - - - if(seq->ipo && seq->ipo->curve.first) { - do_seq_ipo(scene, seq, cfra); - } -#endif - - if( scene->r.mode & R_FIELDS ); else seq->facf0 = seq->facf1; - - seq->facf0 *= seq->blend_opacity / 100.0; - seq->facf1 *= seq->blend_opacity / 100.0; + facf = seq->blend_opacity / 100.0; - early_out = sh.early_out(seq, seq->facf0, seq->facf1); + early_out = sh.early_out(seq, facf, facf); switch (early_out) { case -1: @@ -2486,8 +2468,10 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene, struct SeqEffectHandle sh = get_sequence_blend(seq); TStripElem* se1 = give_tstripelem(seq_arr[i-1], cfra); TStripElem* se2 = give_tstripelem(seq_arr[i], cfra); + + float facf = seq->blend_opacity / 100.0; - int early_out = sh.early_out(seq, seq->facf0, seq->facf1); + int early_out = sh.early_out(seq, facf, facf); switch (early_out) { case 0: { int x= se2->ibuf->x; @@ -2535,12 +2519,12 @@ static TStripElem* do_build_seq_array_recursively(Scene *scene, if (swap_input) { sh.execute(seq, cfra, - seq->facf0, seq->facf1, x, y, + facf, facf, x, y, se2->ibuf, se1->ibuf_comp, 0, se2->ibuf_comp); } else { sh.execute(seq, cfra, - seq->facf0, seq->facf1, x, y, + facf, facf, x, y, se1->ibuf_comp, se2->ibuf, 0, se2->ibuf_comp); } diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 69096e5d2cf..9b38ad6b8cf 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -150,7 +150,8 @@ typedef struct Sequence { struct Ipo *ipo; // xxx depreceated... old animation system struct Scene *scene; struct anim *anim; - float facf0, facf1; + float effect_fader; + float speed_fader; PluginSeq *plugin; diff --git a/source/blender/makesrna/intern/rna_sequence.c b/source/blender/makesrna/intern/rna_sequence.c index 4add39a391b..994430766c7 100644 --- a/source/blender/makesrna/intern/rna_sequence.c +++ b/source/blender/makesrna/intern/rna_sequence.c @@ -532,15 +532,15 @@ static void rna_def_sequence(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Blend Opacity", ""); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); - /* generic factors, should these be exposed some other way? */ - prop= RNA_def_property(srna, "factor_0", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "facf0"); - RNA_def_property_ui_text(prop, "Generic Factor 0", ""); + prop= RNA_def_property(srna, "effect_fader", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_float_sdna(prop, NULL, "effect_fader"); + RNA_def_property_ui_text(prop, "Effect fader position", ""); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); - prop= RNA_def_property(srna, "factor_1", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "facf1"); - RNA_def_property_ui_text(prop, "Generic Factor 0", ""); + prop= RNA_def_property(srna, "speed_fader", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "speed_fader"); + RNA_def_property_ui_text(prop, "Speed effect fader position", ""); RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL); /* functions */ |