[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46870] trunk/blender/source/blender/ editors: fix [#31530] Project paint with Clipping border gives opaque background

Campbell Barton ideasman42 at gmail.com
Tue May 22 10:24:52 CEST 2012


Revision: 46870
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46870
Author:   campbellbarton
Date:     2012-05-22 08:24:52 +0000 (Tue, 22 May 2012)
Log Message:
-----------
fix [#31530] Project paint with Clipping border gives opaque background

draw clipping box alpha 0 so reprojection and rendering show the background as alpha 0.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/UI_resources.h
    trunk/blender/source/blender/editors/interface/resources.c
    trunk/blender/source/blender/editors/space_view3d/view3d_draw.c

Modified: trunk/blender/source/blender/editors/include/UI_resources.h
===================================================================
--- trunk/blender/source/blender/editors/include/UI_resources.h	2012-05-22 07:46:14 UTC (rev 46869)
+++ trunk/blender/source/blender/editors/include/UI_resources.h	2012-05-22 08:24:52 UTC (rev 46870)
@@ -232,9 +232,10 @@
 int     UI_GetThemeValue(int colorid);
 
 // get three color values, scaled to 0.0-1.0 range
-void    UI_GetThemeColor3fv(int colorid, float *col);
+void    UI_GetThemeColor3fv(int colorid, float col[3]);
 // get the color, range 0.0-1.0, complete with shading offset
-void    UI_GetThemeColorShade3fv(int colorid, int offset, float *col);
+void    UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]);
+void    UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]);
 
 // get the 3 or 4 byte values
 void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]);

Modified: trunk/blender/source/blender/editors/interface/resources.c
===================================================================
--- trunk/blender/source/blender/editors/interface/resources.c	2012-05-22 07:46:14 UTC (rev 46869)
+++ trunk/blender/source/blender/editors/interface/resources.c	2012-05-22 08:24:52 UTC (rev 46870)
@@ -1028,7 +1028,7 @@
 
 
 // get the color, range 0.0-1.0
-void UI_GetThemeColor3fv(int colorid, float *col)
+void UI_GetThemeColor3fv(int colorid, float col[3])
 {
 	const unsigned char *cp;
 	
@@ -1039,7 +1039,7 @@
 }
 
 // get the color, range 0.0-1.0, complete with shading offset
-void UI_GetThemeColorShade3fv(int colorid, int offset, float *col)
+void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
 {
 	int r, g, b;
 	const unsigned char *cp;
@@ -1058,6 +1058,25 @@
 	col[2] = ((float)b) / 255.0f;
 }
 
+void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3])
+{
+	int r, g, b;
+	const unsigned char *cp;
+
+	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+
+	r = offset + (int) cp[0];
+	CLAMP(r, 0, 255);
+	g = offset + (int) cp[1];
+	CLAMP(g, 0, 255);
+	b = offset + (int) cp[2];
+	CLAMP(b, 0, 255);
+
+	col[0] = r;
+	col[1] = g;
+	col[2] = b;
+}
+
 // get the color, in char pointer
 void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
 {

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2012-05-22 07:46:14 UTC (rev 46869)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2012-05-22 08:24:52 UTC (rev 46870)
@@ -160,7 +160,11 @@
 		                                            {1, 5, 6, 2},
 		                                            {7, 4, 0, 3}};
 
-		UI_ThemeColorShade(TH_BACK, -8);
+		/* fill in zero alpha for rendering & re-projection [#31530] */
+		unsigned char col[4];
+		UI_GetThemeColorShade3ubv(TH_BACK, -8, col);
+		col[3] = 0;
+		glColor4ubv(col);
 
 		glEnableClientState(GL_VERTEX_ARRAY);
 		glVertexPointer(3, GL_FLOAT, 0, bb->vec);




More information about the Bf-blender-cvs mailing list