diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-08-31 21:37:38 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-08-31 22:00:30 +0300 |
commit | 333feea6e9450379f5314f327cf1ac1aef6d8a07 (patch) | |
tree | 733c5da53fbae58268a4c1d68beb2fc383ad5187 /source/blender/blenkernel/intern/brush.c | |
parent | 0018483dfaf96af569fad40bed6f47389ef3358f (diff) |
Fix T45258, impossible to select brush when removing it from 2d
painting.
Also system added a brush every time it found no paint brush in the
system which is not what we would want.
Solution:
* Brush panel stays visible always, regardless of whether there is a
brush or not.
* We search for first available brush when we find no brush in paint
struct instead of always generating a new one.
* Generating and searching for a brush take a mode argument now. Needed
some refactoring to users of BKE_paint_init as well.
* Did some style cleanups for paint mode enums.
Patch is big but it's mostly argument refactoring.
Diffstat (limited to 'source/blender/blenkernel/intern/brush.c')
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index c7bb6d4f5ce..e0ffd830804 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -131,7 +131,7 @@ static void brush_defaults(Brush *brush) /* Datablock add/copy/free/make_local */ -Brush *BKE_brush_add(Main *bmain, const char *name) +Brush *BKE_brush_add(Main *bmain, const char *name, short ob_mode) { Brush *brush; @@ -143,6 +143,7 @@ Brush *BKE_brush_add(Main *bmain, const char *name) brush_defaults(brush); brush->sculpt_tool = SCULPT_TOOL_DRAW; /* sculpting defaults to the draw tool for new brushes */ + brush->ob_mode = ob_mode; /* the default alpha falloff curve */ BKE_brush_curve_preset(brush, CURVE_PRESET_SMOOTH); @@ -150,6 +151,17 @@ Brush *BKE_brush_add(Main *bmain, const char *name) return brush; } +struct Brush *BKE_brush_first_search(struct Main *bmain, short ob_mode) +{ + Brush *brush; + + for (brush = bmain->brush.first; brush; brush = brush->id.next) { + if (brush->ob_mode & ob_mode) + return brush; + } + return NULL; +} + Brush *BKE_brush_copy(Brush *brush) { Brush *brushn; |