[Bf-committers] Added HSV color selection to Vertex Paint button group

desoto bf-committers@blender.org
Fri, 24 Oct 2003 19:57:43 -0400


------------------------------------------------------------------------
This mail message contains standard MIME attachments.  If you see this
note, your e-mail program does not support MIME.  You may need a MIME-
compliant mail reader to read any non-text attachments in this message.
------------------------------------------------------------------------

--==IMail_v7.0==
Content-Type: text/plain; charset=us-ascii

Hi all,

I saw a feature request in the blender.org forums from a user nicknamed "ideasman" about adding HSV color selection to the vertex paint button group.  Knowing full well that the developers are busy with more important things, and that it wouldn't be that difficult to implement if I looked at it long enough, I took it upon myself to try and add the feature and succeeded!  :D  I hope someone has the time to review it and perhaps commit the feature so everyone can enjoy it.  The patch file should be included and if it isn't please contact me so I can supply it.  Thanks for your time!

-Desoto

--==IMail_v7.0==
Content-Type: text/plain; name="desoto_HSV_VPaint.txt"
Content-Transfer-Encoding: 7bit

? desoto_HSV_VPaint.txt
? user-def.mk
? obj/windows
Index: source/blender/include/BSE_trans_types.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/include/BSE_trans_types.h,v
retrieving revision 1.5
diff -u -r1.5 BSE_trans_types.h
--- source/blender/include/BSE_trans_types.h	27 Dec 2002 13:10:20 -0000	1.5
+++ source/blender/include/BSE_trans_types.h	24 Oct 2003 23:42:08 -0000
@@ -82,7 +82,7 @@
 	float r, g, b, a;
 	float size;		/* van brush */
 	float gamma, mul;
-	short mode, flag;
+	short mode, flag, colmode;
 } VPaint;
 
 #endif /* BSE_TRANS_TYPES_H */
