[Bf-blender-cvs] [026d409] soc-2013-paint: Tweaks to mask brush:
Antony Riakiotakis
noreply at git.blender.org
Sat May 10 15:30:42 CEST 2014
Commit: 026d4096e2a88223786862e01b71dc4a6fdeb785
Author: Antony Riakiotakis
Date: Sat May 10 16:30:34 2014 +0300
https://developer.blender.org/rB026d4096e2a88223786862e01b71dc4a6fdeb785
Tweaks to mask brush:
* Paint the "correct" value independent of inverted mask.
* Always turn on masking when painting with the mask tool.
===================================================================
M source/blender/editors/sculpt_paint/paint_image.c
M source/blender/editors/sculpt_paint/paint_image_proj.c
===================================================================
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 3b8bc4c..b6144fd 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1386,22 +1386,25 @@ void paint_proj_mesh_data_ensure(bContext *C, Object *ob, wmOperator *op)
}
/* Make sure we have a stencil to paint on! */
- if ((br->imagepaint_tool == PAINT_TOOL_MASK) && (imapaint->stencil == NULL)) {
- int width;
- int height;
- Main *bmain = CTX_data_main(C);
- float color[4] = {0.0, 0.0, 0.0, 1.0};
-
- /* should not be allowed, but just in case */
- if (imapaint->slot_xresolution_default == 0)
- imapaint->slot_xresolution_default = 1024;
- if (imapaint->slot_yresolution_default == 0)
- imapaint->slot_yresolution_default = 1024;
-
- width = imapaint->slot_xresolution_default;
- height = imapaint->slot_yresolution_default;
- imapaint->stencil = BKE_image_add_generated(bmain, width, height, "Stencil", 32, false, IMA_GENTYPE_BLANK, color);
+ if (br->imagepaint_tool == PAINT_TOOL_MASK) {
imapaint->flag |= IMAGEPAINT_PROJECT_LAYER_STENCIL;
+
+ if (imapaint->stencil == NULL) {
+ int width;
+ int height;
+ Main *bmain = CTX_data_main(C);
+ float color[4] = {0.0, 0.0, 0.0, 1.0};
+
+ /* should not be allowed, but just in case */
+ if (imapaint->slot_xresolution_default == 0)
+ imapaint->slot_xresolution_default = 1024;
+ if (imapaint->slot_yresolution_default == 0)
+ imapaint->slot_yresolution_default = 1024;
+
+ width = imapaint->slot_xresolution_default;
+ height = imapaint->slot_yresolution_default;
+ imapaint->stencil = BKE_image_add_generated(bmain, width, height, "Stencil", 32, false, IMA_GENTYPE_BLANK, color);
+ }
}
}
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 8731423..6bf333b 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -4342,13 +4342,13 @@ void paint_proj_stroke(const bContext *C, void *pps, const float prev_pos[2], co
{
ProjPaintState *ps = pps;
Brush *brush = ps->brush;
+ Scene *scene = ps->scene;
int a;
ps->brush_size = size;
/* clone gets special treatment here to avoid going through image initialization */
if (ps->tool == PAINT_TOOL_CLONE && ps->mode == BRUSH_STROKE_INVERT) {
- Scene *scene = ps->scene;
View3D *v3d = ps->v3d;
float *cursor = ED_view3d_cursor3d_get(scene, v3d);
int mval_i[2] = {(int)pos[0], (int)pos[1]};
@@ -4375,8 +4375,12 @@ void paint_proj_stroke(const bContext *C, void *pps, const float prev_pos[2], co
}
else if (ps->tool == PAINT_TOOL_MASK) {
ps->stencil_value = brush->weight;
- if (ps->mode == BRUSH_STROKE_INVERT)
+
+ if ((ps->mode == BRUSH_STROKE_INVERT) ^
+ ((scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_STENCIL_INV) != 0))
+ {
ps->stencil_value = 1.0 - ps->stencil_value;
+ }
}
/* continue adding to existing partial redraw rects until redraw */
More information about the Bf-blender-cvs
mailing list