diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-11-27 13:28:22 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-11-27 13:29:38 +0300 |
commit | 50128e8e79bff560d0da6825663543c82286ab17 (patch) | |
tree | c8ad2b52118f1e29674493cfac32072d64ada4d3 /source/blender/editors/sculpt_paint/paint_ops.c | |
parent | 0281411b482e718922fe446f03caca8c7fadb9a9 (diff) |
Avoid Brush user count increase when duplicates the Brush
When you create a new Brush, the user count is `2` (caller and fake user). The problem is when you duplicate a Brush, the user count grows to `3` and this is not correct, because is a new brush.
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D6310
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_ops.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index d76403521d9..6252741799a 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -69,8 +69,8 @@ static int brush_add_exec(bContext *C, wmOperator *UNUSED(op)) } else { br = BKE_brush_add(bmain, "Brush", BKE_paint_object_mode_from_paintmode(mode)); - id_us_min(&br->id); /* fake user only */ } + id_us_min(&br->id); /* fake user only */ BKE_paint_brush_set(paint, br); @@ -104,12 +104,13 @@ static int brush_add_gpencil_exec(bContext *C, wmOperator *UNUSED(op)) } else { br = BKE_brush_add(bmain, "Brush", OB_MODE_PAINT_GPENCIL); - id_us_min(&br->id); /* fake user only */ /* Init grease pencil specific data. */ BKE_brush_init_gpencil_settings(br); } + id_us_min(&br->id); /* fake user only */ + BKE_paint_brush_set(paint, br); return OPERATOR_FINISHED; |