changes to the sequencer in trunk between 20855:20928, (excluding UI changes)
authorCampbell Barton <ideasman42@gmail.com>
Tue, 16 Jun 2009 15:04:29 +0000 (15:04 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 16 Jun 2009 15:04:29 +0000 (15:04 +0000)
had to //XXX comment some funcs.

source/blender/blenkernel/intern/sequence.c
source/blender/editors/space_sequencer/sequencer_draw.c

index 3365af36f8c94867be443c7826ad7b4e1b665095..bb0665a5b0f89487a2b76f99b979999e8bf27ea5 100644 (file)
@@ -1288,7 +1288,7 @@ static void seq_proxy_build_frame(Scene *scene, Sequence * seq, int cfra, int re
 
           depth = 32 is intentionally left in, otherwise ALPHA channels
           won't work... */
-       quality = 90;
+       quality = seq->strip->proxy->quality;
        ibuf->ftype= JPG | quality;
 
        BLI_make_existing_file(name);
@@ -1305,6 +1305,7 @@ static void seq_proxy_build_frame(Scene *scene, Sequence * seq, int cfra, int re
 void seq_proxy_rebuild(Scene *scene, Sequence * seq)
 {
        int cfra;
+       float rsize = seq->strip->proxy->size;
 
        waitcursor(1);
 
@@ -1322,6 +1323,8 @@ void seq_proxy_rebuild(Scene *scene, Sequence * seq)
                tse->flag &= ~STRIPELEM_PREVIEW_DONE;
        }
 
+       
+
        /* a _lot_ faster for movie files, if we read frames in
           sequential order */
        if (seq->flag & SEQ_REVERSE_FRAMES) {
@@ -1330,7 +1333,8 @@ void seq_proxy_rebuild(Scene *scene, Sequence * seq)
                        TStripElem * tse = give_tstripelem(seq, cfra);
 
                        if (!(tse->flag & STRIPELEM_PREVIEW_DONE)) {
-                               seq_proxy_build_frame(scene, seq, cfra, scene->r.size);
+//XXX                          set_timecursor(cfra);
+                               seq_proxy_build_frame(scene, seq, cfra, rsize);
                                tse->flag |= STRIPELEM_PREVIEW_DONE;
                        }
                        if (blender_test_break()) {
@@ -1343,7 +1347,8 @@ void seq_proxy_rebuild(Scene *scene, Sequence * seq)
                        TStripElem * tse = give_tstripelem(seq, cfra);
 
                        if (!(tse->flag & STRIPELEM_PREVIEW_DONE)) {
-                               seq_proxy_build_frame(scene, seq, cfra, scene->r.size);
+//XXX                          set_timecursor(cfra);
+                               seq_proxy_build_frame(scene, seq, cfra, rsize);
                                tse->flag |= STRIPELEM_PREVIEW_DONE;
                        }
                        if (blender_test_break()) {
@@ -1552,7 +1557,8 @@ static int input_have_to_preprocess(Scene *scene, Sequence * seq, TStripElem* se
 
        mul = seq->mul;
 
-       if(seq->blend_mode == SEQ_BLEND_REPLACE) {
+       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);
@@ -1897,10 +1903,14 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int
                        input_preprocess(scene, seq, se, cfra);
                }
        } else if(seq->type & SEQ_EFFECT) {
+               int use_preprocess = FALSE;
                /* should the effect be recalculated? */
                
                if (!build_proxy_run && se->ibuf == 0) {
                        se->ibuf = seq_proxy_fetch(scene, seq, cfra, render_size);
+                       if (se->ibuf) {
+                               use_preprocess = TRUE;
+                       }
                }
 
                if(se->ibuf == 0) {
@@ -1913,6 +1923,22 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int
                                se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rect, 0);
                        
                        do_effect(scene, cfra, seq, se);
+                       if (input_have_to_preprocess(scene, seq, se, cfra) &&
+                           !build_proxy_run) {
+                               if ((se->se1 && (se->ibuf == se->se1->ibuf)) ||
+                                   (se->se2 && (se->ibuf == se->se2->ibuf))) {
+                                       struct ImBuf * i
+                                               = IMB_dupImBuf(se->ibuf);
+
+                                       IMB_freeImBuf(se->ibuf);
+
+                                       se->ibuf = i;
+                               }
+                               use_preprocess = TRUE;
+                       }
+               }
+               if (use_preprocess) {
+                       input_preprocess(scene, seq, se, cfra);
                }
        } else if(seq->type == SEQ_IMAGE) {
                if(se->ok == STRIPELEM_OK && se->ibuf == 0) {
@@ -2067,8 +2093,8 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int
                        // XXX
 #if 0
                        if((G.f & G_PLAYANIM)==0 /* bad, is set on do_render_seq */
-                               && !(sce->r.scemode & R_DOSEQ)) 
-                               waitcursor(0);
+                          && !(sce->r.scemode & R_DOSEQ)
+                          && !build_proxy_run) 
 #endif
                        
                        CFRA = oldcfra;
@@ -3116,6 +3142,17 @@ void update_changed_seq_and_deps(Scene *scene, Sequence *changed_seq, int len_ch
                update_changed_seq_recurs(scene, seq, changed_seq, len_change, ibuf_change);
 }
 
+#if 0 // XXX from 2.4x, needs updating
+void free_imbuf_seq()
+{
+       Scene * sce = G.main->scene.first;
+       while(sce) {
+               free_imbuf_seq_editing(sce->ed);
+               sce= sce->id.next;
+       }
+}
+#endif 
+
 void free_imbuf_seq_with_ipo(Scene *scene, struct Ipo *ipo)
 {
        /* force update of all sequences with this ipo, on ipo changes */
@@ -3140,9 +3177,14 @@ void free_imbuf_seq_with_ipo(Scene *scene, struct Ipo *ipo)
 /* bad levell call... */
 void do_render_seq(RenderResult *rr, int cfra)
 {
+       static int recurs_depth = 0
        ImBuf *ibuf;
 
-       ibuf= give_ibuf_seq(scene, rr->rectx, rr->recty, cfra, 0, scene->r.size);
+       recurs_depth++;
+
+       ibuf= give_ibuf_seq(rr->rectx, rr->recty, cfra, 0, 100.0);
+
+       recurs_depth--;
        
        if(ibuf) {
                if(ibuf->rect_float) {
@@ -3179,7 +3221,7 @@ void do_render_seq(RenderResult *rr, int cfra)
                   on freeing _all_ buffers every time on long timelines...)
                   (schlaile)
                */
-               {
+               if (recurs_depth == 0) { /* with nested scenes, only free on toplevel... */
                        uintptr_t mem_in_use;
                        uintptr_t mmap_in_use;
                        uintptr_t max;
index 245076508a03c537fa3ee53ec97151b6eeb510ec..3b90039335eed4c4011e0d0efe5feb5ac0f0d0af 100644 (file)
@@ -741,7 +741,8 @@ static void draw_image_seq(Scene *scene, ARegion *ar, SpaceSeq *sseq)
        static int recursive= 0;
        float zoom;
        float zoomx, zoomy;
-       int render_size = 0;
+       float render_size = 0.0;
+       float proxy_size = 100.0;
 
        glClearColor(0.0, 0.0, 0.0, 0.0);
        glClear(GL_COLOR_BUFFER_BIT);
@@ -749,6 +750,8 @@ static void draw_image_seq(Scene *scene, ARegion *ar, SpaceSeq *sseq)
        render_size = sseq->render_size;
        if (render_size == 0) {
                render_size = scene->r.size;
+       } else {
+               proxy_size = render_size;
        }
        if (render_size < 0) {
                return;
@@ -767,13 +770,13 @@ static void draw_image_seq(Scene *scene, ARegion *ar, SpaceSeq *sseq)
        else {
                recursive= 1;
                if (special_seq_update) {
-                       ibuf= give_ibuf_seq_direct(scene, rectx, recty, (scene->r.cfra), render_size, special_seq_update);
+                       ibuf= give_ibuf_seq_direct(scene, rectx, recty, (scene->r.cfra), proxy_size, special_seq_update);
                } 
                else if (!U.prefetchframes) { // XXX || (G.f & G_PLAYANIM) == 0) {
-                       ibuf= (ImBuf *)give_ibuf_seq(scene, rectx, recty, (scene->r.cfra), sseq->chanshown, render_size);
+                       ibuf= (ImBuf *)give_ibuf_seq(scene, rectx, recty, (scene->r.cfra), sseq->chanshown, proxy_size);
                } 
                else {
-                       ibuf= (ImBuf *)give_ibuf_seq_threaded(scene, rectx, recty, (scene->r.cfra), sseq->chanshown, render_size);
+                       ibuf= (ImBuf *)give_ibuf_seq_threaded(scene, rectx, recty, (scene->r.cfra), sseq->chanshown, proxy_size);
                }
                recursive= 0;
                
@@ -824,7 +827,7 @@ static void draw_image_seq(Scene *scene, ARegion *ar, SpaceSeq *sseq)
        
        zoom= SEQ_ZOOM_FAC(sseq->zoom);
        if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
-               zoom /= render_size / 100.0;
+               zoom /= proxy_size / 100.0;
                zoomx = zoom * ((float)scene->r.xasp / (float)scene->r.yasp);
                zoomy = zoom;
        } else {
@@ -960,8 +963,11 @@ void drawprefetchseqspace(Scene *scene, ARegion *ar, SpaceSeq *sseq)
 {
        int rectx, recty;
        int render_size = sseq->render_size;
+       int proxy_size = 100.0; 
        if (render_size == 0) {
                render_size = scene->r.size;
+       } else {
+               proxy_size = render_size;
        }
        if (render_size < 0) {
                return;
@@ -973,7 +979,7 @@ void drawprefetchseqspace(Scene *scene, ARegion *ar, SpaceSeq *sseq)
        if(sseq->mainb != SEQ_DRAW_SEQUENCE) {
                give_ibuf_prefetch_request(
                        rectx, recty, (scene->r.cfra), sseq->chanshown,
-                       render_size);
+                       proxy_size);
        }
 }