[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13440] trunk/blender/source/blender: == Sequencer ==

Peter Schlaile peter at schlaile.de
Mon Jan 28 22:24:09 CET 2008


Revision: 13440
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13440
Author:   schlaile
Date:     2008-01-28 22:24:08 +0100 (Mon, 28 Jan 2008)

Log Message:
-----------
== 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.

Modified Paths:
--------------
    trunk/blender/source/blender/makesdna/DNA_sequence_types.h
    trunk/blender/source/blender/src/buttons_scene.c
    trunk/blender/source/blender/src/sequence.c

Modified: trunk/blender/source/blender/makesdna/DNA_sequence_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_sequence_types.h	2008-01-28 20:45:28 UTC (rev 13439)
+++ trunk/blender/source/blender/makesdna/DNA_sequence_types.h	2008-01-28 21:24:08 UTC (rev 13440)
@@ -79,6 +79,7 @@
 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 @@
 	StripTransform *transform;
 	StripProxy *proxy;
 	TStripElem *tstripdata;
+	TStripElem *tstripdata_startstill;
+	TStripElem *tstripdata_endstill;
 } Strip;
 
 

Modified: trunk/blender/source/blender/src/buttons_scene.c
===================================================================
--- trunk/blender/source/blender/src/buttons_scene.c	2008-01-28 20:45:28 UTC (rev 13439)
+++ trunk/blender/source/blender/src/buttons_scene.c	2008-01-28 21:24:08 UTC (rev 13440)
@@ -585,27 +585,24 @@
 				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 @@
 	}
 
 	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;
 	}
 }
 

Modified: trunk/blender/source/blender/src/sequence.c
===================================================================
--- trunk/blender/source/blender/src/sequence.c	2008-01-28 20:45:28 UTC (rev 13439)
+++ trunk/blender/source/blender/src/sequence.c	2008-01-28 21:24:08 UTC (rev 13440)
@@ -129,6 +129,8 @@
 	}
 
 	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 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 @@
 	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 @@
 
 	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 @@
 		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,10 +2167,18 @@
 
 	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)
 				free_anim_seq(seq);





More information about the Bf-blender-cvs mailing list