[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48877] branches/soc-2012-bratwurst/source /blender/editors/sculpt_paint: modifications to get the mask alpha in overlay.
Antony Riakiotakis
kalast at gmail.com
Thu Jul 12 21:56:48 CEST 2012
Revision: 48877
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48877
Author: psy-fi
Date: 2012-07-12 19:56:47 +0000 (Thu, 12 Jul 2012)
Log Message:
-----------
modifications to get the mask alpha in overlay. Still quite some fixes
needed for it to work properly
Modified Paths:
--------------
branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_cursor.c
branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_intern.h
branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_utils.c
branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/sculpt.c
Modified: branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_cursor.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_cursor.c 2012-07-12 19:56:34 UTC (rev 48876)
+++ branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_cursor.c 2012-07-12 19:56:47 UTC (rev 48877)
@@ -276,13 +276,18 @@
x += br->mtex.ofs[0];
y += br->mtex.ofs[1];
- avg = br->mtex.tex ? paint_get_tex_pixel(br, x, y) : 1;
+ avg = br->mtex.tex ? paint_get_tex_pixel(br, x, y, FALSE) : 1;
avg += br->texture_sample_bias;
- if (br->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW)
+ if (!do_tiled) {
avg *= BKE_brush_curve_strength(br, len, 1); /* Falloff curve */
+ if(br->flag & BRUSH_USE_MASK) {
+ avg *= br->mask_mtex.tex ? paint_get_tex_pixel(br, x, y, TRUE) : 1;
+ }
+ }
+
buffer[index] = 255 - (GLubyte)(255 * avg);
}
else {
@@ -362,6 +367,10 @@
avg = BKE_brush_curve_strength(br, len, 1); /* Falloff curve */
+ if(br->flag & BRUSH_USE_MASK) {
+ avg *= br->mask_mtex.tex ? paint_get_tex_pixel(br, x, y, TRUE) : 1;
+ }
+
curve_buffer[index] = (GLubyte)(255 * avg);
}
else {
Modified: branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_intern.h 2012-07-12 19:56:34 UTC (rev 48876)
+++ branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_intern.h 2012-07-12 19:56:47 UTC (rev 48877)
@@ -135,7 +135,7 @@
void projectf(struct bglMats *mats, const float v[3], float p[2]);
float paint_calc_object_space_radius(struct ViewContext *vc, const float center[3], float pixel_radius);
-float paint_get_tex_pixel(struct Brush *br, float u, float v);
+float paint_get_tex_pixel(struct Brush *br, float u, float v, int mask);
int imapaint_pick_face(struct ViewContext *vc, const int mval[2], unsigned int *index, unsigned int totface);
void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, const int xy[2], float uv[2]);
Modified: branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_utils.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_utils.c 2012-07-12 19:56:34 UTC (rev 48876)
+++ branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_utils.c 2012-07-12 19:56:47 UTC (rev 48877)
@@ -172,8 +172,9 @@
return len_v3(delta) / scale;
}
-float paint_get_tex_pixel(Brush *br, float u, float v)
+float paint_get_tex_pixel(Brush *br, float u, float v, int mask)
{
+ Tex *tex = mask ? br->mask_mtex.tex :br->mtex.tex;
TexResult texres;
float co[3];
int hasrgb;
@@ -183,7 +184,7 @@
co[2] = 0;
memset(&texres, 0, sizeof(TexResult));
- hasrgb = multitex_ext(br->mtex.tex, co, NULL, NULL, 0, &texres);
+ hasrgb = multitex_ext(tex, co, NULL, NULL, 0, &texres);
if (hasrgb & TEX_RGB)
texres.tin = rgb_to_grayscale(&texres.tr) * texres.ta;
Modified: branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/sculpt.c 2012-07-12 19:56:34 UTC (rev 48876)
+++ branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/sculpt.c 2012-07-12 19:56:47 UTC (rev 48877)
@@ -839,7 +839,7 @@
x += br->mtex.ofs[0];
y += br->mtex.ofs[1];
- avg = paint_get_tex_pixel(br, x, y);
+ avg = paint_get_tex_pixel(br, x, y, FALSE);
}
avg += br->texture_sample_bias;
More information about the Bf-blender-cvs
mailing list