diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint/curves_sculpt_ops.cc')
-rw-r--r-- | source/blender/editors/sculpt_paint/curves_sculpt_ops.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc index 776da37205c..15d0f73592d 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc @@ -74,6 +74,36 @@ using blender::bke::CurvesGeometry; /** \name * SCULPT_CURVES_OT_brush_stroke * \{ */ +float brush_radius_factor(const Brush &brush, const StrokeExtension &stroke_extension) +{ + if (BKE_brush_use_size_pressure(&brush)) { + return stroke_extension.pressure; + } + return 1.0f; +} + +float brush_radius_get(const Scene &scene, + const Brush &brush, + const StrokeExtension &stroke_extension) +{ + return BKE_brush_size_get(&scene, &brush) * brush_radius_factor(brush, stroke_extension); +} + +float brush_strength_factor(const Brush &brush, const StrokeExtension &stroke_extension) +{ + if (BKE_brush_use_alpha_pressure(&brush)) { + return stroke_extension.pressure; + } + return 1.0f; +} + +float brush_strength_get(const Scene &scene, + const Brush &brush, + const StrokeExtension &stroke_extension) +{ + return BKE_brush_alpha_get(&scene, &brush) * brush_strength_factor(brush, stroke_extension); +} + static std::unique_ptr<CurvesSculptStrokeOperation> start_brush_operation(bContext &C, wmOperator &op) { @@ -128,6 +158,7 @@ static void stroke_update_step(bContext *C, StrokeExtension stroke_extension; RNA_float_get_array(stroke_element, "mouse", stroke_extension.mouse_position); + stroke_extension.pressure = RNA_float_get(stroke_element, "pressure"); if (!op_data->operation) { stroke_extension.is_first = true; |