diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-11-09 22:59:42 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-11-09 23:00:53 +0300 |
commit | 9c6fe810a3cae2a5498f5760822b7a7e4a82bf4f (patch) | |
tree | fae726eb9d43fe1bf587bd952506954efd7268e4 /source/blender/blenkernel/intern/brush.c | |
parent | f761ae8f116909f1d5c92398f8a4812a5fad8ca4 (diff) |
Fake user: add BKE_library helpers to set/clear that flag.
Since it also involves usercount manipulation, safer and cleaner to do it in BKE_library...
Diffstat (limited to 'source/blender/blenkernel/intern/brush.c')
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 201750df5a7..92ab4d745c1 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -136,7 +136,7 @@ void BKE_brush_init(Brush *brush) BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(brush, id)); /* enable fake user by default */ - brush->id.flag |= LIB_FAKEUSER; + id_fake_user_set(&brush->id); brush_defaults(brush); @@ -193,11 +193,8 @@ Brush *BKE_brush_copy(Brush *brush) brushn->curve = curvemapping_copy(brush->curve); /* enable fake user by default */ - if (!(brushn->id.flag & LIB_FAKEUSER)) { - brushn->id.flag |= LIB_FAKEUSER; - id_us_plus(&brushn->id); - } - + id_fake_user_set(&brush->id); + if (brush->id.lib) { BKE_id_lib_local_paths(G.main, brush->id.lib, &brushn->id); } @@ -280,15 +277,11 @@ void BKE_brush_make_local(Brush *brush) extern_local_brush(brush); /* enable fake user by default */ - if (!(brush->id.flag & LIB_FAKEUSER)) { - brush->id.flag |= LIB_FAKEUSER; - id_us_plus(&brush->id); - } + id_fake_user_set(&brush->id); } else if (is_local && is_lib) { - Brush *brush_new = BKE_brush_copy(brush); + Brush *brush_new = BKE_brush_copy(brush); /* Ensures FAKE_USER is set */ brush_new->id.us = 1; /* only keep fake user */ - brush_new->id.flag |= LIB_FAKEUSER; /* Remap paths of new ID using old library as base. */ BKE_id_lib_local_paths(bmain, brush->id.lib, &brush_new->id); |