diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-11 20:39:34 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-11 22:30:02 +0300 |
commit | 13f0b59f1180042b07f439d36841a52a6ddcd75e (patch) | |
tree | 29c32ac5edaaf896d6f9d4ff29ecb81a1654feaa /source/blender/blenkernel/intern/brush.c | |
parent | 2ec17e655c4fdabc6251b5c81f4404451160923c (diff) |
Use new generic BKE_id_expand_local() for both make_local() and copy() functions of actions, brushes and particles.
This greatly simplifies said code, once again no change expected from user PoV.
Diffstat (limited to 'source/blender/blenkernel/intern/brush.c')
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index ee7af7e6dd1..814934a9190 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -178,15 +178,6 @@ Brush *BKE_brush_copy(Main *bmain, Brush *brush) brushn = BKE_libblock_copy(bmain, &brush->id); - if (brush->mtex.tex) - id_us_plus((ID *)brush->mtex.tex); - - if (brush->mask_mtex.tex) - id_us_plus((ID *)brush->mask_mtex.tex); - - if (brush->paint_curve) - id_us_plus((ID *)brush->paint_curve); - if (brush->icon_imbuf) brushn->icon_imbuf = IMB_dupImBuf(brush->icon_imbuf); @@ -197,6 +188,8 @@ Brush *BKE_brush_copy(Main *bmain, Brush *brush) /* enable fake user by default */ id_fake_user_set(&brush->id); + BKE_id_expand_local(&brushn->id, true); + if (ID_IS_LINKED_DATABLOCK(brush)) { BKE_id_lib_local_paths(bmain, brush->id.lib, &brushn->id); } @@ -218,21 +211,6 @@ void BKE_brush_free(Brush *brush) BKE_previewimg_free(&(brush->preview)); } -static int extern_local_brush_callback( - void *UNUSED(user_data), struct ID *UNUSED(id_self), struct ID **id_pointer, int cd_flag) -{ - /* We only tag usercounted ID usages as extern... Why? */ - if ((cd_flag & IDWALK_USER) && *id_pointer) { - id_lib_extern(*id_pointer); - } - return IDWALK_RET_NOP; -} - -static void extern_local_brush(Brush *brush) -{ - BKE_library_foreach_ID_link(&brush->id, extern_local_brush_callback, NULL, 0); -} - void BKE_brush_make_local(Main *bmain, Brush *brush) { bool is_local = false, is_lib = false; @@ -256,7 +234,7 @@ void BKE_brush_make_local(Main *bmain, Brush *brush) if (is_local) { if (!is_lib) { id_clear_lib_data(bmain, &brush->id); - extern_local_brush(brush); + BKE_id_expand_local(&brush->id, false); /* enable fake user by default */ id_fake_user_set(&brush->id); |