Sculp IPMask: Property to enable/disable step interpolation

This commit is contained in:
Pablo Dobarro 2021-03-03 17:29:24 +01:00
parent 2fd22fd663
commit ca60d520d9
2 changed files with 5 additions and 1 deletions

View File

@ -1486,6 +1486,7 @@ class _defs_sculpt:
props = tool.operator_properties("sculpt.ipmask_filter")
layout.prop(props, "filter_type", expand=False)
layout.prop(props, "iterations", expand=False)
layout.prop(props, "use_step_interpolation", expand=False)
return dict(
idname="builtin.ipmask_filter",

View File

@ -946,6 +946,7 @@ static int sculpt_ipmask_filter_modal(bContext *C, wmOperator *op, const wmEvent
SculptSession *ss = ob->sculpt;
FilterCache *filter_cache = ss->filter_cache;
const int filter_type = RNA_enum_get(op->ptr, "filter_type");
const bool use_step_interpolation = RNA_boolean_get(op->ptr, "use_step_interpolation");
const int iteration_count = RNA_int_get(op->ptr, "iterations");
if ((event->type == EVT_ESCKEY && event->val == KM_PRESS) ||
@ -971,7 +972,7 @@ static int sculpt_ipmask_filter_modal(bContext *C, wmOperator *op, const wmEvent
const float len = event->x - event->prevclickx;
const float target_step_fl = len * IPMASK_FILTER_STEP_SENSITIVITY * UI_DPI_FAC;
const int target_step = floorf(target_step_fl);
const float step_interpolation = target_step_fl - target_step;
const float step_interpolation = use_step_interpolation? target_step_fl - target_step: 0.0f;
const float full_step_strength = target_step_fl / IPMASK_FILTER_STEPS_PER_FULL_STRENGTH;
BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false);
@ -1076,6 +1077,8 @@ void SCULPT_OT_ipmask_filter(struct wmOperatorType *ot)
"Number of times that the filter is going to be applied per step",
1,
100);
RNA_def_boolean(
ot->srna, "use_step_interpolation", true, "Step Interpolation", "Calculate and render intermediate values between multiple full steps of the filter");
}
/******************************************************************************************/