diff options
author | Hans Goudey <h.goudey@me.com> | 2022-05-17 14:06:14 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-05-17 14:06:14 +0300 |
commit | ed62b65474f007025bc19d1f8758257b12cbc8b3 (patch) | |
tree | af034e94cc54b9acfd0ecbc632eed19bee4956c3 /source/blender/blenkernel | |
parent | 3ad5510427002a299e6d6b1856da2f910a116a82 (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/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_paint.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/paint.c | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 03cbcf575c3..c39ab22ce3a 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -180,6 +180,7 @@ struct Paint *BKE_paint_get_active_from_context(const struct bContext *C); ePaintMode BKE_paintmode_get_active_from_context(const struct bContext *C); ePaintMode BKE_paintmode_get_from_tool(const struct bToolRef *tref); struct Brush *BKE_paint_brush(struct Paint *paint); +const struct Brush *BKE_paint_brush_for_read(const struct Paint *p); void BKE_paint_brush_set(struct Paint *paint, struct Brush *br); struct Palette *BKE_paint_palette(struct Paint *paint); void BKE_paint_palette_set(struct Paint *p, struct Palette *palette); diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index caada8da0de..cff7eb20b05 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -606,6 +606,11 @@ ePaintMode BKE_paintmode_get_from_tool(const struct bToolRef *tref) Brush *BKE_paint_brush(Paint *p) { + return (Brush *)BKE_paint_brush_for_read((const Paint *)p); +} + +const Brush *BKE_paint_brush_for_read(const Paint *p) +{ return p ? p->brush : NULL; } |