diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-11-11 22:18:50 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-11-11 22:21:37 +0300 |
commit | d75bca1842fcea6af3f8b398b498d3e4ab91dbc5 (patch) | |
tree | 023a296cfa67c73346d813fff9b5a3e8f8e7aab2 /source | |
parent | 9cff20e5c6ee9675087bc847964c11a4d565f803 (diff) |
Cleanup: replace more direct id->us handling by calls to BKE_library API.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_draw.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 7 |
6 files changed, 9 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 92ab4d745c1..166c2b26d27 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -281,7 +281,7 @@ void BKE_brush_make_local(Brush *brush) } else if (is_local && is_lib) { Brush *brush_new = BKE_brush_copy(brush); /* Ensures FAKE_USER is set */ - brush_new->id.us = 1; /* only keep fake user */ + id_us_min(&brush_new->id); /* Remove user added by standard BKE_libblock_copy(). */ /* Remap paths of new ID using old library as base. */ BKE_id_lib_local_paths(bmain, brush->id.lib, &brush_new->id); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 9dabe6ba56b..5f2629b3f67 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -585,9 +585,7 @@ void BKE_image_make_local(struct Image *ima) for (a = 0; a < me->totface; a++, tface++) { if (tface->tpage == ima) { tface->tpage = ima_new; - if (ima_new->id.us == 0) { - tface->tpage->id.us = 1; - } + id_us_ensure_real((ID *)ima_new); id_lib_extern((ID *)ima_new); } } @@ -606,9 +604,7 @@ void BKE_image_make_local(struct Image *ima) for (a = 0; a < me->totpoly; a++, mtpoly++) { if (mtpoly->tpage == ima) { mtpoly->tpage = ima_new; - if (ima_new->id.us == 0) { - mtpoly->tpage->id.us = 1; - } + id_us_ensure_real((ID *)ima_new); id_lib_extern((ID *)ima_new); } } diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 6e41ed3f9a6..988da05d35c 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -428,7 +428,6 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const } ta = BKE_libblock_alloc(bmain, ID_TXT, BLI_path_basename(str)); - ta->id.us = 1; BLI_listbase_clear(&ta->lines); ta->curl = ta->sell = NULL; diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index a89ef8b7e85..4bb541b2de1 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2184,10 +2184,7 @@ static bool make_local_all__instance_indirect_unused(Main *bmain, Scene *scene) if (ob->id.lib && (ob->id.us == 0)) { Base *base; - ob->id.us = 1; - - /* not essential, but for correctness */ - id_lib_extern(&ob->id); + id_us_plus(&ob->id); base = BKE_scene_base_add(scene, ob); base->flag |= SELECT; diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 283457d1fc6..b4ab516ed5c 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -45,6 +45,7 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" +#include "BKE_library.h" #include "BKE_main.h" #include "BKE_node.h" @@ -85,9 +86,7 @@ void ED_node_tree_update(const bContext *C) if (snode) { snode_set_context(C); - if (snode->nodetree && snode->nodetree->id.us == 0) { - snode->nodetree->id.us = 1; - } + id_us_ensure_real(&snode->nodetree->id); } } diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index ce03c24e2ab..64b287543d4 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -44,6 +44,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_library.h" #include "BKE_main.h" #include "BKE_sequencer.h" #include "BKE_movieclip.h" @@ -385,8 +386,7 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op) seq->blend_mode = SEQ_TYPE_CROSS; seq->clip = clip; - if (seq->clip->id.us == 0) - seq->clip->id.us = 1; + id_us_ensure_real(&seq->clip->id); /* basic defaults */ seq->strip = strip = MEM_callocN(sizeof(Strip), "strip"); @@ -470,8 +470,7 @@ static int sequencer_add_mask_strip_exec(bContext *C, wmOperator *op) seq->blend_mode = SEQ_TYPE_CROSS; seq->mask = mask; - if (seq->mask->id.us == 0) - seq->mask->id.us = 1; + id_us_ensure_real(&seq->mask->id); /* basic defaults */ seq->strip = strip = MEM_callocN(sizeof(Strip), "strip"); |