[Bf-committers] Update to HSV patch

Desoto bf-committers@blender.org
Sat, 25 Oct 2003 14:28:10 -0400


This is a multi-part message in MIME format.
--------------020903040602070504030806
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hey folks...after some poking and prodding and some help from Ton and 
Alex I finally seem to have weeded out the problems.  SO!  Here it 
is...another boring HSV update ;)



--------------020903040602070504030806
Content-Type: text/plain;
 name="desoto_HSV_update.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="desoto_HSV_update.txt"

? desoto_HSV_update.txt
? user-def.mk
? obj/windows
Index: source/blender/blenkernel/intern/texture.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/blenkernel/intern/texture.c,v
retrieving revision 1.7
diff -u -r1.7 texture.c
--- source/blender/blenkernel/intern/texture.c	23 Oct 2003 09:38:10 -0000	1.7
+++ source/blender/blenkernel/intern/texture.c	25 Oct 2003 18:08:02 -0000
@@ -343,6 +343,7 @@
 	tex->rfac= 1.0;
 	tex->gfac= 1.0;
 	tex->bfac= 1.0;
+	tex->colmode= MA_RGB;
 
 }
 
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	25 Oct 2003 18:08:03 -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/makesdna/DNA_texture_types.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_texture_types.h,v
retrieving revision 1.7
diff -u -r1.7 DNA_texture_types.h
--- source/blender/makesdna/DNA_texture_types.h	23 Sep 2003 21:05:51 -0000	1.7
+++ source/blender/makesdna/DNA_texture_types.h	25 Oct 2003 18:08:03 -0000
@@ -102,7 +102,7 @@
 typedef struct ColorBand {
 	short flag, tot, cur, ipotype;
 	CBData data[16];
-	
+
 } ColorBand;
 
 typedef struct EnvMap {
@@ -143,6 +143,10 @@
 	struct EnvMap *env;
 	
 	short fradur[4][2];
+	
+	short colmode;
+	
+	char pad[6];
 	
 } Tex;
 
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	25 Oct 2003 18:08:03 -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/buttons_shading.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/buttons_shading.c,v
retrieving revision 1.19
diff -u -r1.19 buttons_shading.c
--- source/blender/src/buttons_shading.c	23 Oct 2003 16:52:53 -0000	1.19
+++ source/blender/src/buttons_shading.c	25 Oct 2003 18:08:03 -0000
@@ -976,7 +976,7 @@
 {
 	uiBlock *block;
 	CBData *cbd;
-	
+		
 	block= uiNewBlock(&curarea->uiblocks, "texture_panel_colors", UI_EMBOSS, UI_HELV, curarea->win);
 	uiNewPanelTabbed("Texture", "Texture");
 	if(uiNewPanel(curarea, block, "Colors", "Texture", 1280, 0, 318, 204)==0) return;
@@ -1000,19 +1000,46 @@
 		uiDefButS(block, ROW, B_TEXPRV, "S",		130,120,20,20, &tex->coba->ipotype, 5.0, 2.0, 0, 0, "Interpolation type Spline");
 		uiDefButF(block, COL, B_BANDCOL, "",		150,120,30,20, &(cbd->r), 0, 0, 0, 0, "");
 		uiDefButF(block, NUMSLI, B_TEXPRV, "A ",	180,120,130,20, &cbd->a, 0.0, 1.0, 0, 0, "Set the alpha value");
+	
+		if (tex->colmode==MA_RGB) {
+			uiDefButF(block, NUMSLI, B_TEXREDR_PRV, "R ",	10,100,100,20, &cbd->r, 0.0, 1.0, B_BANDCOL, 0, "Set the red value");
+			uiDefButF(block, NUMSLI, B_TEXREDR_PRV, "G ",	110,100,100,20, &cbd->g, 0.0, 1.0, B_BANDCOL, 0, "Set the green value");
+			uiDefButF(block, NUMSLI, B_TEXREDR_PRV, "B ",	210,100,100,20, &cbd->b, 0.0, 1.0, B_BANDCOL, 0, "Set the blue value");
+		}
+		else {
+			uiBlockSetCol(block, TH_BUT_SETTING1);
+			uiDefButF(block, HSVSLI, B_TEXREDR_PRV, "H ",	10,100,100,20, &(cbd->r), 0.0, 0.9999, B_BANDCOL, 0, "Set the hue");
+			uiDefButF(block, HSVSLI, B_TEXREDR_PRV, "S ",	110,100,100,20, &(cbd->r), 0.0001, 1.0, B_BANDCOL, 0, "Set the saturation");
+			uiDefButF(block, HSVSLI, B_TEXREDR_PRV, "V ",	210,100,100,20, &(cbd->r), 0.0001, 1.0, B_BANDCOL, 0, "Set the value");        
+			uiBlockSetCol(block, TH_AUTO);
+		}
 		
-		uiDefButF(block, NUMSLI, B_TEXPRV, "R ",	10,100,100,20, &cbd->r, 0.0, 1.0, B_BANDCOL, 0, "Set the red value");
-		uiDefButF(block, NUMSLI, B_TEXPRV, "G ",	110,100,100,20, &cbd->g, 0.0, 1.0, B_BANDCOL, 0, "Set the green value");
-		uiDefButF(block, NUMSLI, B_TEXPRV, "B ",	210,100,100,20, &cbd->b, 0.0, 1.0, B_BANDCOL, 0, "Set the blue value");
-		
+		uiDefButS(block, ROW, REDRAWBUTSSHADING, "RGB",			10,55,70,20, &tex->colmode, 2.0, (float)MA_RGB, 0, 0, "Create colour by red, green and blue");
+		uiDefButS(block, ROW, REDRAWBUTSSHADING, "HSV",			90,55,70,20, &tex->colmode, 2.0, (float)MA_HSV, 0, 0, "Mix colour with hue, saturation and value");		
+			
 	}
 
 	/* RGB-BRICON */
 	if((tex->flag & TEX_COLORBAND)==0) {
-		uiDefButF(block, NUMSLI, B_TEXPRV, "R ",		60,80,200,20, &tex->rfac, 0.0, 2.0, 0, 0, "Set the red value");
-		uiDefButF(block, NUMSLI, B_TEXPRV, "G ",		60,60,200,20, &tex->gfac, 0.0, 2.0, 0, 0, "Set the green value");
-		uiDefButF(block, NUMSLI, B_TEXPRV, "B ",		60,40,200,20, &tex->bfac, 0.0, 2.0, 0, 0, "Set the blue value");
+		
+		if (tex->colmode==MA_RGB) {
+			uiDefButF(block, NUMSLI, B_TEXPRV, "R ",		60,150,200,20, &tex->rfac, 0.0, 2.0, 0, 0, "Set the red value");
+			uiDefButF(block, NUMSLI, B_TEXPRV, "G ",		60,120,200,20, &tex->gfac, 0.0, 2.0, 0, 0, "Set the green value");
+			uiDefButF(block, NUMSLI, B_TEXPRV, "B ",		60,90,200,20, &tex->bfac, 0.0, 2.0, 0, 0, "Set the blue value");
+		}
+		else {
+			uiBlockSetCol(block, TH_BUT_SETTING1);
+			uiDefButF(block, HSVSLI, B_TEXPRV, "H ",		60,150,200,20, &(tex->rfac), 0.0, 0.9999, B_BANDCOL, 0, "Set the hue");
+			uiDefButF(block, HSVSLI, B_TEXPRV, "S ",		60,120,200,20, &(tex->rfac), 0.0001, 1.0, B_BANDCOL, 0, "Set the saturation");
+			uiDefButF(block, HSVSLI, B_TEXPRV, "V ",		60,90,200,20, &(tex->rfac), 0.0001, 1.0, B_BANDCOL, 0, "Set the value");        
+			uiBlockSetCol(block, TH_AUTO);
+		}
+		
+		uiDefButS(block, ROW, REDRAWBUTSSHADING, "RGB",			10,55,70,20, &tex->colmode, 2.0, (float)MA_RGB, 0, 0, "Create colour by red, green and blue");
+		uiDefButS(block, ROW, REDRAWBUTSSHADING, "HSV",			90,55,70,20, &tex->colmode, 2.0, (float)MA_HSV, 0, 0, "Mix colour with hue, saturation and value");		
+	
 	}
