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
This commit is contained in:
parent
0281411b48
commit
50128e8e79
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue