Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-07-06 15:11:01 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-07-06 15:11:01 +0300
commitd2312602125a452e6562a76ab91779943c67396d (patch)
treeda74fa2bce05d94d6bc800021d837b494e6936d7 /source/blender/blenkernel
parentb98b331d04fe3a335cc0656809b4b09196507500 (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')
-rw-r--r--source/blender/blenkernel/intern/action.c8
-rw-r--r--source/blender/blenkernel/intern/armature.c8
-rw-r--r--source/blender/blenkernel/intern/armature_update.c2
-rw-r--r--source/blender/blenkernel/intern/bpath.c2
-rw-r--r--source/blender/blenkernel/intern/brush.c8
-rw-r--r--source/blender/blenkernel/intern/camera.c8
-rw-r--r--source/blender/blenkernel/intern/constraint.c2
-rw-r--r--source/blender/blenkernel/intern/curve.c8
-rw-r--r--source/blender/blenkernel/intern/group.c2
-rw-r--r--source/blender/blenkernel/intern/image.c16
-rw-r--r--source/blender/blenkernel/intern/key.c2
-rw-r--r--source/blender/blenkernel/intern/lamp.c8
-rw-r--r--source/blender/blenkernel/intern/lattice.c8
-rw-r--r--source/blender/blenkernel/intern/library.c12
-rw-r--r--source/blender/blenkernel/intern/library_query.c2
-rw-r--r--source/blender/blenkernel/intern/linestyle.c2
-rw-r--r--source/blender/blenkernel/intern/mask.c2
-rw-r--r--source/blender/blenkernel/intern/material.c32
-rw-r--r--source/blender/blenkernel/intern/mball.c8
-rw-r--r--source/blender/blenkernel/intern/mesh.c8
-rw-r--r--source/blender/blenkernel/intern/modifier.c2
-rw-r--r--source/blender/blenkernel/intern/node.c6
-rw-r--r--source/blender/blenkernel/intern/object.c22
-rw-r--r--source/blender/blenkernel/intern/object_update.c4
-rw-r--r--source/blender/blenkernel/intern/packedFile.c6
-rw-r--r--source/blender/blenkernel/intern/particle.c8
-rw-r--r--source/blender/blenkernel/intern/speaker.c8
-rw-r--r--source/blender/blenkernel/intern/text.c2
-rw-r--r--source/blender/blenkernel/intern/texture.c32
-rw-r--r--source/blender/blenkernel/intern/world.c8
30 files changed, 123 insertions, 123 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 46ee8a4d888..9d6b2a05681 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -107,7 +107,7 @@ static void make_localact_init_cb(ID *id, AnimData *adt, void *mlac_ptr)
tMakeLocalActionContext *mlac = (tMakeLocalActionContext *)mlac_ptr;
if (adt->action == mlac->act) {
- if (id->lib) mlac->is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(id)) mlac->is_lib = true;
else mlac->is_local = true;
}
}
@@ -118,7 +118,7 @@ static void make_localact_apply_cb(ID *id, AnimData *adt, void *mlac_ptr)
tMakeLocalActionContext *mlac = (tMakeLocalActionContext *)mlac_ptr;
if (adt->action == mlac->act) {
- if (id->lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(id)) {
adt->action = mlac->act_new;
id_us_plus(&mlac->act_new->id);
@@ -133,7 +133,7 @@ void BKE_action_make_local(bAction *act)
tMakeLocalActionContext mlac = {act, NULL, false, false};
Main *bmain = G.main;
- if (act->id.lib == NULL)
+ if (!ID_IS_LINKED_DATABLOCK(act))
return;
/* XXX: double-check this; it used to be just single-user check, but that was when fake-users were still default */
@@ -213,7 +213,7 @@ bAction *BKE_action_copy(bAction *src)
}
}
- if (src->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(src)) {
BKE_id_lib_local_paths(G.main, src->id.lib, &dst->id);
}
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index b59618f46b2..572490f937c 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -148,7 +148,7 @@ void BKE_armature_make_local(bArmature *arm)
bool is_local = false, is_lib = false;
Object *ob;
- if (arm->id.lib == NULL)
+ if (!ID_IS_LINKED_DATABLOCK(arm))
return;
if (arm->id.us == 1) {
id_clear_lib_data(bmain, &arm->id);
@@ -157,7 +157,7 @@ void BKE_armature_make_local(bArmature *arm)
for (ob = bmain->object.first; ob && ELEM(0, is_lib, is_local); ob = ob->id.next) {
if (ob->data == arm) {
- if (ob->id.lib)
+ if (ID_IS_LINKED_DATABLOCK(ob))
is_lib = true;
else
is_local = true;
@@ -176,7 +176,7 @@ void BKE_armature_make_local(bArmature *arm)
for (ob = bmain->object.first; ob; ob = ob->id.next) {
if (ob->data == arm) {
- if (ob->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(ob)) {
ob->data = arm_new;
id_us_plus(&arm_new->id);
id_us_min(&arm->id);
@@ -231,7 +231,7 @@ bArmature *BKE_armature_copy(bArmature *arm)
newArm->act_edbone = NULL;
newArm->sketch = NULL;
- if (arm->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(arm)) {
BKE_id_lib_local_paths(G.main, arm->id.lib, &newArm->id);
}
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index 826bb12a912..ece17335fa0 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -696,7 +696,7 @@ void BKE_pose_eval_flush(EvaluationContext *UNUSED(eval_ctx),
void BKE_pose_eval_proxy_copy(EvaluationContext *UNUSED(eval_ctx), Object *ob)
{
- BLI_assert(ob->id.lib != NULL && ob->proxy_from != NULL);
+ BLI_assert(ID_IS_LINKED_DATABLOCK(ob) && ob->proxy_from != NULL);
DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
if (BKE_pose_copy_result(ob->pose, ob->proxy_from->pose) == false) {
printf("Proxy copy error, lib Object: %s proxy Object: %s\n",
diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index 76544e5ed42..a708c59fa97 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -424,7 +424,7 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int
{
const char *absbase = (flag & BKE_BPATH_TRAVERSE_ABS) ? ID_BLEND_PATH(bmain, id) : NULL;
- if ((flag & BKE_BPATH_TRAVERSE_SKIP_LIBRARY) && id->lib) {
+ if ((flag & BKE_BPATH_TRAVERSE_SKIP_LIBRARY) && ID_IS_LINKED_DATABLOCK(id)) {
return;
}
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 44cacffb71f..4a5be1d3d92 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -195,7 +195,7 @@ Brush *BKE_brush_copy(Brush *brush)
/* enable fake user by default */
id_fake_user_set(&brush->id);
- if (brush->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(brush)) {
BKE_id_lib_local_paths(G.main, brush->id.lib, &brushn->id);
}
@@ -237,7 +237,7 @@ void BKE_brush_make_local(Brush *brush)
Scene *scene;
bool is_local = false, is_lib = false;
- if (brush->id.lib == NULL) return;
+ if (!ID_IS_LINKED_DATABLOCK(brush)) return;
if (brush->clone.image) {
/* special case: ima always local immediately. Clone image should only
@@ -248,7 +248,7 @@ void BKE_brush_make_local(Brush *brush)
for (scene = bmain->scene.first; scene && ELEM(0, is_lib, is_local); scene = scene->id.next) {
if (BKE_paint_brush(&scene->toolsettings->imapaint.paint) == brush) {
- if (scene->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(scene)) is_lib = true;
else is_local = true;
}
}
@@ -269,7 +269,7 @@ void BKE_brush_make_local(Brush *brush)
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
if (BKE_paint_brush(&scene->toolsettings->imapaint.paint) == brush) {
- if (scene->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(scene)) {
BKE_paint_brush_set(&scene->toolsettings->imapaint.paint, brush_new);
}
}
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index eabee742327..9fd2c2ddd14 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -99,7 +99,7 @@ Camera *BKE_camera_copy(Camera *cam)
id_lib_extern((ID *)camn->dof_ob);
- if (cam->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(cam)) {
BKE_id_lib_local_paths(G.main, cam->id.lib, &camn->id);
}
@@ -117,7 +117,7 @@ void BKE_camera_make_local(Camera *cam)
* - mixed: make copy
*/
- if (cam->id.lib == NULL) return;
+ if (!ID_IS_LINKED_DATABLOCK(cam)) return;
if (cam->id.us == 1) {
id_clear_lib_data(bmain, &cam->id);
return;
@@ -125,7 +125,7 @@ void BKE_camera_make_local(Camera *cam)
for (ob = bmain->object.first; ob && ELEM(0, is_lib, is_local); ob = ob->id.next) {
if (ob->data == cam) {
- if (ob->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(ob)) is_lib = true;
else is_local = true;
}
}
@@ -143,7 +143,7 @@ void BKE_camera_make_local(Camera *cam)
for (ob = bmain->object.first; ob; ob = ob->id.next) {
if (ob->data == cam) {
- if (ob->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(ob)) {
ob->data = cam_new;
id_us_plus(&cam_new->id);
id_us_min(&cam->id);
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index c88b24aa381..4c9ddd495e3 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -4649,7 +4649,7 @@ void BKE_constraints_id_loop(ListBase *conlist, ConstraintIDFunc func, void *use
/* helper for BKE_constraints_copy(), to be used for making sure that ID's are valid */
static void con_extern_cb(bConstraint *UNUSED(con), ID **idpoin, bool UNUSED(is_reference), void *UNUSED(userData))
{
- if (*idpoin && (*idpoin)->lib)
+ if (*idpoin && ID_IS_LINKED_DATABLOCK(*idpoin))
id_lib_extern(*idpoin);
}
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index c52b0f6a884..face3ae112f 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -207,7 +207,7 @@ Curve *BKE_curve_copy(Curve *cu)
id_us_plus((ID *)cun->vfonti);
id_us_plus((ID *)cun->vfontbi);
- if (cu->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(cu)) {
BKE_id_lib_local_paths(G.main, cu->id.lib, &cun->id);
}
@@ -237,7 +237,7 @@ void BKE_curve_make_local(Curve *cu)
* - mixed: do a copy
*/
- if (cu->id.lib == NULL)
+ if (!ID_IS_LINKED_DATABLOCK(cu))
return;
if (cu->id.us == 1) {
@@ -248,7 +248,7 @@ void BKE_curve_make_local(Curve *cu)
for (ob = bmain->object.first; ob && ELEM(0, is_lib, is_local); ob = ob->id.next) {
if (ob->data == cu) {
- if (ob->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(ob)) is_lib = true;
else is_local = true;
}
}
@@ -265,7 +265,7 @@ void BKE_curve_make_local(Curve *cu)
for (ob = bmain->object.first; ob; ob = ob->id.next) {
if (ob->data == cu) {
- if (ob->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(ob)) {
ob->data = cu_new;
id_us_plus(&cu_new->id);
id_us_min(&cu->id);
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index 4fdee7e3633..ce7ef1f710a 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -97,7 +97,7 @@ Group *BKE_group_copy(Group *group)
/* Do not copy group's preview (same behavior as for objects). */
groupn->preview = NULL;
- if (group->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(group)) {
BKE_id_lib_local_paths(G.main, group->id.lib, &groupn->id);
}
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);
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 2517e2cc197..79d42ed6e06 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -171,7 +171,7 @@ Key *BKE_key_copy(Key *key)
kb = kb->next;
}
- if (key->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(key)) {
BKE_id_lib_local_paths(G.main, key->id.lib, &keyn->id);
}
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index 692b703f721..43396834650 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -137,7 +137,7 @@ Lamp *BKE_lamp_copy(Lamp *la)
if (la->preview)
lan->preview = BKE_previewimg_copy(la->preview);
- if (la->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(la)) {
BKE_id_lib_local_paths(G.main, la->id.lib, &lan->id);
}
@@ -181,7 +181,7 @@ void BKE_lamp_make_local(Lamp *la)
* - mixed: make copy
*/
- if (la->id.lib == NULL) return;
+ if (!ID_IS_LINKED_DATABLOCK(la)) return;
if (la->id.us == 1) {
id_clear_lib_data(bmain, &la->id);
return;
@@ -190,7 +190,7 @@ void BKE_lamp_make_local(Lamp *la)
ob = bmain->object.first;
while (ob) {
if (ob->data == la) {
- if (ob->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(ob)) is_lib = true;
else is_local = true;
}
ob = ob->id.next;
@@ -210,7 +210,7 @@ void BKE_lamp_make_local(Lamp *la)
while (ob) {
if (ob->data == la) {
- if (ob->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(ob)) {
ob->data = la_new;
id_us_plus(&la_new->id);
id_us_min(&la->id);
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 58c0a567116..07e6ba9062e 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -293,7 +293,7 @@ Lattice *BKE_lattice_copy(Lattice *lt)
ltn->editlatt = NULL;
- if (lt->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(lt)) {
BKE_id_lib_local_paths(G.main, lt->id.lib, &ltn->id);
}
@@ -336,7 +336,7 @@ void BKE_lattice_make_local(Lattice *lt)
* - mixed: make copy
*/
- if (lt->id.lib == NULL) return;
+ if (!ID_IS_LINKED_DATABLOCK(lt)) return;
if (lt->id.us == 1) {
id_clear_lib_data(bmain, &lt->id);
return;
@@ -344,7 +344,7 @@ void BKE_lattice_make_local(Lattice *lt)
for (ob = bmain->object.first; ob && ELEM(false, is_lib, is_local); ob = ob->id.next) {
if (ob->data == lt) {
- if (ob->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(ob)) is_lib = true;
else is_local = true;
}
}
@@ -361,7 +361,7 @@ void BKE_lattice_make_local(Lattice *lt)
for (ob = bmain->object.first; ob; ob = ob->id.next) {
if (ob->data == lt) {
- if (ob->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(ob)) {
ob->data = lt_new;
id_us_plus(&lt_new->id);
id_us_min(&lt->id);
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index fe16df18813..553dd1761b8 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -630,7 +630,7 @@ void BKE_main_lib_objects_recalc_all(Main *bmain)
/* flag for full recalc */
for (ob = bmain->object.first; ob; ob = ob->id.next) {
- if (ob->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(ob)) {
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
}
}
@@ -1061,7 +1061,7 @@ static int id_relink_looper(void *UNUSED(user_data), ID *UNUSED(self_id), ID **i
void BKE_libblock_relink(ID *id)
{
- if (id->lib)
+ if (ID_IS_LINKED_DATABLOCK(id))
return;
BKE_library_foreach_ID_link(id, id_relink_looper, NULL, 0);
@@ -1275,7 +1275,7 @@ static ID *is_dupid(ListBase *lb, ID *id, const char *name)
for (idtest = lb->first; idtest; idtest = idtest->next) {
/* if idtest is not a lib */
- if (id != idtest && idtest->lib == NULL) {
+ if (id != idtest && !ID_IS_LINKED_DATABLOCK(idtest)) {
/* do not test alphabetic! */
/* optimized */
if (idtest->name[2] == name[0]) {
@@ -1335,7 +1335,7 @@ static bool check_for_dupid(ListBase *lb, ID *id, char *name)
for (idtest = lb->first; idtest; idtest = idtest->next) {
int nrtest;
if ( (id != idtest) &&
- (idtest->lib == NULL) &&
+ !ID_IS_LINKED_DATABLOCK(idtest) &&
(*name == *(idtest->name + 2)) &&
STREQLEN(name, idtest->name + 2, left_len) &&
(BLI_split_name_num(leftest, &nrtest, idtest->name + 2, '.') == left_len)
@@ -1417,7 +1417,7 @@ bool new_id(ListBase *lb, ID *id, const char *tname)
char name[MAX_ID_NAME - 2];
/* if library, don't rename */
- if (id->lib)
+ if (ID_IS_LINKED_DATABLOCK(id))
return false;
/* if no libdata given, look up based on ID */
@@ -1522,7 +1522,7 @@ static void lib_indirect_test_id(ID *id, const Library *lib)
#define LIBTAG(a) \
if (a && a->id.lib) { a->id.tag &= ~LIB_TAG_INDIRECT; a->id.tag |= LIB_TAG_EXTERN; } (void)0
- if (id->lib) {
+ if (ID_IS_LINKED_DATABLOCK(id)) {
/* datablocks that were indirectly related are now direct links
* without this, appending data that has a link to other data will fail to write */
if (lib && id->lib->parent == lib) {
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index 8373ad0123f..adde5229a9b 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -895,7 +895,7 @@ bool BKE_library_ID_is_indirectly_used(Main *bmain, void *idv)
ID *id_curr = lb_array[i]->first;
for (; id_curr; id_curr = id_curr->next) {
- if (!id_curr->lib) {
+ if (!ID_IS_LINKED_DATABLOCK(id_curr)) {
continue;
}
diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c
index 30dc48819e9..2985038bcae 100644
--- a/source/blender/blenkernel/intern/linestyle.c
+++ b/source/blender/blenkernel/intern/linestyle.c
@@ -218,7 +218,7 @@ FreestyleLineStyle *BKE_linestyle_copy(struct Main *bmain, FreestyleLineStyle *l
for (m = (LineStyleModifier *)linestyle->geometry_modifiers.first; m; m = m->next)
BKE_linestyle_geometry_modifier_copy(new_linestyle, m);
- if (linestyle->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(linestyle)) {
BKE_id_lib_local_paths(G.main, linestyle->id.lib, &new_linestyle->id);
}
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 94e53755ac4..dabdb4c81c6 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -861,7 +861,7 @@ Mask *BKE_mask_copy(Mask *mask)
/* enable fake user by default */
id_fake_user_set(&mask->id);
- if (mask->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(mask)) {
BKE_id_lib_local_paths(G.main, mask->id.lib, &mask_new->id);
}
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index db5ac54ada9..7231620550e 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -245,7 +245,7 @@ Material *BKE_material_copy(Material *ma)
BLI_listbase_clear(&man->gpumaterial);
- if (ma->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(ma)) {
BKE_id_lib_local_paths(G.main, ma->id.lib, &man->id);
}
@@ -305,7 +305,7 @@ void BKE_material_make_local(Material *ma)
* - mixed: make copy
*/
- if (ma->id.lib == NULL) return;
+ if (!ID_IS_LINKED_DATABLOCK(ma)) return;
/* One local user; set flag and return. */
if (ma->id.us == 1) {
@@ -322,7 +322,7 @@ void BKE_material_make_local(Material *ma)
if (ob->mat) {
for (a = 0; a < ob->totcol; a++) {
if (ob->mat[a] == ma) {
- if (ob->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(ob)) is_lib = true;
else is_local = true;
}
}
@@ -335,7 +335,7 @@ void BKE_material_make_local(Material *ma)
if (me->mat) {
for (a = 0; a < me->totcol; a++) {
if (me->mat[a] == ma) {
- if (me->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(me)) is_lib = true;
else is_local = true;
}
}
@@ -348,7 +348,7 @@ void BKE_material_make_local(Material *ma)
if (cu->mat) {
for (a = 0; a < cu->totcol; a++) {
if (cu->mat[a] == ma) {
- if (cu->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(cu)) is_lib = true;
else is_local = true;
}
}
@@ -361,7 +361,7 @@ void BKE_material_make_local(Material *ma)
if (mb->mat) {
for (a = 0; a < mb->totcol; a++) {
if (mb->mat[a] == ma) {
- if (mb->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(mb)) is_lib = true;
else is_local = true;
}
}
@@ -389,7 +389,7 @@ void BKE_material_make_local(Material *ma)
if (ob->mat) {
for (a = 0; a < ob->totcol; a++) {
if (ob->mat[a] == ma) {
- if (ob->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(ob)) {
ob->mat[a] = ma_new;
id_us_plus(&ma_new->id);
id_us_min(&ma->id);
@@ -405,7 +405,7 @@ void BKE_material_make_local(Material *ma)
if (me->mat) {
for (a = 0; a < me->totcol; a++) {
if (me->mat[a] == ma) {
- if (me->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(me)) {
me->mat[a] = ma_new;
id_us_plus(&ma_new->id);
id_us_min(&ma->id);
@@ -421,7 +421,7 @@ void BKE_material_make_local(Material *ma)
if (cu->mat) {
for (a = 0; a < cu->totcol; a++) {
if (cu->mat[a] == ma) {
- if (cu->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(cu)) {
cu->mat[a] = ma_new;
id_us_plus(&ma_new->id);
id_us_min(&ma->id);
@@ -437,7 +437,7 @@ void BKE_material_make_local(Material *ma)
if (mb->mat) {
for (a = 0; a < mb->totcol; a++) {
if (mb->mat[a] == ma) {
- if (mb->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(mb)) {
mb->mat[a] = ma_new;
id_us_plus(&ma_new->id);
id_us_min(&ma->id);
@@ -852,8 +852,8 @@ void assign_material(Object *ob, Material *ma, short act, int assign_type)
if (act < 1) act = 1;
/* prevent crashing when using accidentally */
- BLI_assert(ob->id.lib == NULL);
- if (ob->id.lib) return;
+ BLI_assert(!ID_IS_LINKED_DATABLOCK(ob));
+ if (ID_IS_LINKED_DATABLOCK(ob)) return;
/* test arraylens */
@@ -1121,7 +1121,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
Group *group;
for (group = G.main->group.first; group; group = group->id.next) {
- if (!group->id.lib && STREQ(group->id.name, ma->group->id.name)) {
+ if (!ID_IS_LINKED_DATABLOCK(group) && STREQ(group->id.name, ma->group->id.name)) {
ma->group = group;
}
}
@@ -2230,7 +2230,7 @@ int do_version_tface(Main *main)
/* 1st part: marking mesh materials to update */
for (me = main->mesh.first; me; me = me->id.next) {
- if (me->id.lib) continue;
+ if (ID_IS_LINKED_DATABLOCK(me)) continue;
/* get the active tface layer */
index = CustomData_get_active_layer_index(&me->fdata, CD_MTFACE);
@@ -2284,7 +2284,7 @@ int do_version_tface(Main *main)
* at doversion time: direct_link might not have happened on it,
* so ma->mtex is not pointing to valid memory yet.
* later we could, but it's better not */
- else if (ma->id.lib)
+ else if (ID_IS_LINKED_DATABLOCK(ma))
continue;
/* material already marked as disputed */
@@ -2349,7 +2349,7 @@ int do_version_tface(Main *main)
/* we shouldn't loop through the materials created in the loop. make the loop stop at its original length) */
for (ma = main->mat.first, a = 0; ma; ma = ma->id.next, a++) {
- if (ma->id.lib) continue;
+ if (ID_IS_LINKED_DATABLOCK(ma)) continue;
/* disputed material */
if (ma->game.flag == MAT_BGE_DISPUTED) {
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 685cd35fc20..877937eb726 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -117,7 +117,7 @@ MetaBall *BKE_mball_copy(MetaBall *mb)
mbn->editelems = NULL;
mbn->lastelem = NULL;
- if (mb->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(mb)) {
BKE_id_lib_local_paths(G.main, mb->id.lib, &mbn->id);
}
@@ -142,7 +142,7 @@ void BKE_mball_make_local(MetaBall *mb)
* - mixed: make copy
*/
- if (mb->id.lib == NULL) return;
+ if (!ID_IS_LINKED_DATABLOCK(mb)) return;
if (mb->id.us == 1) {
id_clear_lib_data(bmain, &mb->id);
extern_local_mball(mb);
@@ -152,7 +152,7 @@ void BKE_mball_make_local(MetaBall *mb)
for (ob = G.main->object.first; ob && ELEM(0, is_lib, is_local); ob = ob->id.next) {
if (ob->data == mb) {
- if (ob->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(ob)) is_lib = true;
else is_local = true;
}
}
@@ -170,7 +170,7 @@ void BKE_mball_make_local(MetaBall *mb)
for (ob = G.main->object.first; ob; ob = ob->id.next) {
if (ob->data == mb) {
- if (ob->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(ob)) {
ob->data = mb_new;
id_us_plus(&mb_new->id);
id_us_min(&mb->id);
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 706902ef3cf..129f89c2b8e 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -549,7 +549,7 @@ Mesh *BKE_mesh_copy_ex(Main *bmain, Mesh *me)
men->key = BKE_key_copy(me->key);
if (men->key) men->key->from = (ID *)men;
- if (me->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(me)) {
BKE_id_lib_local_paths(bmain, me->id.lib, &men->id);
}
@@ -628,7 +628,7 @@ void BKE_mesh_make_local(Mesh *me)
* - mixed: make copy
*/
- if (me->id.lib == NULL) return;
+ if (!ID_IS_LINKED_DATABLOCK(me)) return;
if (me->id.us == 1) {
id_clear_lib_data(bmain, &me->id);
expand_local_mesh(me);
@@ -637,7 +637,7 @@ void BKE_mesh_make_local(Mesh *me)
for (ob = bmain->object.first; ob && ELEM(0, is_lib, is_local); ob = ob->id.next) {
if (me == ob->data) {
- if (ob->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(ob)) is_lib = true;
else is_local = true;
}
}
@@ -656,7 +656,7 @@ void BKE_mesh_make_local(Mesh *me)
for (ob = bmain->object.first; ob; ob = ob->id.next) {
if (me == ob->data) {
- if (ob->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(ob)) {
BKE_mesh_assign_object(ob, me_new);
}
}
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 716da14cae6..41e4c21d814 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -707,7 +707,7 @@ void test_object_modifiers(Object *ob)
*/
const char *modifier_path_relbase(Object *ob)
{
- if (G.relbase_valid || ob->id.lib) {
+ if (G.relbase_valid || ID_IS_LINKED_DATABLOCK(ob)) {
return ID_BLEND_PATH(G.main, &ob->id);
}
else {
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index d78ddc41e97..cf70159a329 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1289,7 +1289,7 @@ static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, Main *bmain, bool ski
/* node tree will generate its own interface type */
newtree->interface_type = NULL;
- if (ntree->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(ntree)) {
BKE_id_lib_local_paths(bmain, ntree->id.lib, &newtree->id);
}
@@ -1967,7 +1967,7 @@ void ntreeMakeLocal(bNodeTree *ntree, bool id_in_mainlist)
* - mixed: make copy
*/
- if (ntree->id.lib == NULL) return;
+ if (!ID_IS_LINKED_DATABLOCK(ntree)) return;
if (ntree->id.us == 1) {
id_clear_lib_data_ex(bmain, (ID *)ntree, id_in_mainlist);
extern_local_ntree(ntree);
@@ -2715,7 +2715,7 @@ void BKE_node_clipboard_add_node(bNode *node)
node_info->id = node->id;
if (node->id) {
BLI_strncpy(node_info->id_name, node->id->name, sizeof(node_info->id_name));
- if (node->id->lib) {
+ if (ID_IS_LINKED_DATABLOCK(node->id)) {
BLI_strncpy(node_info->library_name, node->id->lib->filepath, sizeof(node_info->library_name));
}
else {
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index d4ba70ee0a6..316e74625f0 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1168,7 +1168,7 @@ Object *BKE_object_copy_ex(Main *bmain, Object *ob, bool copy_caches)
/* Copy runtime surve data. */
obn->curve_cache = NULL;
- if (ob->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(ob)) {
BKE_id_lib_local_paths(bmain, ob->id.lib, &obn->id);
}
@@ -1226,7 +1226,7 @@ void BKE_object_make_local(Object *ob)
* - mixed: make copy
*/
- if (ob->id.lib == NULL) return;
+ if (!ID_IS_LINKED_DATABLOCK(ob)) return;
ob->proxy = ob->proxy_from = ob->proxy_group = NULL;
@@ -1237,7 +1237,7 @@ void BKE_object_make_local(Object *ob)
else {
for (sce = bmain->scene.first; sce && ELEM(0, is_lib, is_local); sce = sce->id.next) {
if (BKE_scene_base_find(sce, ob)) {
- if (sce->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(sce)) is_lib = true;
else is_local = true;
}
}
@@ -1256,7 +1256,7 @@ void BKE_object_make_local(Object *ob)
sce = bmain->scene.first;
while (sce) {
- if (sce->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(sce)) {
base = sce->base.first;
while (base) {
if (base->object == ob) {
@@ -1280,7 +1280,7 @@ bool BKE_object_is_libdata(Object *ob)
{
if (!ob) return false;
if (ob->proxy) return false;
- if (ob->id.lib) return true;
+ if (ID_IS_LINKED_DATABLOCK(ob)) return true;
return false;
}
@@ -1288,10 +1288,10 @@ bool BKE_object_is_libdata(Object *ob)
bool BKE_object_obdata_is_libdata(Object *ob)
{
if (!ob) return false;
- if (ob->proxy && (ob->data == NULL || ((ID *)ob->data)->lib == NULL)) return false;
- if (ob->id.lib) return true;
+ if (ob->proxy && (ob->data == NULL || !ID_IS_LINKED_DATABLOCK(ob->data))) return false;
+ if (ID_IS_LINKED_DATABLOCK(ob)) return true;
if (ob->data == NULL) return false;
- if (((ID *)ob->data)->lib) return true;
+ if (ID_IS_LINKED_DATABLOCK(ob->data)) return true;
return false;
}
@@ -1340,7 +1340,7 @@ void BKE_object_copy_proxy_drivers(Object *ob, Object *target)
/* only on local objects because this causes indirect links
* 'a -> b -> c', blend to point directly to a.blend
* when a.blend has a proxy thats linked into c.blend */
- if (ob->id.lib == NULL)
+ if (!ID_IS_LINKED_DATABLOCK(ob))
id_lib_extern((ID *)dtar->id);
}
}
@@ -1358,7 +1358,7 @@ void BKE_object_copy_proxy_drivers(Object *ob, Object *target)
void BKE_object_make_proxy(Object *ob, Object *target, Object *gob)
{
/* paranoia checks */
- if (ob->id.lib || target->id.lib == NULL) {
+ if (ID_IS_LINKED_DATABLOCK(ob) || !ID_IS_LINKED_DATABLOCK(target)) {
printf("cannot make proxy\n");
return;
}
@@ -2735,7 +2735,7 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx,
printf("recalcob %s\n", ob->id.name + 2);
/* handle proxy copy for target */
- if (ob->id.lib && ob->proxy_from) {
+ if (ID_IS_LINKED_DATABLOCK(ob) && ob->proxy_from) {
// printf("ob proxy copy, lib ob %s proxy %s\n", ob->id.name, ob->proxy_from->id.name);
if (ob->proxy_from->proxy_group) { /* transform proxy into group space */
Object *obg = ob->proxy_from->proxy_group;
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index 6d41c5c2975..457263f854b 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -203,7 +203,7 @@ void BKE_object_handle_data_update(EvaluationContext *eval_ctx,
break;
}
case OB_ARMATURE:
- if (ob->id.lib && ob->proxy_from) {
+ if (ID_IS_LINKED_DATABLOCK(ob) && ob->proxy_from) {
if (BKE_pose_copy_result(ob->pose, ob->proxy_from->pose) == false) {
printf("Proxy copy error, lib Object: %s proxy Object: %s\n",
ob->id.name + 2, ob->proxy_from->id.name + 2);
@@ -315,7 +315,7 @@ void BKE_object_eval_uber_transform(EvaluationContext *UNUSED(eval_ctx),
// XXX: it's almost redundant now...
/* Handle proxy copy for target, */
- if (ob->id.lib && ob->proxy_from) {
+ if (ID_IS_LINKED_DATABLOCK(ob) && ob->proxy_from) {
if (ob->proxy_from->proxy_group) {
/* Transform proxy into group space. */
Object *obg = ob->proxy_from->proxy_group;
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index 1c318dfd115..489fc2f3710 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -232,7 +232,7 @@ void packAll(Main *bmain, ReportList *reports, bool verbose)
int tot = 0;
for (ima = bmain->image.first; ima; ima = ima->id.next) {
- if (BKE_image_has_packedfile(ima) == false && ima->id.lib == NULL) {
+ if (BKE_image_has_packedfile(ima) == false && !ID_IS_LINKED_DATABLOCK(ima)) {
if (ima->source == IMA_SRC_FILE) {
BKE_image_packfiles(reports, ima, ID_BLEND_PATH(bmain, &ima->id));
tot ++;
@@ -245,14 +245,14 @@ void packAll(Main *bmain, ReportList *reports, bool verbose)
}
for (vfont = bmain->vfont.first; vfont; vfont = vfont->id.next) {
- if (vfont->packedfile == NULL && vfont->id.lib == NULL && BKE_vfont_is_builtin(vfont) == false) {
+ if (vfont->packedfile == NULL && !ID_IS_LINKED_DATABLOCK(vfont) && BKE_vfont_is_builtin(vfont) == false) {
vfont->packedfile = newPackedFile(reports, vfont->name, bmain->name);
tot ++;
}
}
for (sound = bmain->sound.first; sound; sound = sound->id.next) {
- if (sound->packedfile == NULL && sound->id.lib == NULL) {
+ if (sound->packedfile == NULL && !ID_IS_LINKED_DATABLOCK(sound)) {
sound->packedfile = newPackedFile(reports, sound->name, bmain->name);
tot++;
}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index d1f5afa26a6..4136f866f6a 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3332,7 +3332,7 @@ ParticleSettings *BKE_particlesettings_copy(ParticleSettings *part)
BLI_duplicatelist(&partn->dupliweights, &part->dupliweights);
- if (part->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(part)) {
BKE_id_lib_local_paths(G.main, part->id.lib, &partn->id);
}
@@ -3360,7 +3360,7 @@ void BKE_particlesettings_make_local(ParticleSettings *part)
* - mixed: make copy
*/
- if (part->id.lib == 0) return;
+ if (!ID_IS_LINKED_DATABLOCK(part)) return;
if (part->id.us == 1) {
id_clear_lib_data(bmain, &part->id);
expand_local_particlesettings(part);
@@ -3372,7 +3372,7 @@ void BKE_particlesettings_make_local(ParticleSettings *part)
ParticleSystem *psys = ob->particlesystem.first;
for (; psys; psys = psys->next) {
if (psys->part == part) {
- if (ob->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(ob)) is_lib = true;
else is_local = true;
}
}
@@ -3393,7 +3393,7 @@ void BKE_particlesettings_make_local(ParticleSettings *part)
for (ob = bmain->object.first; ob; ob = ob->id.next) {
ParticleSystem *psys;
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
- if (psys->part == part && ob->id.lib == 0) {
+ if (psys->part == part && !ID_IS_LINKED_DATABLOCK(ob)) {
psys->part = part_new;
id_us_plus(&part_new->id);
id_us_min(&part->id);
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c
index e5075a2d382..58214e4a8d9 100644
--- a/source/blender/blenkernel/intern/speaker.c
+++ b/source/blender/blenkernel/intern/speaker.c
@@ -74,7 +74,7 @@ Speaker *BKE_speaker_copy(Speaker *spk)
if (spkn->sound)
id_us_plus(&spkn->sound->id);
- if (spk->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(spk)) {
BKE_id_lib_local_paths(G.main, spk->id.lib, &spkn->id);
}
@@ -97,7 +97,7 @@ void BKE_speaker_make_local(Speaker *spk)
* - mixed: make copy
*/
- if (spk->id.lib == NULL) return;
+ if (!ID_IS_LINKED_DATABLOCK(spk)) return;
if (spk->id.us == 1) {
id_clear_lib_data(bmain, &spk->id);
extern_local_speaker(spk);
@@ -107,7 +107,7 @@ void BKE_speaker_make_local(Speaker *spk)
ob = bmain->object.first;
while (ob) {
if (ob->data == spk) {
- if (ob->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(ob)) is_lib = true;
else is_local = true;
}
ob = ob->id.next;
@@ -128,7 +128,7 @@ void BKE_speaker_make_local(Speaker *spk)
while (ob) {
if (ob->data == spk) {
- if (ob->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(ob)) {
ob->data = spk_new;
id_us_plus(&spk_new->id);
id_us_min(&spk->id);
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index fdc2edba57f..2b713f980d5 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -491,7 +491,7 @@ Text *BKE_text_copy(Main *bmain, Text *ta)
init_undo_text(tan);
- if (ta->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(ta)) {
BKE_id_lib_local_paths(bmain, ta->id.lib, &tan->id);
}
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 9326ece7a4b..a8657dd2cb0 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -870,7 +870,7 @@ Tex *BKE_texture_copy(Tex *tex)
texn->nodetree = ntreeCopyTree(tex->nodetree);
}
- if (tex->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(tex)) {
BKE_id_lib_local_paths(G.main, tex->id.lib, &texn->id);
}
@@ -935,7 +935,7 @@ void BKE_texture_make_local(Tex *tex)
* - mixed: make copy
*/
- if (tex->id.lib == NULL) return;
+ if (!ID_IS_LINKED_DATABLOCK(tex)) return;
if (tex->id.us == 1) {
id_clear_lib_data(bmain, &tex->id);
@@ -947,7 +947,7 @@ void BKE_texture_make_local(Tex *tex)
while (ma) {
for (a = 0; a < MAX_MTEX; a++) {
if (ma->mtex[a] && ma->mtex[a]->tex == tex) {
- if (ma->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(ma)) is_lib = true;
else is_local = true;
}
}
@@ -957,7 +957,7 @@ void BKE_texture_make_local(Tex *tex)
while (la) {
for (a = 0; a < MAX_MTEX; a++) {
if (la->mtex[a] && la->mtex[a]->tex == tex) {
- if (la->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(la)) is_lib = true;
else is_local = true;
}
}
@@ -967,7 +967,7 @@ void BKE_texture_make_local(Tex *tex)
while (wrld) {
for (a = 0; a < MAX_MTEX; a++) {
if (wrld->mtex[a] && wrld->mtex[a]->tex == tex) {
- if (wrld->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(wrld)) is_lib = true;
else is_local = true;
}
}
@@ -976,11 +976,11 @@ void BKE_texture_make_local(Tex *tex)
br = bmain->brush.first;
while (br) {
if (br->mtex.tex == tex) {
- if (br->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(br)) is_lib = true;
else is_local = true;
}
if (br->mask_mtex.tex == tex) {
- if (br->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(br)) is_lib = true;
else is_local = true;
}
br = br->id.next;
@@ -989,7 +989,7 @@ void BKE_texture_make_local(Tex *tex)
while (pa) {
for (a = 0; a < MAX_MTEX; a++) {
if (pa->mtex[a] && pa->mtex[a]->tex == tex) {
- if (pa->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(pa)) is_lib = true;
else is_local = true;
}
}
@@ -999,7 +999,7 @@ void BKE_texture_make_local(Tex *tex)
while (ls) {
for (a = 0; a < MAX_MTEX; a++) {
if (ls->mtex[a] && ls->mtex[a]->tex == tex) {
- if (ls->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(ls)) is_lib = true;
else is_local = true;
}
}
@@ -1022,7 +1022,7 @@ void BKE_texture_make_local(Tex *tex)
while (ma) {
for (a = 0; a < MAX_MTEX; a++) {
if (ma->mtex[a] && ma->mtex[a]->tex == tex) {
- if (ma->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(ma)) {
ma->mtex[a]->tex = tex_new;
id_us_plus(&tex_new->id);
id_us_min(&tex->id);
@@ -1035,7 +1035,7 @@ void BKE_texture_make_local(Tex *tex)
while (la) {
for (a = 0; a < MAX_MTEX; a++) {
if (la->mtex[a] && la->mtex[a]->tex == tex) {
- if (la->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(la)) {
la->mtex[a]->tex = tex_new;
id_us_plus(&tex_new->id);
id_us_min(&tex->id);
@@ -1048,7 +1048,7 @@ void BKE_texture_make_local(Tex *tex)
while (wrld) {
for (a = 0; a < MAX_MTEX; a++) {
if (wrld->mtex[a] && wrld->mtex[a]->tex == tex) {
- if (wrld->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(wrld)) {
wrld->mtex[a]->tex = tex_new;
id_us_plus(&tex_new->id);
id_us_min(&tex->id);
@@ -1060,14 +1060,14 @@ void BKE_texture_make_local(Tex *tex)
br = bmain->brush.first;
while (br) {
if (br->mtex.tex == tex) {
- if (br->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(br)) {
br->mtex.tex = tex_new;
id_us_plus(&tex_new->id);
id_us_min(&tex->id);
}
}
if (br->mask_mtex.tex == tex) {
- if (br->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(br)) {
br->mask_mtex.tex = tex_new;
id_us_plus(&tex_new->id);
id_us_min(&tex->id);
@@ -1079,7 +1079,7 @@ void BKE_texture_make_local(Tex *tex)
while (pa) {
for (a = 0; a < MAX_MTEX; a++) {
if (pa->mtex[a] && pa->mtex[a]->tex == tex) {
- if (pa->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(pa)) {
pa->mtex[a]->tex = tex_new;
id_us_plus(&tex_new->id);
id_us_min(&tex->id);
@@ -1092,7 +1092,7 @@ void BKE_texture_make_local(Tex *tex)
while (ls) {
for (a = 0; a < MAX_MTEX; a++) {
if (ls->mtex[a] && ls->mtex[a]->tex == tex) {
- if (ls->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(ls)) {
ls->mtex[a]->tex = tex_new;
id_us_plus(&tex_new->id);
id_us_min(&tex->id);
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index ec021586be5..c6ab843b38a 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -141,7 +141,7 @@ World *BKE_world_copy(World *wrld)
BLI_listbase_clear(&wrldn->gpumaterial);
- if (wrld->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(wrld)) {
BKE_id_lib_local_paths(G.main, wrld->id.lib, &wrldn->id);
}
@@ -185,7 +185,7 @@ void BKE_world_make_local(World *wrld)
* - mixed: make copy
*/
- if (wrld->id.lib == NULL) return;
+ if (!ID_IS_LINKED_DATABLOCK(wrld)) return;
if (wrld->id.us == 1) {
id_clear_lib_data(bmain, &wrld->id);
return;
@@ -193,7 +193,7 @@ void BKE_world_make_local(World *wrld)
for (sce = bmain->scene.first; sce && ELEM(false, is_lib, is_local); sce = sce->id.next) {
if (sce->world == wrld) {
- if (sce->id.lib) is_lib = true;
+ if (ID_IS_LINKED_DATABLOCK(sce)) is_lib = true;
else is_local = true;
}
}
@@ -210,7 +210,7 @@ void BKE_world_make_local(World *wrld)
for (sce = bmain->scene.first; sce; sce = sce->id.next) {
if (sce->world == wrld) {
- if (sce->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(sce)) {
sce->world = wrld_new;
id_us_plus(&wrld_new->id);
id_us_min(&wrld->id);