[Bf-blender-cvs] [a76e69f] master: Additional Waveform Drawing Mode

Sergey Sharybin noreply at git.blender.org
Mon Jul 18 15:44:12 CEST 2016


Commit: a76e69f5f75c06dda6d35113d80b6b65dcc94ea0
Author: Sergey Sharybin
Date:   Mon Jul 18 15:28:56 2016 +0200
Branches: master
https://developer.blender.org/rBa76e69f5f75c06dda6d35113d80b6b65dcc94ea0

Additional Waveform Drawing Mode

This diff adds a 6th drawing mode to the Waveform Scope.

The new mode shows the RGB colour channels overlaid as a "Full colour" waveform.

The old "Red Green Blue" mode is renamed "Parade" which is the standard industry
term for RGB channels shown side-by-side.

This full colour style of waveform is very much more useful for colour grading than the
Parade mode and is the default waveform for many artists.

Files from older Blender versions which show scopes open as expected.

Patch by John Cox (johnedwardcox), thanks!

Reviewers: sergey

Reviewed By: sergey

Subscribers: campbellbarton, tmw, Blendify

Differential Revision: https://developer.blender.org/D1936

===================================================================

M	source/blender/blenkernel/intern/colortools.c
M	source/blender/editors/interface/interface_draw.c
M	source/blender/makesdna/DNA_color_types.h
M	source/blender/makesrna/intern/rna_color.c

===================================================================

diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 2932939..4089475 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -982,6 +982,7 @@ static void save_sample_line(Scopes *scopes, const int idx, const float fx, cons
 	/* waveform */
 	switch (scopes->wavefrm_mode) {
 		case SCOPES_WAVEFRM_RGB:
+		case SCOPES_WAVEFRM_RGB_PARADE:
 			scopes->waveform_1[idx + 0] = fx;
 			scopes->waveform_1[idx + 1] = rgb[0];
 			scopes->waveform_2[idx + 0] = fx;
@@ -1265,6 +1266,8 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *
 
 	switch (scopes->wavefrm_mode) {
 		case SCOPES_WAVEFRM_RGB:
+			//break;
+		case SCOPES_WAVEFRM_RGB_PARADE:
 			ycc_mode = -1;
 			break;
 		case SCOPES_WAVEFRM_LUMA:
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 72a6a04..9ce863d 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -734,24 +734,50 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
 			CLAMP(max, rect.ymin, rect.ymax);
 			fdrawline(rect.xmax - 3, min, rect.xmax - 3, max);
 		}
+		/* RGB (3 channel) */
+		else if (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB) {
+			glBlendFunc(GL_ONE, GL_ONE);
+
+			glEnableClientState(GL_VERTEX_ARRAY);
+
+			glPushMatrix();
+
+			glTranslatef(rect.xmin, yofs, 0.f);
+			glScalef(w, h, 0.f);
+
+			glColor3fv( colors_alpha[0] );
+			glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_1);
+			glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
+
+			glColor3fv( colors_alpha[1] );
+			glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_2);
+			glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
 
-		/* RGB / YCC (3 channels) */
+			glColor3fv( colors_alpha[2] );
+			glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_3);
+			glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
+
+			glDisableClientState(GL_VERTEX_ARRAY);
+			glPopMatrix();
+		}
+		/* PARADE / YCC (3 channels) */
 		else if (ELEM(scopes->wavefrm_mode,
-		              SCOPES_WAVEFRM_RGB,
+		              SCOPES_WAVEFRM_RGB_PARADE,
 		              SCOPES_WAVEFRM_YCC_601,
 		              SCOPES_WAVEFRM_YCC_709,
-		              SCOPES_WAVEFRM_YCC_JPEG))
+		              SCOPES_WAVEFRM_YCC_JPEG
+		              ))
 		{
-			int rgb = (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB);
-			
+			int rgb = (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB_PARADE);
+
 			glBlendFunc(GL_ONE, GL_ONE);
-			
+
 			glPushMatrix();
 			glEnableClientState(GL_VERTEX_ARRAY);
-			
+
 			glTranslatef(rect.xmin, yofs, 0.f);
 			glScalef(w3, h, 0.f);
-			
+
 			glColor3fv((rgb) ? colors_alpha[0] : colorsycc_alpha[0]);
 			glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_1);
 			glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
@@ -760,19 +786,19 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
 			glColor3fv((rgb) ? colors_alpha[1] : colorsycc_alpha[1]);
 			glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_2);
 			glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
-			
+
 			glTranslatef(1.f, 0.f, 0.f);
 			glColor3fv((rgb) ? colors_alpha[2] : colorsycc_alpha[2]);
 			glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_3);
 			glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
-			
+
 			glDisableClientState(GL_VERTEX_ARRAY);
 			glPopMatrix();
-
-			
-			/* min max */
+		}
+		/* min max */
+		if (scopes->wavefrm_mode != SCOPES_WAVEFRM_LUMA ) {
 			for (int c = 0; c < 3; c++) {
-				if (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB)
+				if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_RGB_PARADE, SCOPES_WAVEFRM_RGB))
 					glColor3f(colors[c][0] * 0.75f, colors[c][1] * 0.75f, colors[c][2] * 0.75f);
 				else
 					glColor3f(colorsycc[c][0] * 0.75f, colorsycc[c][1] * 0.75f, colorsycc[c][2] * 0.75f);
diff --git a/source/blender/makesdna/DNA_color_types.h b/source/blender/makesdna/DNA_color_types.h
index c9a5e05..1d88b01 100644
--- a/source/blender/makesdna/DNA_color_types.h
+++ b/source/blender/makesdna/DNA_color_types.h
@@ -157,10 +157,11 @@ typedef struct Scopes {
 
 /* scopes->wavefrm_mode */
 #define SCOPES_WAVEFRM_LUMA		0
-#define SCOPES_WAVEFRM_RGB		1
+#define SCOPES_WAVEFRM_RGB_PARADE	1
 #define SCOPES_WAVEFRM_YCC_601	2
 #define SCOPES_WAVEFRM_YCC_709	3
 #define SCOPES_WAVEFRM_YCC_JPEG	4
+#define SCOPES_WAVEFRM_RGB		5
 
 typedef struct ColorManagedViewSettings {
 	int flag, pad;
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index 021bc60..78e3bbe 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -1018,10 +1018,11 @@ static void rna_def_scopes(BlenderRNA *brna)
 
 	static EnumPropertyItem prop_wavefrm_mode_items[] = {
 		{SCOPES_WAVEFRM_LUMA, "LUMA", ICON_COLOR, "Luma", ""},
-		{SCOPES_WAVEFRM_RGB, "RGB", ICON_COLOR, "Red Green Blue", ""},
+		{SCOPES_WAVEFRM_RGB_PARADE, "PARADE", ICON_COLOR, "Parade", ""},
 		{SCOPES_WAVEFRM_YCC_601, "YCBCR601", ICON_COLOR, "YCbCr (ITU 601)", ""},
 		{SCOPES_WAVEFRM_YCC_709, "YCBCR709", ICON_COLOR, "YCbCr (ITU 709)", ""},
 		{SCOPES_WAVEFRM_YCC_JPEG, "YCBCRJPG", ICON_COLOR, "YCbCr (Jpeg)", ""},
+		{SCOPES_WAVEFRM_RGB, "RGB", ICON_COLOR, "Red Green Blue", ""},
 		{0, NULL, 0, NULL, NULL}
 	};




More information about the Bf-blender-cvs mailing list