[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28696] trunk/blender/source/blender: Tweaks to image editor scopes, while testing a bug

Matt Ebb matt at mke3.net
Mon May 10 03:46:44 CEST 2010


Revision: 28696
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28696
Author:   broken
Date:     2010-05-10 03:46:44 +0200 (Mon, 10 May 2010)

Log Message:
-----------
Tweaks to image editor scopes, while testing a bug

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_colortools.h
    trunk/blender/source/blender/blenkernel/intern/colortools.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/interface/interface_draw.c
    trunk/blender/source/blender/editors/space_image/space_image.c

Modified: trunk/blender/source/blender/blenkernel/BKE_colortools.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_colortools.h	2010-05-10 01:44:55 UTC (rev 28695)
+++ trunk/blender/source/blender/blenkernel/BKE_colortools.h	2010-05-10 01:46:44 UTC (rev 28696)
@@ -76,6 +76,7 @@
 
 void				scopes_update(struct Scopes *scopes, struct ImBuf *ibuf, int use_color_management);
 void				scopes_free(struct Scopes *scopes);
+void				scopes_new(struct Scopes *scopes);
 
 #endif
 

Modified: trunk/blender/source/blender/blenkernel/intern/colortools.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/colortools.c	2010-05-10 01:44:55 UTC (rev 28695)
+++ trunk/blender/source/blender/blenkernel/intern/colortools.c	2010-05-10 01:46:44 UTC (rev 28696)
@@ -1110,3 +1110,19 @@
 		scopes->vecscope = NULL;
 	}
 }
+
+void scopes_new(Scopes *scopes)
+{
+	scopes->accuracy=30.0;
+	scopes->hist.mode=HISTO_MODE_RGB;
+	scopes->wavefrm_alpha=0.3;
+	scopes->vecscope_alpha=0.3;
+	scopes->wavefrm_height= 100;
+	scopes->vecscope_height= 100;
+	scopes->hist.height= 100;
+	scopes->ok= 0;
+	scopes->waveform_1 = NULL;
+	scopes->waveform_2 = NULL;
+	scopes->waveform_3 = NULL;
+	scopes->vecscope = NULL;
+}

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2010-05-10 01:44:55 UTC (rev 28695)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2010-05-10 01:46:44 UTC (rev 28696)
@@ -10841,13 +10841,7 @@
 				for (sl= sa->spacedata.first; sl; sl= sl->next) {
 					if(sl->spacetype==SPACE_IMAGE) {
 						SpaceImage *sima = (SpaceImage *)sl;
-						sima->scopes.accuracy = 30.0;
-						sima->scopes.hist.mode=HISTO_MODE_RGB;
-						sima->scopes.wavefrm_alpha=0.3;
-						sima->scopes.vecscope_alpha=0.3;
-						sima->scopes.wavefrm_height= 100;
-						sima->scopes.vecscope_height= 100;
-						sima->scopes.hist.height= 100;
+						scopes_new(&sima->scopes);
 					}
 				}
 			}

Modified: trunk/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_draw.c	2010-05-10 01:44:55 UTC (rev 28695)
+++ trunk/blender/source/blender/editors/interface/interface_draw.c	2010-05-10 01:46:44 UTC (rev 28696)
@@ -880,76 +880,80 @@
 	/* 7.5 IRE black point level for NTSC */
 	if (scopes->wavefrm_mode== SCOPES_WAVEFRM_LUM)
 		fdrawline(rect.xmin, yofs+h*0.075f, rect.xmax+1, yofs+h*0.075f);
-	
-	/* LUMA (1 channel) */
-	glBlendFunc(GL_ONE,GL_ONE);
-	glColor3f(alpha, alpha, alpha);
-	if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUM){
 
-		glBlendFunc(GL_ONE,GL_ONE);
+	if (scopes->ok && scopes->waveform_1 != NULL) {
 		
-		glPushMatrix();
-		glEnableClientState(GL_VERTEX_ARRAY);
-		
-		glTranslatef(rect.xmin, yofs, 0.f);
-		glScalef(w, h, 0.f);
-		glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_1);
-		glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
-				
-		glDisableClientState(GL_VERTEX_ARRAY);
-		glPopMatrix();
-
-		/* min max */
-		glColor3f(.5f, .5f, .5f);
-		min= yofs+scopes->minmax[0][0]*h;
-		max= yofs+scopes->minmax[0][1]*h;
-		CLAMP(min, rect.ymin, rect.ymax);
-		CLAMP(max, rect.ymin, rect.ymax);
-		fdrawline(rect.xmax-3,min,rect.xmax-3,max);
-	}
-
-	/* RGB / YCC (3 channels) */
-	else if (ELEM4(scopes->wavefrm_mode, SCOPES_WAVEFRM_RGB, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709, SCOPES_WAVEFRM_YCC_JPEG)) {
-		int rgb = (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB);
-		
+		/* LUMA (1 channel) */
 		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);
+		glColor3f(alpha, alpha, alpha);
+		if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUM){
 
-		glTranslatef(1.f, 0.f, 0.f);
-		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();
+			glBlendFunc(GL_ONE,GL_ONE);
+			
+			glPushMatrix();
+			glEnableClientState(GL_VERTEX_ARRAY);
+			
+			glTranslatef(rect.xmin, yofs, 0.f);
+			glScalef(w, h, 0.f);
+			glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_1);
+			glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
+					
+			glDisableClientState(GL_VERTEX_ARRAY);
+			glPopMatrix();
 
