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:
authorCampbell Barton <ideasman42@gmail.com>2018-01-10 11:34:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-01-10 11:34:34 +0300
commitbc02c5de497c360449e4de68b3c1432f9bd204de (patch)
tree111d0c60c82ac0221e47a31846f646aa187348dd /source/blender/editors/sculpt_paint/paint_ops.c
parent3f837341c8f5652f02909d1ebbcf1743ab371847 (diff)
Alternate fix for brush user count
This reverts change to BKE_brush_add, callers now remove the extra user. Note this isn't very convenient for callers but is consistent with other ID types. In the future we will probably remove this and have new ID's created with zero users.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_ops.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 40210d63566..73cb31bb1bd 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -68,10 +68,13 @@ static int brush_add_exec(bContext *C, wmOperator *UNUSED(op))
Main *bmain = CTX_data_main(C);
ePaintMode mode = BKE_paintmode_get_active_from_context(C);
- if (br)
+ if (br) {
br = BKE_brush_copy(bmain, br);
- else
+ }
+ else {
br = BKE_brush_add(bmain, "Brush", BKE_paint_object_mode_from_paint_mode(mode));
+ id_us_min(&br->id); /* fake user only */
+ }
BKE_paint_brush_set(paint, br);
@@ -376,6 +379,7 @@ static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool,
if (!brush && brush_tool(brush_orig, tool_offset) != tool && create_missing) {
brush = BKE_brush_add(bmain, tool_name, ob_mode);
+ id_us_min(&brush->id); /* fake user only */
brush_tool_set(brush, tool_offset, tool);
brush->toggle_brush = brush_orig;
}