== Sequencer ==
authorPeter Schlaile <peter@schlaile.de>
Sun, 14 Jun 2009 10:59:54 +0000 (10:59 +0000)
committerPeter Schlaile <peter@schlaile.de>
Sun, 14 Jun 2009 10:59:54 +0000 (10:59 +0000)
This fixes:
* free_imbuf_seq() didn't free all scenes. That will lead to steady memory
  growth in case of nested timelines with several scenes.
* sequencer panels were always jumping around, depending on strip type,
  which was caused by choosing always the same panel position and the
  silly limitation, that
* effect strips had no filter option, which was therefore added.
  So you can apply color balance on effect filter output now :)

source/blender/src/buttons_scene.c
source/blender/src/sequence.c

index 7c361b6113db8c6d113795df7a9eff28a424157e..532ecad249f3ea5511e91c415e986d60d8c584df 100644 (file)
@@ -570,7 +570,7 @@ static void seq_panel_editing()
                           UI_EMBOSS, UI_HELV, curarea->win);
 
        if(uiNewPanel(curarea, block, "Edit", "Sequencer", 
-                     10, 230, 318, 204) == 0) return;
+                     0, 0, 318, 204) == 0) return;
 
        uiDefBut(block, LABEL, 
                 0, give_seqname(last_seq), 
@@ -754,7 +754,7 @@ static void seq_panel_input()
                           UI_EMBOSS, UI_HELV, curarea->win);
 
        if(uiNewPanel(curarea, block, "Input", "Sequencer", 
-                     10, 230, 318, 204) == 0) return;
+                     320, 0, 318, 204) == 0) return;
 
        if (SEQ_HAS_PATH(last_seq)) {
                uiDefBut(block, TEX, 
@@ -897,7 +897,7 @@ static void seq_panel_filter_video()
                           UI_EMBOSS, UI_HELV, curarea->win);
 
        if(uiNewPanel(curarea, block, "Filter", "Sequencer", 
-                     10, 230, 318, 204) == 0) return;
+                     640, 0, 318, 204) == 0) return;
 
 
        uiBlockBeginAlign(block);
@@ -1024,7 +1024,7 @@ static void seq_panel_filter_audio()
                           UI_EMBOSS, UI_HELV, curarea->win);
 
        if(uiNewPanel(curarea, block, "Filter", "Sequencer", 
-                     10, 230, 318, 204) == 0) return;
+                     640, 0, 318, 204) == 0) return;
 
        uiBlockBeginAlign(block);
        uiDefButF(block, NUM, B_SEQ_BUT_RELOAD, "Gain (dB):", 10,50,150,19, &last_seq->level, -96.0, 6.0, 100, 0, "");
@@ -1040,7 +1040,7 @@ static void seq_panel_effect()
                           UI_EMBOSS, UI_HELV, curarea->win);
 
        if(uiNewPanel(curarea, block, "Effect", "Sequencer", 
-                     10, 230, 318, 204) == 0) return;
+                     320, 0, 318, 204) == 0) return;
 
        if(last_seq->type == SEQ_PLUGIN) {
                PluginSeq *pis;
@@ -1168,7 +1168,7 @@ static void seq_panel_proxy()
                           UI_EMBOSS, UI_HELV, curarea->win);
 
        if(uiNewPanel(curarea, block, "Proxy", "Sequencer", 
-                     10, 230, 318, 204) == 0) return;
+                     960, 0, 318, 204) == 0) return;
 
        uiBlockBeginAlign(block);
 
@@ -1276,7 +1276,7 @@ void sequencer_panels()
        }
 
        if (type == SEQ_PLUGIN || type >= SEQ_EFFECT) {
-               panels |= SEQ_PANEL_EFFECT | SEQ_PANEL_PROXY;
+               panels |= SEQ_PANEL_EFFECT | SEQ_PANEL_FILTER| SEQ_PANEL_PROXY;
        }
 
        if (panels & SEQ_PANEL_EDITING) {
index cf2b28c6d7250d790463b6a13265e58c1fe9af14..44661b5fa91ae9e6910abba91e62b7e293a481ff 100644 (file)
@@ -1480,7 +1480,8 @@ static int input_have_to_preprocess(Sequence * seq, TStripElem* se, int cfra)
 
        mul = seq->mul;
 
-       if(seq->blend_mode == SEQ_BLEND_REPLACE) {
+       if(seq->blend_mode == SEQ_BLEND_REPLACE &&
+          !(seq->type & SEQ_EFFECT)) {
                if (seq->ipo && seq->ipo->curve.first) {
                        do_seq_ipo(seq, cfra);
                        mul *= seq->facf0;
@@ -1568,7 +1569,8 @@ static void input_preprocess(Sequence * seq, TStripElem* se, int cfra)
 
        mul = seq->mul;
 
-       if(seq->blend_mode == SEQ_BLEND_REPLACE) {
+       if(seq->blend_mode == SEQ_BLEND_REPLACE &&
+          !(seq->type & SEQ_EFFECT)) {
                if (seq->ipo && seq->ipo->curve.first) {
                        do_seq_ipo(seq, cfra);
                        mul *= seq->facf0;
@@ -1822,10 +1824,14 @@ static void do_build_seq_ibuf(Sequence * seq, TStripElem *se, int cfra,
                        input_preprocess(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(seq, cfra, render_size);
+                       if (se->ibuf) {
+                               use_preprocess = TRUE;
+                       }
                }
 
                if(se->ibuf == 0) {
@@ -1838,6 +1844,22 @@ static void do_build_seq_ibuf(Sequence * seq, TStripElem *se, int cfra,
                                se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rect, 0);
                        
                        do_effect(cfra, seq, se);
+                       if (input_have_to_preprocess(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(seq, se, cfra);
                }
        } else if(seq->type == SEQ_IMAGE) {
                if(se->ok == STRIPELEM_OK && se->ibuf == 0) {
@@ -2946,9 +2968,8 @@ void free_imbuf_seq_except(int cfra)
        END_SEQ
 }
 
-void free_imbuf_seq()
+static void free_imbuf_seq_editing(Editing * ed)
 {
-       Editing *ed= G.scene->ed;
        Sequence *seq;
        TStripElem *se;
        int a;
@@ -2990,6 +3011,15 @@ void free_imbuf_seq()
        END_SEQ
 }
 
+void free_imbuf_seq()
+{
+       Scene * sce = G.main->scene.first;
+       while(sce) {
+               free_imbuf_seq_editing(sce->ed);
+               sce= sce->id.next;
+       }
+}
+
 void free_imbuf_seq_with_ipo(struct Ipo *ipo)
 {
        /* force update of all sequences with this ipo, on ipo changes */
@@ -3074,12 +3104,17 @@ void update_changed_seq_and_deps(Sequence *changed_seq, int len_change, int ibuf
 /* bad levell call... */
 void do_render_seq(RenderResult *rr, int cfra)
 {
+       static int recurs_depth = 0;
        ImBuf *ibuf;
 
        G.f |= G_PLAYANIM;      /* waitcursor patch */
 
+       recurs_depth++;
+
        ibuf= give_ibuf_seq(rr->rectx, rr->recty, cfra, 0, G.scene->r.size);
        
+       recurs_depth--;
+
        if(ibuf) {
                if(ibuf->rect_float) {
                        if (!rr->rectf)
@@ -3115,7 +3150,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;