Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2014-07-06 19:29:48 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-07-06 19:30:09 +0400
commitcfc62a97a595befb2764b2c6f58365be08b59ab5 (patch)
treeacf5c9fb643304aef89632205af8db3dc64cb22d /source/blender/editors/sculpt_paint/paint_mask.c
parent1c329fc54b6b136fb5067b876576fd4384e40d03 (diff)
Add support to lasso masking/flood fill for inverted values.
This can be used to subtract a region from masks but it's not very user friendly yet. To male this work better, the tool will probably be brushified later.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_mask.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index 364ebac42a7..b3f81f379f3 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -67,6 +67,13 @@
#include <stdlib.h>
+static EnumPropertyItem mode_items[] = {
+ {PAINT_MASK_FLOOD_VALUE, "VALUE", 0, "Value", "Set mask to the level specified by the 'value' property"},
+ {PAINT_MASK_FLOOD_VALUE_INVERSE, "VALUE_INVERSE", 0, "Value Inverted", "Set mask to the level specified by the inverted 'value' property"},
+ {PAINT_MASK_INVERT, "INVERT", 0, "Invert", "Invert the mask"},
+ {0}};
+
+
static void mask_flood_fill_set_elem(float *elem,
PaintMaskFloodMode mode,
float value)
@@ -75,6 +82,9 @@ static void mask_flood_fill_set_elem(float *elem,
case PAINT_MASK_FLOOD_VALUE:
(*elem) = value;
break;
+ case PAINT_MASK_FLOOD_VALUE_INVERSE:
+ (*elem) = 1.0f - value;
+ break;
case PAINT_MASK_INVERT:
(*elem) = 1.0f - (*elem);
break;
@@ -137,11 +147,6 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op)
void PAINT_OT_mask_flood_fill(struct wmOperatorType *ot)
{
- static EnumPropertyItem mode_items[] = {
- {PAINT_MASK_FLOOD_VALUE, "VALUE", 0, "Value", "Set mask to the level specified by the 'value' property"},
- {PAINT_MASK_INVERT, "INVERT", 0, "Invert", "Invert the mask"},
- {0}};
-
/* identifiers */
ot->name = "Mask Flood Fill";
ot->idname = "PAINT_OT_mask_flood_fill";
@@ -330,9 +335,8 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
PBVHNode **nodes;
int totnode, i, symmpass;
bool multires;
- PaintMaskFloodMode mode = PAINT_MASK_FLOOD_VALUE;
- bool select = true; /* TODO: see how to implement deselection */
- float value = select ? 1.0 : 0.0;
+ PaintMaskFloodMode mode = RNA_enum_get(op->ptr, "mode");
+ float value = RNA_float_get(op->ptr, "value");
/* Calculations of individual vertices are done in 2D screen space to diminish the amount of
* calculations done. Bounding box PBVH collision is not computed against enclosing rectangle
@@ -442,4 +446,8 @@ void PAINT_OT_mask_lasso_gesture(wmOperatorType *ot)
prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
+
+ RNA_def_enum(ot->srna, "mode", mode_items, PAINT_MASK_FLOOD_VALUE, "Mode", NULL);
+ RNA_def_float(ot->srna, "value", 1.0, 0, 1.0, "Value",
+ "Mask level to use when mode is 'Value'; zero means no masking and one is fully masked", 0, 1);
}