-		
-		/* min max */
-		for (c=0; c<3; c++) {
-			if (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB)
-				glColor3f(colors[c][0]*0.75, colors[c][1]*0.75, colors[c][2]*0.75);
-			else
-				glColor3f(colorsycc[c][0]*0.75, colorsycc[c][1]*0.75, colorsycc[c][2]*0.75);
-			min= yofs+scopes->minmax[c][0]*h;
-			max= yofs+scopes->minmax[c][1]*h;
+			/* min max */
+			glColor3f(.5f, .5f, .5f);
+			min= yofs+scopes->minmax[0][0]*h;
+			max= yofs+scopes->minmax[0][1]*h;
 			CLAMP(min, rect.ymin, rect.ymax);
 			CLAMP(max, rect.ymin, rect.ymax);
-			fdrawline(rect.xmin+w+2+c*2,min,rect.xmin+w+2+c*2,max);
+			fdrawline(rect.xmax-3,min,rect.xmax-3,max);
 		}
+
+		/* RGB / YCC (3 channels) */
+		else if (ELEM4(scopes->wavefrm_mode, SCOPES_WAVEFRM_RGB, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709, SCOPES_WAVEFRM_YCC_JPEG)) {
+			int rgb = (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB);
+			
+			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);
+
+			glTranslatef(1.f, 0.f, 0.f);
+			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 */
+			for (c=0; c<3; c++) {
+				if (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB)
+					glColor3f(colors[c][0]*0.75, colors[c][1]*0.75, colors[c][2]*0.75);
+				else
+					glColor3f(colorsycc[c][0]*0.75, colorsycc[c][1]*0.75, colorsycc[c][2]*0.75);
+				min= yofs+scopes->minmax[c][0]*h;
+				max= yofs+scopes->minmax[c][1]*h;
+				CLAMP(min, rect.ymin, rect.ymax);
+				CLAMP(max, rect.ymin, rect.ymax);
+				fdrawline(rect.xmin+w+2+c*2,min,rect.xmin+w+2+c*2,max);
+			}
+		}
+		
 	}
 	
 	/* outline, scale gripper */
@@ -1030,8 +1034,6 @@
 	float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}};
 	GLint scissor[4];
 	
-	if (scopes==NULL) return;
-	
 	rect.xmin = (float)recti->xmin+1;
 	rect.xmax = (float)recti->xmax-1;
 	rect.ymin = (float)recti->ymin+SCOPE_RESIZE_PAD+2;
@@ -1079,25 +1081,24 @@
 	for(i=0; i<6; i++)
 		vectorscope_draw_target(centerx, centery, diam, colors[i][0], colors[i][1], colors[i][2]);
 	
-	/* pixel point cloud */
-	glBlendFunc(GL_ONE,GL_ONE);
-	glColor4f(alpha, alpha, alpha, alpha);
+	if (scopes->ok && scopes->vecscope != NULL) {
+		/* pixel point cloud */
+		glBlendFunc(GL_ONE,GL_ONE);
+		glColor3f(alpha, alpha, alpha);
 
-	glPushMatrix();
-	glEnableClientState(GL_VERTEX_ARRAY);
+		glPushMatrix();
+		glEnableClientState(GL_VERTEX_ARRAY);
 
-	glTranslatef(centerx, centery, 0.f);
-	glScalef(diam, diam, 0.f);
+		glTranslatef(centerx, centery, 0.f);
+		glScalef(diam, diam, 0.f);
 
-	/*apparently this can sometimes be NULL? - joeedh*/
-	if (scopes) {
 		glVertexPointer(2, GL_FLOAT, 0, scopes->vecscope);
 		glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
+		
+		glDisableClientState(GL_VERTEX_ARRAY);
+		glPopMatrix();
 	}
 
-	glDisableClientState(GL_VERTEX_ARRAY);
-	glPopMatrix();
-	
 	/* outline, scale gripper */
 	draw_scope_end(&rect, scissor);
 		

Modified: trunk/blender/source/blender/editors/space_image/space_image.c
===================================================================
--- trunk/blender/source/blender/editors/space_image/space_image.c	2010-05-10 01:44:55 UTC (rev 28695)
+++ trunk/blender/source/blender/editors/space_image/space_image.c	2010-05-10 01:46:44 UTC (rev 28696)
@@ -385,6 +385,8 @@
 	simage->iuser.ok= 1;
 	simage->iuser.fie_ima= 2;
 	simage->iuser.frames= 100;
+	
+	scopes_new(&simage->scopes);
 
 	/* header */
 	ar= MEM_callocN(sizeof(ARegion), "header for image");
@@ -409,13 +411,6 @@
 	ar->alignment= RGN_ALIGN_RIGHT;
 	ar->flag = RGN_FLAG_HIDDEN;
 
-	simage->scopes.accuracy=30.0;
-	simage->scopes.hist.mode=HISTO_MODE_RGB;
-	simage->scopes.wavefrm_alpha=0.3;
-	simage->scopes.vecscope_alpha=0.3;
-	simage->scopes.wavefrm_height= 100;
-	simage->scopes.hist.height= 100;
-	
 	/* main area */
 	ar= MEM_callocN(sizeof(ARegion), "main area for image");
 	





More information about the Bf-blender-cvs mailing list