[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29912] trunk/blender: - draw sequence strips within metastrips using their real start/ end and channel positions.

Campbell Barton ideasman42 at gmail.com
Sun Jul 4 03:56:05 CEST 2010


Revision: 29912
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29912
Author:   campbellbarton
Date:     2010-07-04 03:56:04 +0200 (Sun, 04 Jul 2010)

Log Message:
-----------
- draw sequence strips within metastrips using their real start/end and channel positions.
- dont show color balance unless its enabled.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_sequencer.py
    trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c

Modified: trunk/blender/release/scripts/ui/space_sequencer.py
===================================================================
--- trunk/blender/release/scripts/ui/space_sequencer.py	2010-07-03 22:50:28 UTC (rev 29911)
+++ trunk/blender/release/scripts/ui/space_sequencer.py	2010-07-04 01:56:04 UTC (rev 29912)
@@ -745,7 +745,7 @@
         col.prop(strip, "convert_float")
 
         layout.prop(strip, "use_color_balance")
-        if strip.color_balance: # TODO - need to add this somehow
+        if strip.use_color_balance and strip.color_balance: # TODO - need to add this somehow
             row = layout.row()
             row.active = strip.use_color_balance
             col = row.column()

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c	2010-07-03 22:50:28 UTC (rev 29911)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c	2010-07-04 01:56:04 UTC (rev 29912)
@@ -200,46 +200,86 @@
 	}
 }
 
+static void drawmeta_stipple(int value)
+{
+	if(value) {
+		glEnable(GL_POLYGON_STIPPLE);
+		glPolygonStipple(stipple_halftone);
+		
+		glEnable(GL_LINE_STIPPLE);
+		glLineStipple(1, 0x8888);
+	}
+	else {
+		glDisable(GL_POLYGON_STIPPLE);
+		glDisable(GL_LINE_STIPPLE);
+	}
+}
+
 static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, float x2, float y2)
 {
 	/* Note, this used to use WHILE_SEQ, but it messes up the seq->depth value, (needed by transform when doing overlap checks)
 	 * so for now, just use the meta's immediate children, could be fixed but its only drawing - Campbell */
 	Sequence *seq;
-	float dx;
-	int nr;
-	char col[3];
-	
-	nr= BLI_countlist(&seqm->seqbase);
+	char col[4];
 
-	dx= (x2-x1)/nr;
+	int chan_min= MAXSEQ;
+	int chan_max= 0;
+	int chan_range= 0;
+	float draw_range= y2 - y1;
+	float draw_height;
 
-	if (seqm->flag & SEQ_MUTE) {
-		glEnable(GL_POLYGON_STIPPLE);
-		glPolygonStipple(stipple_halftone);
-		
-		glEnable(GL_LINE_STIPPLE);
-		glLineStipple(1, 0x8888);
+	glEnable(GL_BLEND);
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+	if(seqm->flag & SEQ_MUTE)
+		drawmeta_stipple(1);
+
+	for (seq= seqm->seqbase.first; seq; seq= seq->next) {
+		chan_min= MIN2(chan_min, seq->machine);
+		chan_max= MAX2(chan_max, seq->machine);
 	}
-	
+
+	chan_range= (chan_max - chan_min) + 1;
+	draw_height= draw_range / chan_range; 
+
+	col[3]= 196; /* alpha, used for all meta children */
+
 	for (seq= seqm->seqbase.first; seq; seq= seq->next) {
-		get_seq_color3ubv(scene, seq, col);
-		
-		glColor3ubv((GLubyte *)col);
+		if((seq->startdisp > x2 || seq->enddisp < x1) == 0) {
+			float ym= (seq->machine - chan_min) / (float)(chan_range) * draw_range;
 
-		glRectf(x1,  y1,  x1+0.9*dx,  y2);
-		
-		UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -30);
-		glColor3ubv((GLubyte *)col);
+			float x1m= seq->startdisp;
+			float x2m= seq->enddisp;
+			float y1m, y2m;
+			
+			if((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
+				drawmeta_stipple(1);
+			
+			get_seq_color3ubv(scene, seq, col);
 
-		fdrawbox(x1,  y1,  x1+0.9*dx,  y2);
-		
-		x1+= dx;
+			glColor4ubv((GLubyte *)col);
+			
+			if(x1m < x1) x1m= x1;
+			if(x2m > x2) x2m= x2;
+			
+			y1m= y1 + ym + (draw_height * SEQ_STRIP_OFSBOTTOM);
+			y2m= y1 + ym + (draw_height * SEQ_STRIP_OFSTOP);
+
+			glRectf(x1m,  y1m, x2m,  y2m);
+
+			UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, -30);
+			glColor4ubv((GLubyte *)col);
+			fdrawbox(x1m,  y1m, x2m,  y2m);
+			
+			if((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
+				drawmeta_stipple(0);
+		}
 	}
+
+	if (seqm->flag & SEQ_MUTE)
+		drawmeta_stipple(0);
 	
-	if (seqm->flag & SEQ_MUTE) {
-		glDisable(GL_POLYGON_STIPPLE);
-		glDisable(GL_LINE_STIPPLE);
-	}
+	glDisable(GL_BLEND);
 }
 
 /* draw a handle, for each end of a sequence strip */
@@ -619,13 +659,12 @@
 		glDisable(GL_LINE_STIPPLE);
 	}
 	
+	if(seq->type==SEQ_META) drawmeta_contents(scene, seq, x1, y1, x2, y2);
+	
 	/* calculate if seq is long enough to print a name */
 	x1= seq->startdisp+seq->handsize;
 	x2= seq->enddisp-seq->handsize;
 
-	/* but first the contents of a meta */
-	if(seq->type==SEQ_META) drawmeta_contents(scene, seq, x1, y1+0.15, x2, y2-0.15);
-
 	/* info text on the strip */
 	if(x1<v2d->cur.xmin) x1= v2d->cur.xmin;
 	else if(x1>v2d->cur.xmax) x1= v2d->cur.xmax;





More information about the Bf-blender-cvs mailing list