diff options
author | Peter Schlaile <peter@schlaile.de> | 2008-01-29 00:24:08 +0300 |
---|---|---|
committer | Peter Schlaile <peter@schlaile.de> | 2008-01-29 00:24:08 +0300 |
commit | 87eaa637c5866edbb8a017eb9f67018b032fb3a8 (patch) | |
tree | e6b04b869b7ed9158a4340553aa3494b022b4716 | |
parent | d4411e6769c43820a721474ca787e79d1376d5de (diff) |
== Sequencer ==
Fixed two issues with the sequencer:
* using blend modes with startstill / endstill in combination with IPOs
failed, since there was no room to store the composited result.
(It was stored into the same TStripElem thereby effectively disabling the
effect of the IPO)
If you have no idea, what this is all about:
A common case was: use a single PNG as a title, extrude and try to fade
in / out using IPOs.
* startstill / endstill are always displayed, so that one can change them
also on movie-strips and scene-strips.
-rw-r--r-- | source/blender/makesdna/DNA_sequence_types.h | 3 | ||||
-rw-r--r-- | source/blender/src/buttons_scene.c | 45 | ||||
-rw-r--r-- | source/blender/src/sequence.c | 118 |
3 files changed, 126 insertions, 40 deletions
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 066e23ca984..d9e87837f0f 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -79,6 +79,7 @@ typedef struct StripProxy { typedef struct Strip { struct Strip *next, *prev; int rt, len, us, done; + int startstill, endstill; StripElem *stripdata; char dir[160]; int orx, ory; @@ -86,6 +87,8 @@ typedef struct Strip { StripTransform *transform; StripProxy *proxy; TStripElem *tstripdata; + TStripElem *tstripdata_startstill; + TStripElem *tstripdata_endstill; } Strip; diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c index 965893ad344..785855410bb 100644 --- a/source/blender/src/buttons_scene.c +++ b/source/blender/src/buttons_scene.c @@ -585,27 +585,24 @@ static void seq_panel_editing() 130, 60, 120, 19, &last_seq->endstill, 0.0, MAXFRAMEF, 0.0, 0.0, "End still"); } else { - if (last_seq->type == SEQ_IMAGE) { - uiDefButI(block, NUM, - B_SEQ_BUT_TRANSFORM, "Start-Still", - 10, 60, 120, 20, &last_seq->startstill, - 0.0, MAXFRAMEF, 0.0, 0.0, "Start still"); - uiDefButI(block, NUM, - B_SEQ_BUT_TRANSFORM, "End-Still", - 130, 60, 120, 19, &last_seq->endstill, - 0.0, MAXFRAMEF, 0.0, 0.0, "End still"); - } else { - uiDefButI(block, NUM, - B_SEQ_BUT_TRANSFORM, "Start-Ofs", - 10, 60, 120, 20, &last_seq->startofs, - 0.0, last_seq->len - last_seq->endofs, - 0.0, 0.0, "Start offset"); - uiDefButI(block, NUM, - B_SEQ_BUT_TRANSFORM, "End-Ofs", - 130, 60, 120, 19, &last_seq->endofs, - 0.0, last_seq->len - last_seq->startofs, - 0.0, 0.0, "End offset"); - } + uiDefButI(block, NUM, + B_SEQ_BUT_TRANSFORM, "Start-Still", + 10, 60, 120, 20, &last_seq->startstill, + 0.0, MAXFRAMEF, 0.0, 0.0, "Start still"); + uiDefButI(block, NUM, + B_SEQ_BUT_TRANSFORM, "End-Still", + 130, 60, 120, 19, &last_seq->endstill, + 0.0, MAXFRAMEF, 0.0, 0.0, "End still"); + uiDefButI(block, NUM, + B_SEQ_BUT_TRANSFORM, "Start-Ofs", + 10, 40, 120, 20, &last_seq->startofs, + 0.0, last_seq->len - last_seq->endofs, + 0.0, 0.0, "Start offset"); + uiDefButI(block, NUM, + B_SEQ_BUT_TRANSFORM, "End-Ofs", + 130, 40, 120, 19, &last_seq->endofs, + 0.0, last_seq->len - last_seq->startofs, + 0.0, 0.0, "End offset"); } } @@ -683,14 +680,14 @@ static void seq_panel_editing() } str = strdata; - yco = 40; + yco = 20; while ((p = strchr(str, '\n'))) { *p = 0; - uiDefBut(block, LABEL, 0, str, 10,yco,240,19, 0, + uiDefBut(block, LABEL, 0, str, 10,yco,240,17, 0, 0, 0, 0, 0, ""); str = p+1; - yco -= 20; + yco -= 18; } } diff --git a/source/blender/src/sequence.c b/source/blender/src/sequence.c index fce967973cd..e10d78abd89 100644 --- a/source/blender/src/sequence.c +++ b/source/blender/src/sequence.c @@ -129,6 +129,8 @@ void free_strip(Strip *strip) } free_tstripdata(strip->len, strip->tstripdata); + free_tstripdata(strip->endstill, strip->tstripdata_endstill); + free_tstripdata(strip->startstill, strip->tstripdata_startstill); MEM_freeN(strip); } @@ -136,11 +138,16 @@ void free_strip(Strip *strip) void new_tstripdata(Sequence *seq) { if(seq->strip) { - if (seq->strip->tstripdata) { - free_tstripdata(seq->strip->len, - seq->strip->tstripdata); - } + free_tstripdata(seq->strip->len, seq->strip->tstripdata); + free_tstripdata(seq->strip->endstill, + seq->strip->tstripdata_endstill); + free_tstripdata(seq->strip->startstill, + seq->strip->tstripdata_startstill); + seq->strip->tstripdata= 0; + seq->strip->tstripdata_endstill= 0; + seq->strip->tstripdata_startstill= 0; + seq->strip->len= seq->len; } } @@ -765,6 +772,16 @@ static int give_stripelem_index(Sequence *seq, int cfra) return nr; } +static TStripElem* alloc_tstripdata(int len, const char * name) +{ + int i; + TStripElem *se = MEM_callocN(len * sizeof(TStripElem), name); + for (i = 0; i < len; i++) { + se[i].ok = STRIPELEM_OK; + } + return se; +} + TStripElem *give_tstripelem(Sequence *seq, int cfra) { TStripElem *se; @@ -772,19 +789,65 @@ TStripElem *give_tstripelem(Sequence *seq, int cfra) se = seq->strip->tstripdata; if (se == 0 && seq->len > 0) { - int i; - se = seq->strip->tstripdata = MEM_callocN( - seq->len*sizeof(TStripElem), "tstripelems"); - for (i = 0; i < seq->len; i++) { - se[i].ok = STRIPELEM_OK; - } + se = seq->strip->tstripdata = alloc_tstripdata(seq->len, + "tstripelems"); } nr = give_stripelem_index(seq, cfra); if (nr == -1) return 0; if (se == 0) return 0; + + se += nr; + + /* if there are IPOs with blend modes active, one has to watch out + for startstill + endstill area: we can't use the same tstripelem + here for all ibufs, since then, blending with IPOs won't work! + + Rather common case, if you use a single image and try to fade + it in and out... + + Performance TODO: seperate give_tstripelem for ibuf from + give_tstripelem for ibuf_comp, so that caching works here again... + */ + if (seq->ipo && seq->ipo->curve.first && !(seq->type & SEQ_EFFECT)) { + Strip * s = seq->strip; + if (cfra < seq->start) { + se = s->tstripdata_startstill; + if (seq->startstill > s->startstill) { + free_tstripdata(s->startstill, + s->tstripdata_startstill); + se = 0; + } + + if (se == 0) { + s->startstill = seq->startstill; + se = seq->strip->tstripdata_startstill + = alloc_tstripdata( + s->startstill, + "tstripelems_startstill"); + } + se += seq->start - cfra - 1; + + } else if (cfra > seq->start + seq->len-1) { + se = s->tstripdata_endstill; + if (seq->endstill > s->endstill) { + free_tstripdata(s->endstill, + s->tstripdata_endstill); + se = 0; + } + + if (se == 0) { + s->endstill = seq->endstill; + se = seq->strip->tstripdata_endstill + = alloc_tstripdata( + s->endstill, + "tstripelems_endstill"); + } + se += cfra - (seq->start + seq->len-1) - 1; + } + } + - se+= nr; se->nr= nr; return se; @@ -2066,9 +2129,24 @@ void free_imbuf_seq_except(int cfra) if(seq->strip) { TStripElem * curelem = give_tstripelem(seq, cfra); - for(a=0, se= seq->strip->tstripdata; a<seq->len; a++, se++) - if(se != curelem) + for(a = 0, se = seq->strip->tstripdata; + a < seq->strip->len && se; a++, se++) { + if(se != curelem) { + free_imbuf_strip_elem(se); + } + } + for(a = 0, se = seq->strip->tstripdata_startstill; + a < seq->strip->startstill && se; a++, se++) { + if(se != curelem) { free_imbuf_strip_elem(se); + } + } + for(a = 0, se = seq->strip->tstripdata_endstill; + a < seq->strip->endstill && se; a++, se++) { + if(se != curelem) { + free_imbuf_strip_elem(se); + } + } if(seq->type==SEQ_MOVIE) if(seq->startdisp > cfra || seq->enddisp < cfra) @@ -2089,9 +2167,17 @@ void free_imbuf_seq() WHILE_SEQ(&ed->seqbase) { if(seq->strip) { - if (seq->strip->tstripdata) { - for(a=0, se= seq->strip->tstripdata; a<seq->len; a++, se++) - free_imbuf_strip_elem(se); + for(a = 0, se = seq->strip->tstripdata; + a < seq->strip->len && se; a++, se++) { + free_imbuf_strip_elem(se); + } + for(a = 0, se = seq->strip->tstripdata_startstill; + a < seq->strip->startstill && se; a++, se++) { + free_imbuf_strip_elem(se); + } + for(a = 0, se = seq->strip->tstripdata_endstill; + a < seq->strip->endstill && se; a++, se++) { + free_imbuf_strip_elem(se); } if(seq->type==SEQ_MOVIE) |