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:
authorHans Goudey <h.goudey@me.com>2022-05-17 14:06:14 +0300
committerHans Goudey <h.goudey@me.com>2022-05-17 14:06:14 +0300
commited62b65474f007025bc19d1f8758257b12cbc8b3 (patch)
treeaf034e94cc54b9acfd0ecbc632eed19bee4956c3 /source/blender/editors/sculpt_paint/curves_sculpt_intern.hh
parent3ad5510427002a299e6d6b1856da2f910a116a82 (diff)
Cleanup: Use const in curves sculpt code
This makes it much clearer what data is supposed to be modified and what data is just used to influence the operation. The new `BKE_paint_brush_for_read` function isn't great design, but it can be removed or renamed if similar changes are applied to more places. Also pass pointers explicitly to `sample_curves_3d_brush` rather than reusing the `bContext`. This makes it clearer what data the function actually needs. Differential Revision: https://developer.blender.org/D14967
Diffstat (limited to 'source/blender/editors/sculpt_paint/curves_sculpt_intern.hh')
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_intern.hh18
1 files changed, 12 insertions, 6 deletions
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_intern.hh b/source/blender/editors/sculpt_paint/curves_sculpt_intern.hh
index 9d000649d62..00e7213b5e6 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_intern.hh
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_intern.hh
@@ -13,6 +13,8 @@
struct ARegion;
struct RegionView3D;
+struct Depsgraph;
+struct View3D;
struct Object;
namespace blender::ed::sculpt_paint {
@@ -30,15 +32,16 @@ struct StrokeExtension {
class CurvesSculptStrokeOperation {
public:
virtual ~CurvesSculptStrokeOperation() = default;
- virtual void on_stroke_extended(bContext *C, const StrokeExtension &stroke_extension) = 0;
+ virtual void on_stroke_extended(const bContext &C, const StrokeExtension &stroke_extension) = 0;
};
-std::unique_ptr<CurvesSculptStrokeOperation> new_add_operation(bContext &C, ReportList *reports);
+std::unique_ptr<CurvesSculptStrokeOperation> new_add_operation(const bContext &C,
+ ReportList *reports);
std::unique_ptr<CurvesSculptStrokeOperation> new_comb_operation();
std::unique_ptr<CurvesSculptStrokeOperation> new_delete_operation();
std::unique_ptr<CurvesSculptStrokeOperation> new_snake_hook_operation();
std::unique_ptr<CurvesSculptStrokeOperation> new_grow_shrink_operation(
- const BrushStrokeMode brush_mode, bContext *C);
+ const BrushStrokeMode brush_mode, const bContext &C);
struct CurvesBrush3D {
float3 position_cu;
@@ -48,10 +51,13 @@ struct CurvesBrush3D {
/**
* Find 3d brush position based on cursor position for curves sculpting.
*/
-std::optional<CurvesBrush3D> sample_curves_3d_brush(bContext &C,
- Object &curves_object,
+std::optional<CurvesBrush3D> sample_curves_3d_brush(const Depsgraph &depsgraph,
+ const ARegion &region,
+ const View3D &v3d,
+ const RegionView3D &rv3d,
+ const Object &curves_object,
const float2 &brush_pos_re,
- float brush_radius_re);
+ const float brush_radius_re);
Vector<float4x4> get_symmetry_brush_transforms(eCurvesSymmetryType symmetry);