+	
 	uiDefButF(block, NUMSLI, B_TEXPRV, "Bright",		10,10,150,20, &tex->bright, 0.0, 2.0, 0, 0, "Set the brightness of the colour or intensity of a texture");
 	uiDefButF(block, NUMSLI, B_TEXPRV, "Contr",			160,10,150,20, &tex->contrast, 0.01, 2.0, 0, 0, "Set the contrast of the colour or intensity of a texture");
 
@@ -1811,10 +1838,24 @@
 	uiBlockSetCol(block, TH_AUTO);
 	uiDefButF(block, NUMSLI,B_MATPRV,"Energy ",	120,150,180,20, &(la->energy), 0.0, 10.0, 0, 0, "Set the intensity of the light");
 
-	uiDefButF(block, NUMSLI,B_MATPRV,"R ",		120,120,180,20,&la->r, 0.0, 1.0, B_COLLAMP, 0, "Set the red component of the light");
-	uiDefButF(block, NUMSLI,B_MATPRV,"G ",		120,100,180,20,&la->g, 0.0, 1.0, B_COLLAMP, 0, "Set the green component of the light");
-	uiDefButF(block, NUMSLI,B_MATPRV,"B ",		120,80,180,20,&la->b, 0.0, 1.0, B_COLLAMP, 0, "Set the blue component of the light");
-	uiDefButF(block, COL, B_COLLAMP, "",		120,55,180,24, &la->r, 0, 0, 0, 0, "");
+	if (la->colormodel==MA_RGB) {
+		uiDefButF(block, NUMSLI,B_MATPRV,"R ",		120,120,145,20,&la->r, 0.0, 1.0, B_COLLAMP, 0, "Set the red component of the light");
+		uiDefButF(block, NUMSLI,B_MATPRV,"G ",		120,100,145,20,&la->g, 0.0, 1.0, B_COLLAMP, 0, "Set the green component of the light");
+		uiDefButF(block, NUMSLI,B_MATPRV,"B ",		120,80,145,20,&la->b, 0.0, 1.0, B_COLLAMP, 0, "Set the blue component of the light");
+	}
+	else {
+		uiBlockSetCol(block, TH_BUT_SETTING1);
+		uiDefButF(block, HSVSLI,B_MATPRV,"H ",		120,120,145,20,&(la->r), 0.0, .9999, B_COLLAMP, 0, "Set the hue component of the light color");
+		uiDefButF(block, HSVSLI,B_MATPRV,"S ",		120,100,145,20,&(la->r), 0.0001, 1.0, B_COLLAMP, 0, "Set the saturation component of the light color");
+		uiDefButF(block, HSVSLI,B_MATPRV,"V ",		120,80,145,20,&(la->r), 0.0001, 1.0, B_COLLAMP, 0, "Set the value component of the light color");
+		uiBlockSetCol(block, TH_AUTO);
+	}
+	
+	uiDefButF(block, COL, B_COLLAMP, "",		270,80,30,60, &la->r, 0, 0, 0, 0, "");
+			
+	uiDefButS(block, ROW, REDRAWBUTSSHADING,"RGB",	120,55,85,20, &la->colormodel, 2.0, (float)MA_RGB, 0, 0, "Create colour by red, green and blue");
+	uiDefButS(block, ROW, REDRAWBUTSSHADING,"HSV",	210,55,85,20, &la->colormodel, 2.0, (float)MA_HSV, 0, 0, "Mix colour with hue, saturation and value");
+	
 	
 	uiDefButF(block, NUMSLI,B_MATPRV,"Quad1 ",	120,30,180,19,&la->att1, 0.0, 1.0, 0, 0, "Set the light intensity value 1 for a quad lamp");
 	uiDefButF(block, NUMSLI,B_MATPRV,"Quad2 ",  120,10,180,19,&la->att2, 0.0, 1.0, 0, 0, "Set the light intensity value 2 for a quad lamp");
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	25 Oct 2003 18:08:04 -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;

--------------020903040602070504030806--