diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-06-27 08:05:19 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-06-27 08:05:19 +0400 |
commit | 308cd73d8b44f0272daf43a425f489f101f55ed6 (patch) | |
tree | a34bb0cf4d0ae1e527ca719ea1a5b69e97bb5308 /source/blender/blenkernel/intern/paint.c | |
parent | d7cea716c57a7195312fb327d3294bc8b9981a68 (diff) |
scenes now adjust brush usercounts on copying and freeing, pointed out by Jason Wilkins
Diffstat (limited to 'source/blender/blenkernel/intern/paint.c')
-rw-r--r-- | source/blender/blenkernel/intern/paint.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 5be492d1108..d00eb6192da 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -85,8 +85,11 @@ Brush *paint_brush(Paint *p) void paint_brush_set(Paint *p, Brush *br) { - if(p) + if(p) { + id_us_min((ID *)p->brush); + id_us_plus((ID *)br); p->brush= br; + } } int paint_facesel_test(Object *ob) @@ -110,12 +113,17 @@ void paint_init(Paint *p, const char col[3]) p->flags |= PAINT_SHOW_BRUSH; } -void free_paint(Paint *UNUSED(paint)) +void free_paint(Paint *paint) { - /* nothing */ + id_us_min((ID *)paint->brush); } +/* called when copying scene settings, so even if 'src' and 'tar' are the same + * still do a id_us_plus(), rather then if we were copying betweem 2 existing + * scenes where a matching value should decrease the existing user count as + * with paint_brush_set() */ void copy_paint(Paint *src, Paint *tar) { tar->brush= src->brush; + id_us_plus((ID *)tar->brush); } |