[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37347] branches/soc-2011-onion: Revision: 30701
Jason Wilkins
Jason.A.Wilkins at gmail.com
Fri Jun 10 00:25:54 CEST 2011
Revision: 37347
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37347
Author: jwilkins
Date: 2011-06-09 22:25:53 +0000 (Thu, 09 Jun 2011)
Log Message:
-----------
Revision: 30701
Author: nicholasbishop
Date: 7:19:18 PM, Saturday, July 24, 2010
Message:
== VPaint ==
* Re-enabled all the vpaint tools except for blur
* Also added alpha blending modes
* Removed dead code
TODO:
* Combine the add and erase alpha modes, only separate for now to match the IMB_BLEND modes more easily
** jwilkins:
** looking ahead, I do not see a do_versions that fixes up the vertex tools from old to new
** the IMB_BLEND modes almost match the vertex paint tools, but not exactly
Modified Paths:
--------------
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c
branches/soc-2011-onion/source/blender/makesdna/DNA_brush_types.h
branches/soc-2011-onion/source/blender/makesrna/intern/rna_brush.c
Property Changed:
----------------
branches/soc-2011-onion/
Property changes on: branches/soc-2011-onion
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30676,30692-30693,30696,30699-30700,30742
/trunk/blender:36833-37206
+ /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30676,30692-30693,30696,30699-30701,30742
/trunk/blender:36833-37206
Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c 2011-06-09 21:28:02 UTC (rev 37346)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c 2011-06-09 22:25:53 UTC (rev 37347)
@@ -90,15 +90,6 @@
#include "paint_intern.h"
-/* brush->vertexpaint_tool */
-#define VP_MIX 0
-#define VP_ADD 1
-#define VP_SUB 2
-#define VP_MUL 3
-#define VP_BLUR 4
-#define VP_LIGHTEN 5
-#define VP_DARKEN 6
-
/* polling - retrieve whether cursor should be set or operator should be done */
@@ -525,154 +516,7 @@
}
*/
-static unsigned int mcol_blend(unsigned int col1, unsigned int col2, int fac)
-{
- char *cp1, *cp2, *cp;
- int mfac;
- unsigned int col=0;
-
- if(fac==0) return col1;
- if(fac>=255) return col2;
-
- mfac= 255-fac;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- cp[0]= 255;
- cp[1]= (mfac*cp1[1]+fac*cp2[1])/255;
- cp[2]= (mfac*cp1[2]+fac*cp2[2])/255;
- cp[3]= (mfac*cp1[3]+fac*cp2[3])/255;
-
- return col;
-}
-
-static unsigned int mcol_add(unsigned int col1, unsigned int col2, int fac)
-{
- char *cp1, *cp2, *cp;
- int temp;
- unsigned int col=0;
-
- if(fac==0) return col1;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- cp[0]= 255;
- temp= cp1[1] + ((fac*cp2[1])/255);
- if(temp>254) cp[1]= 255; else cp[1]= temp;
- temp= cp1[2] + ((fac*cp2[2])/255);
- if(temp>254) cp[2]= 255; else cp[2]= temp;
- temp= cp1[3] + ((fac*cp2[3])/255);
- if(temp>254) cp[3]= 255; else cp[3]= temp;
-
- return col;
-}
-
-static unsigned int mcol_sub(unsigned int col1, unsigned int col2, int fac)
-{
- char *cp1, *cp2, *cp;
- int temp;
- unsigned int col=0;
-
- if(fac==0) return col1;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- cp[0]= 255;
- temp= cp1[1] - ((fac*cp2[1])/255);
- if(temp<0) cp[1]= 0; else cp[1]= temp;
- temp= cp1[2] - ((fac*cp2[2])/255);
- if(temp<0) cp[2]= 0; else cp[2]= temp;
- temp= cp1[3] - ((fac*cp2[3])/255);
- if(temp<0) cp[3]= 0; else cp[3]= temp;
-
- return col;
-}
-
-static unsigned int mcol_mul(unsigned int col1, unsigned int col2, int fac)
-{
- char *cp1, *cp2, *cp;
- int mfac;
- unsigned int col=0;
-
- if(fac==0) return col1;
-
- mfac= 255-fac;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- /* first mul, then blend the fac */
- cp[0]= 255;
- cp[1]= (mfac*cp1[1] + fac*((cp2[1]*cp1[1])/255) )/255;
- cp[2]= (mfac*cp1[2] + fac*((cp2[2]*cp1[2])/255) )/255;
- cp[3]= (mfac*cp1[3] + fac*((cp2[3]*cp1[3])/255) )/255;
-
-
- return col;
-}
-
-static unsigned int mcol_lighten(unsigned int col1, unsigned int col2, int fac)
-{
- char *cp1, *cp2, *cp;
- int mfac;
- unsigned int col=0;
-
- if(fac==0) return col1;
- if(fac>=255) return col2;
-
- mfac= 255-fac;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- /* See if are lighter, if so mix, else dont do anything.
- if the paint col is darker then the original, then ignore */
- if (cp1[1]+cp1[2]+cp1[3] > cp2[1]+cp2[2]+cp2[3])
- return col1;
-
- cp[0]= 255;
- cp[1]= (mfac*cp1[1]+fac*cp2[1])/255;
- cp[2]= (mfac*cp1[2]+fac*cp2[2])/255;
- cp[3]= (mfac*cp1[3]+fac*cp2[3])/255;
-
- return col;
-}
-
-static unsigned int mcol_darken(unsigned int col1, unsigned int col2, int fac)
-{
- char *cp1, *cp2, *cp;
- int mfac;
- unsigned int col=0;
-
- if(fac==0) return col1;
- if(fac>=255) return col2;
-
- mfac= 255-fac;
-
- cp1= (char *)&col1;
- cp2= (char *)&col2;
- cp= (char *)&col;
-
- /* See if were darker, if so mix, else dont do anything.
- if the paint col is brighter then the original, then ignore */
- if (cp1[1]+cp1[2]+cp1[3] < cp2[1]+cp2[2]+cp2[3])
- return col1;
-
- cp[0]= 255;
- cp[1]= (mfac*cp1[1]+fac*cp2[1])/255;
- cp[2]= (mfac*cp1[2]+fac*cp2[2])/255;
- cp[3]= (mfac*cp1[3]+fac*cp2[3])/255;
- return col;
-}
-
+/*
static void vpaint_blend(VPaint *vp, unsigned int *col, unsigned int *colorig, unsigned int paintcol, int alpha)
{
Brush *brush = paint_brush(&vp->paint);
@@ -684,7 +528,7 @@
else if(brush->vertexpaint_tool==VP_LIGHTEN) *col= mcol_lighten( *col, paintcol, alpha);
else if(brush->vertexpaint_tool==VP_DARKEN) *col= mcol_darken( *col, paintcol, alpha);
- /* if no spray, clip color adding with colorig & orig alpha */
+ // if no spray, clip color adding with colorig & orig alpha
if((vp->flag & VP_SPRAY)==0) {
unsigned int testcol=0, a;
char *cp, *ct, *co;
@@ -714,8 +558,8 @@
}
}
}
+*/
-
static int sample_backbuf_area(ViewContext *vc, int *indexar, int totface, int x, int y, float size)
{
struct ImBuf *ibuf;
@@ -805,32 +649,32 @@
if (flip) {
switch(tool) {
- case VP_MIX:
+ case IMB_BLEND_MIX:
paintval = 1.f - paintval; break;
- case VP_ADD:
- tool= VP_SUB; break;
- case VP_SUB:
- tool= VP_ADD; break;
- case VP_LIGHTEN:
- tool= VP_DARKEN; break;
- case VP_DARKEN:
- tool= VP_LIGHTEN; break;
+ case IMB_BLEND_ADD:
+ tool= IMB_BLEND_SUB; break;
+ case IMB_BLEND_SUB:
+ tool= IMB_BLEND_ADD; break;
+ case IMB_BLEND_LIGHTEN:
+ tool= IMB_BLEND_DARKEN; break;
+ case IMB_BLEND_DARKEN:
+ tool= IMB_BLEND_LIGHTEN; break;
}
}
- if(tool==VP_MIX || tool==VP_BLUR)
+ if(tool==IMB_BLEND_MIX || tool==VERTEX_PAINT_BLUR)
dw->weight = paintval*alpha + dw->weight*(1.0f-alpha);
- else if(tool==VP_ADD)
+ else if(tool==IMB_BLEND_ADD)
dw->weight += paintval*alpha;
- else if(tool==VP_SUB)
+ else if(tool==IMB_BLEND_SUB)
dw->weight -= paintval*alpha;
- else if(tool==VP_MUL)
+ else if(tool==IMB_BLEND_MUL)
/* first mul, then blend the fac */
dw->weight = ((1.0f-alpha) + alpha*paintval)*dw->weight;
- else if(tool==VP_LIGHTEN) {
+ else if(tool==IMB_BLEND_LIGHTEN) {
if (dw->weight < paintval)
dw->weight = paintval*alpha + dw->weight*(1.0f-alpha);
- } else if(tool==VP_DARKEN) {
+ } else if(tool==IMB_BLEND_DARKEN) {
if (dw->weight > paintval)
dw->weight = paintval*alpha + dw->weight*(1.0f-alpha);
}
@@ -841,21 +685,21 @@
float testw=0.0f;
alpha= brush_alpha(brush);
- if(tool==VP_MIX || tool==VP_BLUR)
+ if(tool==IMB_BLEND_MIX || tool==VERTEX_PAINT_BLUR)
testw = paintval*alpha + uw->weight*(1.0f-alpha);
- else if(tool==VP_ADD)
+ else if(tool==IMB_BLEND_ADD)
testw = uw->weight + paintval*alpha;
- else if(tool==VP_SUB)
+ else if(tool==IMB_BLEND_SUB)
testw = uw->weight - paintval*alpha;
- else if(tool==VP_MUL)
+ else if(tool==IMB_BLEND_MUL)
/* first mul, then blend the fac */
testw = ((1.0f-alpha) + alpha*paintval)*uw->weight;
- else if(tool==VP_LIGHTEN) {
+ else if(tool==IMB_BLEND_LIGHTEN) {
if (uw->weight < paintval)
testw = paintval*alpha + uw->weight*(1.0f-alpha);
else
testw = uw->weight;
- } else if(tool==VP_DARKEN) {
+ } else if(tool==IMB_BLEND_DARKEN) {
if (uw->weight > paintval)
testw = paintval*alpha + uw->weight*(1.0f-alpha);
else
@@ -1456,7 +1300,7 @@
/* make sure each vertex gets treated only once */
/* and calculate filter weight */
totw= 0;
- if(brush->vertexpaint_tool==VP_BLUR)
+ if(brush->vertexpaint_tool==VERTEX_PAINT_BLUR)
paintweight= 0.0f;
else
paintweight= ts->vgroup_weight;
@@ -1470,7 +1314,7 @@
(me->dvert+mface->v3)->flag= 1;
if(mface->v4) (me->dvert+mface->v4)->flag= 1;
- if(brush->vertexpaint_tool==VP_BLUR) {
+ if(brush->vertexpaint_tool==VERTEX_PAINT_BLUR) {
MDeformWeight *dw, *(*dw_func)(MDeformVert *, const int);
if(wp->flag & VP_ONLYVGROUP)
@@ -1492,7 +1336,7 @@
}
}
- if(brush->vertexpaint_tool==VP_BLUR)
+ if(brush->vertexpaint_tool==VERTEX_PAINT_BLUR)
paintweight/= (float)totw;
for(index=0; index<totindex; index++) {
@@ -1833,9 +1677,12 @@
strength = brush->alpha *
brush_curve_strength(brush, dist,
radius);
+
+ if(brush->vertexpaint_tool != VERTEX_PAINT_BLUR) {
+ IMB_blend_color_float(col, col, paint_col, strength,
+ brush->vertexpaint_tool);
+ }
- IMB_blend_color_float(col, col, paint_col, strength, IMB_BLEND_MIX /* TODO */);
-
return 1;
}
@@ -2041,9 +1888,9 @@
unsigned int *col = (unsigned int*)(mcol + cndx);
unsigned int *orig_col = (unsigned int*)(orig + cndx);
- vpaint_blend(vp, col, orig_col,
+ /*vpaint_blend(vp, col, orig_col,
vpd->paintcol,
- brush->alpha * 255);
+ brush->alpha * 255);*/
}
BLI_pbvh_node_set_flags(hit_data.node,
@@ -2087,9 +1934,9 @@
vpaint_color_one_face(C, stroke, itemptr);
}
- /* was disabled because it is slow, but necessary for blur */
+ /* XXX
if(brush->vertexpaint_tool == VP_BLUR)
- do_shared_vertexcol(ob->data);
+ do_shared_vertexcol(ob->data);*/
/* partial redraw */
paint_tag_partial_redraw(C, ob);
Modified: branches/soc-2011-onion/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- branches/soc-2011-onion/source/blender/makesdna/DNA_brush_types.h 2011-06-09 21:28:02 UTC (rev 37346)
+++ branches/soc-2011-onion/source/blender/makesdna/DNA_brush_types.h 2011-06-09 22:25:53 UTC (rev 37347)
@@ -171,6 +171,9 @@
SCULPT_TOOL_MASK = 20,
} SculptTool;
+/* Brush.vertexpaint_tool */
+#define VERTEX_PAINT_BLUR -1
+/* The other vpaint tools are in IMB_BlendMode */
/* ImagePaintSettings.tool */
#define PAINT_TOOL_DRAW 0
#define PAINT_TOOL_SOFTEN 1
Modified: branches/soc-2011-onion/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- branches/soc-2011-onion/source/blender/makesrna/intern/rna_brush.c 2011-06-09 21:28:02 UTC (rev 37346)
+++ branches/soc-2011-onion/source/blender/makesrna/intern/rna_brush.c 2011-06-09 22:25:53 UTC (rev 37347)
@@ -409,6 +409,66 @@
{BRUSH_AIRBRUSH, "AIRBRUSH", 0, "Airbrush", "Keep applying paint effect while holding mouse (spray)"},
{0, NULL, 0, NULL, NULL}};
+ static EnumPropertyItem texture_angle_source_items[] = {
+ {0, "USER", 0, "User", ""},
+ {BRUSH_RAKE, "RAKE", 0, "Rake", ""},
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list