Page MenuHome

blender-vertexcoloralpha-version2.diff

Authored By
Amorilia (amorilia)
Nov 13 2013, 1:36 PM
Size
4 KB
Subscribers
None

blender-vertexcoloralpha-version2.diff

Index: source/blender/include/BSE_trans_types.h
===================================================================
--- source/blender/include/BSE_trans_types.h (revision 15376)
+++ source/blender/include/BSE_trans_types.h (working copy)
@@ -74,7 +74,8 @@
} TransVert;
typedef struct VPaint {
- float r, g, b, a;
+ float r, g, b, alpha;
+ float a; /* amount of pressure */
float size; /* of brush */
float gamma, mul;
short mode, flag;
Index: source/blender/src/buttons_editing.c
===================================================================
--- source/blender/src/buttons_editing.c (revision 15376)
+++ source/blender/src/buttons_editing.c (working copy)
@@ -6104,10 +6104,13 @@
uiDefButF(block, NUMSLI, B_NOP, "R ", 979,170,150,19, &Gvp.r, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of red used for painting");
uiDefButF(block, NUMSLI, B_NOP, "G ", 979,150,150,19, &Gvp.g, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of green used for painting");
uiDefButF(block, NUMSLI, B_NOP, "B ", 979,130,150,19, &Gvp.b, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of blue used for painting");
+ uiBlockEndAlign(block);
+
+ uiDefButF(block, NUMSLI, B_NOP, "A ", 979,105,150,19, &Gvp.alpha, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of alpha used for painting");
uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_NOP, "Opacity ", 979,105,222,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
- uiDefButF(block, NUMSLI, B_NOP, "Size ", 979,85,222,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
+ uiDefButF(block, NUMSLI, B_NOP, "Pressure ", 979,75,222,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
+ uiDefButF(block, NUMSLI, B_NOP, "Size ", 979,55,222,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
uiBlockEndAlign(block);
uiDefButF(block, COL, B_REDR, "", 1140,150,60,40, &(Gvp.r), 0, 0, 0, B_VPCOLSLI, "");
Index: source/blender/src/vpaint.c
===================================================================
--- source/blender/src/vpaint.c (revision 15376)
+++ source/blender/src/vpaint.c (working copy)
@@ -110,8 +110,8 @@
#define MAXINDEX 512000
-VPaint Gvp= {1.0, 1.0, 1.0, 0.2, 25.0, 1.0, 1.0, 0, VP_AREA+VP_SOFT+VP_SPRAY, 0};
-VPaint Gwp= {1.0, 1.0, 1.0, 1.0, 25.0, 1.0, 1.0, 0, VP_AREA+VP_SOFT, 0};
+VPaint Gvp= {1.0, 1.0, 1.0, 1.0, 0.2, 25.0, 1.0, 1.0, 0, VP_AREA+VP_SOFT+VP_SPRAY, 0};
+VPaint Gwp= {1.0, 1.0, 1.0, 1.0, 1.0, 25.0, 1.0, 1.0, 0, VP_AREA+VP_SOFT, 0};
static int *get_indexarray(void)
{
@@ -157,7 +157,7 @@
static unsigned int vpaint_get_current_col(VPaint *vp)
{
- return rgba_to_mcol(vp->r, vp->g, vp->b, 1.0f);
+ return rgba_to_mcol(vp->r, vp->g, vp->b, vp->alpha);
}
void do_shared_vertexcol(Mesh *me)
@@ -532,6 +532,7 @@
Gvp.r= cp[0]/255.0f;
Gvp.g= cp[1]/255.0f;
Gvp.b= cp[2]/255.0f;
+ /* do not sample alpha channel? */
}
else {
Brush *brush= G.scene->toolsettings->imapaint.brush;
@@ -540,6 +541,7 @@
brush->rgb[0]= cp[0]/255.0f;
brush->rgb[1]= cp[1]/255.0f;
brush->rgb[2]= cp[2]/255.0f;
+ /* do not sample alpha channel? */
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWIMAGE, 0);
@@ -565,7 +567,7 @@
cp2= (char *)&col2;
cp= (char *)&col;
- cp[0]= 255;
+ cp[0]= (mfac*cp1[0]+fac*cp2[0])>>8; /* mix alpha channels */
cp[1]= (mfac*cp1[1]+fac*cp2[1])>>8;
cp[2]= (mfac*cp1[2]+fac*cp2[2])>>8;
cp[3]= (mfac*cp1[3]+fac*cp2[3])>>8;
@@ -585,7 +587,7 @@
cp2= (char *)&col2;
cp= (char *)&col;
- cp[0]= 255;
+ cp[0]= cp1[0]; /* keep original alpha */
temp= cp1[1] + ((fac*cp2[1])>>8);
if(temp>254) cp[1]= 255; else cp[1]= temp;
temp= cp1[2] + ((fac*cp2[2])>>8);
@@ -608,7 +610,7 @@
cp2= (char *)&col2;
cp= (char *)&col;
- cp[0]= 255;
+ cp[0]= cp1[0]; /* keep original alpha */
temp= cp1[1] - ((fac*cp2[1])>>8);
if(temp<0) cp[1]= 0; else cp[1]= temp;
temp= cp1[2] - ((fac*cp2[2])>>8);
@@ -634,7 +636,7 @@
cp= (char *)&col;
/* first mul, then blend the fac */
- cp[0]= 255;
+ cp[0]= cp1[0]; /* keep original alpha */
cp[1]= (mfac*cp1[1] + fac*((cp2[1]*cp1[1])>>8) )>>8;
cp[2]= (mfac*cp1[2] + fac*((cp2[2]*cp1[2])>>8) )>>8;
cp[3]= (mfac*cp1[3] + fac*((cp2[3]*cp1[3])>>8) )>>8;
@@ -663,7 +665,7 @@
if (cp1[1]+cp1[2]+cp1[3] > cp2[1]+cp2[2]+cp2[3])
return col1;
- cp[0]= 255;
+ cp[0]= cp1[0]; /* keep original alpha */
cp[1]= (mfac*cp1[1]+fac*cp2[1])>>8;
cp[2]= (mfac*cp1[2]+fac*cp2[2])>>8;
cp[3]= (mfac*cp1[3]+fac*cp2[3])>>8;
@@ -691,7 +693,7 @@
if (cp1[1]+cp1[2]+cp1[3] < cp2[1]+cp2[2]+cp2[3])
return col1;
- cp[0]= 255;
+ cp[0]= cp1[0]; /* keep original alpha */
cp[1]= (mfac*cp1[1]+fac*cp2[1])>>8;
cp[2]= (mfac*cp1[2]+fac*cp2[2])>>8;
cp[3]= (mfac*cp1[3]+fac*cp2[3])>>8;

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d7/2c/42ffa39c2579d039aa01264bf7bc

Event Timeline