[Bf-blender-cvs] [6824d73b754] sculpt-dev: Sculpt IPMask: Add direction property to the filter
Pablo Dobarro
noreply at git.blender.org
Wed Mar 17 01:53:20 CET 2021
Commit: 6824d73b75472ded4bb54a4e15c03812ad9cc6bf
Author: Pablo Dobarro
Date: Tue Mar 16 20:45:58 2021 +0100
Branches: sculpt-dev
https://developer.blender.org/rB6824d73b75472ded4bb54a4e15c03812ad9cc6bf
Sculpt IPMask: Add direction property to the filter
===================================================================
M source/blender/editors/sculpt_paint/sculpt_filter_mask.c
===================================================================
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mask.c b/source/blender/editors/sculpt_paint/sculpt_filter_mask.c
index 7425b860d7c..72a41c20583 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_mask.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_mask.c
@@ -1021,6 +1021,7 @@ static int sculpt_ipmask_filter_exec(bContext *C, wmOperator *op)
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
const int filter_type = RNA_enum_get(op->ptr, "filter_type");
+ const int direction = RNA_enum_get(op->ptr, "direction");
const bool use_step_interpolation = RNA_boolean_get(op->ptr, "use_step_interpolation");
const int iteration_count = RNA_int_get(op->ptr, "iterations");
const float strength = RNA_float_get(op->ptr, "strength");
@@ -1035,12 +1036,13 @@ static int sculpt_ipmask_filter_exec(bContext *C, wmOperator *op)
SCULPT_undo_push_node(ob, nodes[i], SCULPT_UNDO_MASK);
}
+ const int step = direction == MASK_FILTER_STEP_DIRECTION_FORWARD? 1 : -1;
if (sculpt_ipmask_filter_uses_apply_from_original(filter_type)) {
- sculpt_ipmask_apply_from_original_mask_data(ob, filter_type, strength);
+ sculpt_ipmask_apply_from_original_mask_data(ob, filter_type, step * strength);
}
else {
sculpt_ipmask_filter_update_to_target_step(
- ss, 1, iteration_count, 0.0f);
+ ss, step, iteration_count, 0.0f);
}
for (int i = 0; i < totnode; i++) {
@@ -1117,6 +1119,12 @@ static EnumPropertyItem prop_ipmask_filter_direction_types[] = {
IPMASK_FILTER_GROW_SHRINK,
"Type",
"Filter that is going to be applied to the mask");
+ RNA_def_enum(ot->srna,
+ "direction",
+ prop_ipmask_filter_direction_types,
+ MASK_FILTER_STEP_DIRECTION_FORWARD,
+ "Direction",
+ "Direction to apply the filter step");
RNA_def_int(ot->srna,
"iterations",
1,
More information about the Bf-blender-cvs
mailing list