diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-06 15:11:01 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-06 15:11:01 +0300 |
commit | d2312602125a452e6562a76ab91779943c67396d (patch) | |
tree | da74fa2bce05d94d6bc800021d837b494e6936d7 /source/blender/blenkernel/intern/image.c | |
parent | b98b331d04fe3a335cc0656809b4b09196507500 (diff) |
Replace of (id->lib != NULL) check by meaningful macro.
Idea is to replace hard-to-track (id->lib != NULL) 'is linked datablock' check everywhere in Blender
by a macro doing the same thing. This will allow to easily spot those checks in future, and more importantly,
to easily change it (see work done in asset-engine branch).
Note: did not touch to readfile.c, since there most of the time 'id->lib' check actually concerns the pointer,
and not a check whether ID is linked or not. Will have a closer look at it later.
Reviewers: campbellbarton, brecht, sergey
Differential Revision: https://developer.blender.org/D2082
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 69384a70969..790b6c6854b 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -457,7 +457,7 @@ Image *BKE_image_copy(Main *bmain, Image *ima) nima->stereo3d_format = MEM_dupallocN(ima->stereo3d_format); BLI_duplicatelist(&nima->views, &ima->views); - if (ima->id.lib) { + if (ID_IS_LINKED_DATABLOCK(ima)) { BKE_id_lib_local_paths(bmain, ima->id.lib, &nima->id); } @@ -483,7 +483,7 @@ void BKE_image_make_local(struct Image *ima) * - mixed: make copy */ - if (ima->id.lib == NULL) return; + if (!ID_IS_LINKED_DATABLOCK(ima)) return; /* Can't take short cut here: must check meshes at least because of bogus * texface ID refs. - z0r */ @@ -497,13 +497,13 @@ void BKE_image_make_local(struct Image *ima) for (tex = bmain->tex.first; tex; tex = tex->id.next) { if (tex->ima == ima) { - if (tex->id.lib) is_lib = true; + if (ID_IS_LINKED_DATABLOCK(tex)) is_lib = true; else is_local = true; } } for (brush = bmain->brush.first; brush; brush = brush->id.next) { if (brush->clone.image == ima) { - if (brush->id.lib) is_lib = true; + if (ID_IS_LINKED_DATABLOCK(brush)) is_lib = true; else is_local = true; } } @@ -518,7 +518,7 @@ void BKE_image_make_local(struct Image *ima) for (a = 0; a < me->totface; a++, tface++) { if (tface->tpage == ima) { - if (me->id.lib) is_lib = true; + if (ID_IS_LINKED_DATABLOCK(me)) is_lib = true; else is_local = true; } } @@ -536,7 +536,7 @@ void BKE_image_make_local(struct Image *ima) for (a = 0; a < me->totpoly; a++, mtpoly++) { if (mtpoly->tpage == ima) { - if (me->id.lib) is_lib = true; + if (ID_IS_LINKED_DATABLOCK(me)) is_lib = true; else is_local = true; } } @@ -560,7 +560,7 @@ void BKE_image_make_local(struct Image *ima) tex = bmain->tex.first; while (tex) { - if (tex->id.lib == NULL) { + if (!ID_IS_LINKED_DATABLOCK(tex)) { if (tex->ima == ima) { tex->ima = ima_new; id_us_plus(&ima_new->id); @@ -571,7 +571,7 @@ void BKE_image_make_local(struct Image *ima) } brush = bmain->brush.first; while (brush) { - if (brush->id.lib == NULL) { + if (!ID_IS_LINKED_DATABLOCK(brush)) { if (brush->clone.image == ima) { brush->clone.image = ima_new; id_us_plus(&ima_new->id); |