== Sequencer ==
authorPeter Schlaile <peter@schlaile.de>
Sun, 22 Nov 2009 20:22:35 +0000 (20:22 +0000)
committerPeter Schlaile <peter@schlaile.de>
Sun, 22 Nov 2009 20:22:35 +0000 (20:22 +0000)
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.)

release/scripts/ui/space_sequencer.py
source/blender/blenkernel/intern/seqeffects.c
source/blender/blenkernel/intern/sequence.c
source/blender/makesdna/DNA_sequence_types.h
source/blender/makesrna/intern/rna_sequence.c

index 7895d40de6a4fb829c80ff21439f4d354f924896..6a0ddc5fa7ee0d1e489e8f344aa8594842c3983b 100644 (file)
@@ -428,8 +428,10 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel):
             col.itemR(strip, "rotation_end", text="End")
 
         col = layout.column(align=True)
-        col.itemR(strip, "factor_0", text="Anim0")
-        col.itemR(strip, "factor_1", text="Anim1")
+        if strip.type == 'SPEED':
+            col.itemR(strip, "speed_fader", text="Speed fader")
+        else:
+            col.itemR(strip, "effect_fader", text="Effect fader")
 
 
 class SEQUENCER_PT_input(SequencerButtonsPanel):
index 68edc00de234c8bfe84f4e535ef6c10da2116608..a1f81bf61669f1810aea905fdb3f8a1c5ef5eb14 100644 (file)
@@ -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;
 }
 
 /*
index e3e1debfa96a4dc0b5104dde076dcc3cf5f7dc8c..5266ab0e2e192f4dc2b7b2a2f78b48dc6de1c743 100644 (file)
 #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);
                        }
index 69096e5d2cfe000b0e8bf3d13dbc55d02dba3830..9b38ad6b8cfd417d760cb01ea0ea06cfeea21eeb 100644 (file)
@@ -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;
 
index 4add39a391b69b64b258d0d9b27cb00ce317d28d..994430766c733ba94bc4d02954768e00d6dbfb13 100644 (file)
@@ -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 */