Index: source/blender/src/buttons_editing.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/buttons_editing.c,v
retrieving revision 1.9
diff -u -r1.9 buttons_editing.c
--- source/blender/src/buttons_editing.c	22 Oct 2003 23:20:44 -0000	1.9
+++ source/blender/src/buttons_editing.c	24 Oct 2003 23:42:08 -0000
@@ -1896,14 +1896,28 @@
 static void editing_panel_mesh_paint(void)
 {
 	extern VPaint Gvp;         /* from vpaint */
+	float *colpoin = NULL, min;
 	uiBlock *block;
 
 	block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_paint", UI_EMBOSS, UI_HELV, curarea->win);
 	if(uiNewPanel(curarea, block, "Paint", "Editing", 640, 0, 318, 204)==0) return;
 
-	uiDefButF(block, NUMSLI, 0, "R ",			979,160,194,19, &Gvp.r, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of red used for painting");
-	uiDefButF(block, NUMSLI, 0, "G ",			979,140,194,19, &Gvp.g, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of green used for painting");
-	uiDefButF(block, NUMSLI, 0, "B ",			979,120,194,19, &Gvp.b, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of blue used for painting");
+	colpoin = &(Gvp.r);
+	
+	if(Gvp.colmode==MA_RGB) {
+		uiDefButF(block, NUMSLI, 0, "R ",			979,160,194,19, colpoin, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of red used for painting");
+		uiDefButF(block, NUMSLI, 0, "G ",			979,140,194,19, colpoin+1, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of green used for painting");
+		uiDefButF(block, NUMSLI, 0, "B ",			979,120,194,19, colpoin+2, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of blue used for painting");
+	}
+	else {
+		uiBlockSetCol(block, TH_BUT_SETTING1);
+		uiDefButF(block, HSVSLI, 0, "H ",			979,160,194,19, colpoin, 0.0, 0.9999, B_VPCOLSLI, 0, "The hue of the color used for painting");
+		uiDefButF(block, HSVSLI, 0, "S ",			979,140,194,19, colpoin, 0.0001, 1.0, B_VPCOLSLI, 0, "The saturation of the color used for painting");
+		uiDefButF(block, HSVSLI, 0, "V ",			979,120,194,19, colpoin, 0.0001, 1.0, B_VPCOLSLI, 0, "The value of the color used for painting");        
+		uiBlockSetCol(block, TH_AUTO);
+	}
+	
+	
 	uiDefButF(block, NUMSLI, 0, "Opacity ",		979,100,194,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
 	uiDefButF(block, NUMSLI, 0, "Size ",		979,80,194,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
 
@@ -1915,15 +1929,18 @@
 	uiDefButS(block, ROW, B_DIFF, "Mul",			1212, 100,63,19, &Gvp.mode, 1.0, 3.0, 0, 0, "Multiply the vertex colour");
 	uiDefButS(block, ROW, B_DIFF, "Filter",		1212, 80,63,19, &Gvp.mode, 1.0, 4.0, 0, 0, "Mix the colours with an alpha factor");
 
-	uiDefButS(block, TOG|BIT|1, 0, "Area", 		980,50,80,19, &Gvp.flag, 0, 0, 0, 0, "Set the area the brush covers");
-	uiDefButS(block, TOG|BIT|2, 0, "Soft", 		1061,50,112,19, &Gvp.flag, 0, 0, 0, 0, "Use a soft brush");
-	uiDefButS(block, TOG|BIT|3, 0, "Normals", 	1174,50,102,19, &Gvp.flag, 0, 0, 0, 0, "Use vertex normal for painting");
-
-	uiDefBut(block, BUT, B_VPGAMMA, "Set", 	980,30,80,19, 0, 0, 0, 0, 0, "Apply Mul and Gamma to vertex colours");
-	uiDefButF(block, NUM, B_DIFF, "Mul:", 		1061,30,112,19, &Gvp.mul, 0.1, 50.0, 10, 0, "Set the number to multiply vertex colours with");
-	uiDefButF(block, NUM, B_DIFF, "Gamma:", 	1174,30,102,19, &Gvp.gamma, 0.1, 5.0, 10, 0, "Change the clarity of the vertex colours");
+	uiDefButS(block, ROW, REDRAWBUTSEDIT, "RGB",			980,55,70,20, &Gvp.colmode, 2.0, (float)MA_RGB, 0, 0, "Create colour by red, green and blue");
+	uiDefButS(block, ROW, REDRAWBUTSEDIT, "HSV",			1050,55,70,20, &Gvp.colmode, 2.0, (float)MA_HSV, 0, 0, "Mix colour with hue, saturation and value");
+		
+	uiDefButS(block, TOG|BIT|1, 0, "Area", 		980,30,80,19, &Gvp.flag, 0, 0, 0, 0, "Set the area the brush covers");
+	uiDefButS(block, TOG|BIT|2, 0, "Soft", 		1061,30,112,19, &Gvp.flag, 0, 0, 0, 0, "Use a soft brush");
+	uiDefButS(block, TOG|BIT|3, 0, "Normals", 	1174,30,102,19, &Gvp.flag, 0, 0, 0, 0, "Use vertex normal for painting");
+
+	uiDefBut(block, BUT, B_VPGAMMA, "Set", 	980,10,80,19, 0, 0, 0, 0, 0, "Apply Mul and Gamma to vertex colours");
+	uiDefButF(block, NUM, B_DIFF, "Mul:", 		1061,10,112,19, &Gvp.mul, 0.1, 50.0, 10, 0, "Set the number to multiply vertex colours with");
+	uiDefButF(block, NUM, B_DIFF, "Gamma:", 	1174,10,102,19, &Gvp.gamma, 0.1, 5.0, 10, 0, "Change the clarity of the vertex colours");
 	
-	uiDefBut(block, BUT, B_SET_VCOL, "Set VertCol",	980,5,103,28, 0, 0, 0, 0, 0, "Set Vertex colour of selection to current (Shift+K)");
+	uiDefBut(block, BUT, B_SET_VCOL, "Set VertCol",	980,-10,103,19, 0, 0, 0, 0, 0, "Set Vertex colour of selection to current (Shift+K)");
 
 }
 
Index: source/blender/src/drawobject.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/drawobject.c,v
retrieving revision 1.31
diff -u -r1.31 drawobject.c
--- source/blender/src/drawobject.c	23 Oct 2003 16:15:05 -0000	1.31
+++ source/blender/src/drawobject.c	24 Oct 2003 23:42:08 -0000
@@ -1071,7 +1071,7 @@
 	}
 	glEnd();
 
-	glPointSize(1.0);
+	glPointSize(3.0);
 }
 
 
Index: source/blender/src/vpaint.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/vpaint.c,v
retrieving revision 1.7
diff -u -r1.7 vpaint.c
--- source/blender/src/vpaint.c	7 Oct 2003 18:24:02 -0000	1.7
+++ source/blender/src/vpaint.c	24 Oct 2003 23:42:08 -0000
@@ -55,6 +55,7 @@
 
 #include "DNA_mesh_types.h"
 #include "DNA_object_types.h"
+#include "DNA_material_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_view3d_types.h"
@@ -99,7 +100,7 @@
 
 #define MAXINDEX	65336
 
-VPaint Gvp= {1.0, 1.0, 1.0, 0.2, 25.0, 1.0, 1.0, 0, VP_AREA+VP_SOFT};
+VPaint Gvp= {1.0, 1.0, 1.0, 0.2, 25.0, 1.0, 1.0, 0, VP_AREA+VP_SOFT, MA_RGB};
 float vpimat[3][3];
 unsigned int *vpaintundobuf=0;
 int totvpaintundo;


--==IMail_v7.0==--