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:
-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
-rw-r--r--source/blender/editors/animation/anim_filter.c2
-rw-r--r--source/blender/editors/animation/keyframes_draw.c6
-rw-r--r--source/blender/editors/armature/pose_edit.c2
-rw-r--r--source/blender/editors/armature/pose_lib.c4
-rw-r--r--source/blender/editors/interface/interface_eyedropper.c2
-rw-r--r--source/blender/editors/interface/interface_ops.c2
-rw-r--r--source/blender/editors/interface/interface_regions.c2
-rw-r--r--source/blender/editors/interface/interface_templates.c10
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c2
-rw-r--r--source/blender/editors/mesh/mesh_data.c6
-rw-r--r--source/blender/editors/object/object_add.c9
-rw-r--r--source/blender/editors/object/object_constraint.c2
-rw-r--r--source/blender/editors/object/object_data_transfer.c6
-rw-r--r--source/blender/editors/object/object_edit.c12
-rw-r--r--source/blender/editors/object/object_modifier.c4
-rw-r--r--source/blender/editors/object/object_relations.c26
-rw-r--r--source/blender/editors/object/object_shapekey.c9
-rw-r--r--source/blender/editors/object/object_transform.c6
-rw-r--r--source/blender/editors/object/object_vgroup.c23
-rw-r--r--source/blender/editors/physics/particle_edit.c2
-rw-r--r--source/blender/editors/physics/particle_object.c4
-rw-r--r--source/blender/editors/screen/screen_ops.c14
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c4
-rw-r--r--source/blender/editors/space_logic/logic_ops.c6
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c13
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c10
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c2
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c2
-rw-r--r--source/blender/editors/space_text/text_ops.c6
-rw-r--r--source/blender/editors/space_view3d/drawobject.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_walk.c2
-rw-r--r--source/blender/editors/transform/transform_conversions.c2
-rw-r--r--source/blender/editors/util/ed_util.c2
-rw-r--r--source/blender/makesdna/DNA_ID.h2
-rw-r--r--source/blender/makesrna/intern/rna_access.c4
-rw-r--r--source/blender/makesrna/intern/rna_object.c4
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c4
71 files changed, 241 insertions, 235 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);
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 910e195173c..0a1a4787eb0 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1255,7 +1255,7 @@ static size_t animfilter_action(bAnimContext *ac, ListBase *anim_data, bDopeShee
/* don't include anything from this action if it is linked in from another file,
* and we're getting stuff for editing...
*/
- if ((filter_mode & ANIMFILTER_FOREDIT) && (act->id.lib))
+ if ((filter_mode & ANIMFILTER_FOREDIT) && ID_IS_LINKED_DATABLOCK(act))
return 0;
/* do groups */
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 6f1883cff55..011a25ca219 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -679,7 +679,7 @@ void draw_fcurve_channel(View2D *v2d, AnimData *adt, FCurve *fcu, float ypos)
short locked = (fcu->flag & FCURVE_PROTECTED) ||
((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) ||
- ((adt && adt->action) && (adt->action->id.lib));
+ ((adt && adt->action) && ID_IS_LINKED_DATABLOCK(adt->action));
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
@@ -700,7 +700,7 @@ void draw_agroup_channel(View2D *v2d, AnimData *adt, bActionGroup *agrp, float y
DLRBT_Tree keys, blocks;
short locked = (agrp->flag & AGRP_PROTECTED) ||
- ((adt && adt->action) && (adt->action->id.lib));
+ ((adt && adt->action) && ID_IS_LINKED_DATABLOCK(adt->action));
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
@@ -720,7 +720,7 @@ void draw_action_channel(View2D *v2d, AnimData *adt, bAction *act, float ypos)
{
DLRBT_Tree keys, blocks;
- short locked = (act && act->id.lib != NULL);
+ short locked = (act && ID_IS_LINKED_DATABLOCK(act));
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index a929507929f..5015829f868 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -86,7 +86,7 @@ void ED_armature_enter_posemode(bContext *C, Base *base)
ReportList *reports = CTX_wm_reports(C);
Object *ob = base->object;
- if (ob->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(ob)) {
BKE_report(reports, RPT_WARNING, "Cannot pose libdata");
return;
}
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c
index dca9aa3e446..d9a3efa765c 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -183,7 +183,7 @@ static int has_poselib_pose_data_poll(bContext *C)
static int has_poselib_pose_data_for_editing_poll(bContext *C)
{
Object *ob = get_poselib_object(C);
- return (ob && ob->poselib && !ob->poselib->id.lib);
+ return (ob && ob->poselib && !ID_IS_LINKED_DATABLOCK(ob->poselib));
}
/* ----------------------------------- */
@@ -385,7 +385,7 @@ static int poselib_add_poll(bContext *C)
if (ED_operator_posemode(C)) {
Object *ob = get_poselib_object(C);
if (ob) {
- if ((ob->poselib == NULL) || (ob->poselib->id.lib == 0)) {
+ if ((ob->poselib == NULL) || !ID_IS_LINKED_DATABLOCK(ob->poselib)) {
return true;
}
}
diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c
index 2cbc56b14d3..ac7b6428217 100644
--- a/source/blender/editors/interface/interface_eyedropper.c
+++ b/source/blender/editors/interface/interface_eyedropper.c
@@ -805,7 +805,7 @@ static int depthdropper_init(bContext *C, wmOperator *op)
RegionView3D *rv3d = CTX_wm_region_view3d(C);
if (rv3d && rv3d->persp == RV3D_CAMOB) {
View3D *v3d = CTX_wm_view3d(C);
- if (v3d->camera && v3d->camera->data && (((ID *)v3d->camera->data)->lib == NULL)) {
+ if (v3d->camera && v3d->camera->data && !ID_IS_LINKED_DATABLOCK(v3d->camera->data)) {
RNA_id_pointer_create(v3d->camera->data, &ddr->ptr);
ddr->prop = RNA_struct_find_property(&ddr->ptr, "dof_distance");
}
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index ff29a6f8e33..01b10b7b032 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -416,7 +416,7 @@ bool UI_context_copy_to_selected_list(
if ((id_data == NULL) ||
(id_data->tag & LIB_TAG_DOIT) == 0 ||
- (id_data->lib) ||
+ ID_IS_LINKED_DATABLOCK(id_data->lib) ||
(GS(id_data->name) != id_code))
{
BLI_remlink(&lb, link);
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index d4d3e1af1fd..575b32e81e8 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -454,7 +454,7 @@ static uiTooltipData *ui_tooltip_data_from_button(bContext *C, uiBut *but)
if (but->rnapoin.id.data) {
ID *id = but->rnapoin.id.data;
- if (id->lib) {
+ if (ID_IS_LINKED_DATABLOCK(id)) {
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Library: %s"), id->lib->name);
data->format[data->totline].color_id = UI_TIP_LC_NORMAL;
data->totline++;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 7f276bcc634..7205cdb3548 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -974,7 +974,7 @@ static uiLayout *draw_modifier(
}
UI_block_lock_clear(block);
- UI_block_lock_set(block, ob && ob->id.lib, ERROR_LIBDATA_MESSAGE);
+ UI_block_lock_set(block, ob && ID_IS_LINKED_DATABLOCK(ob), ERROR_LIBDATA_MESSAGE);
if (!ELEM(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem,
eModifierType_Cloth, eModifierType_Smoke))
@@ -1021,7 +1021,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
return NULL;
}
- UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ob->id.lib), ERROR_LIBDATA_MESSAGE);
+ UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ID_IS_LINKED_DATABLOCK(ob)), ERROR_LIBDATA_MESSAGE);
/* find modifier and draw it */
cageIndex = modifiers_getCageIndex(scene, ob, &lastCageIndex, 0);
@@ -1249,7 +1249,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
return NULL;
}
- UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ob->id.lib), ERROR_LIBDATA_MESSAGE);
+ UI_block_lock_set(uiLayoutGetBlock(layout), (ob && ID_IS_LINKED_DATABLOCK(ob)), ERROR_LIBDATA_MESSAGE);
/* hrms, the temporal constraint should not draw! */
if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
@@ -1611,7 +1611,7 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname
block = uiLayoutAbsoluteBlock(layout);
id = cptr.id.data;
- UI_block_lock_set(block, (id && id->lib), ERROR_LIBDATA_MESSAGE);
+ UI_block_lock_set(block, (id && ID_IS_LINKED_DATABLOCK(id)), ERROR_LIBDATA_MESSAGE);
colorband_buttons_layout(layout, block, cptr.data, &rect, cb, expand);
@@ -2263,7 +2263,7 @@ void uiTemplateCurveMapping(
cb->prop = prop;
id = cptr.id.data;
- UI_block_lock_set(block, (id && id->lib), ERROR_LIBDATA_MESSAGE);
+ UI_block_lock_set(block, (id && ID_IS_LINKED_DATABLOCK(id)), ERROR_LIBDATA_MESSAGE);
curvemap_buttons_layout(layout, &cptr, type, levels, brush, neg_slope, cb);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 9f1602ccfaf..69db784038f 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3292,7 +3292,7 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
Object *ob = base_iter->object;
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (me->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(me)) {
BMesh *bm_old = NULL;
int retval_iter = 0;
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index e0ddc017e93..772bb1bd308 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -511,7 +511,7 @@ static int layers_poll(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
- return (ob && !ob->id.lib && ob->type == OB_MESH && data && !data->lib);
+ return (ob && !ID_IS_LINKED_DATABLOCK(ob) && ob->type == OB_MESH && data && !ID_IS_LINKED_DATABLOCK(data));
}
static int mesh_uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op))
@@ -759,7 +759,7 @@ static int mesh_customdata_mask_clear_poll(bContext *C)
return false;
}
- if (me->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(me)) {
CustomData *data = GET_CD_DATA(me, vdata);
if (CustomData_has_layer(data, CD_PAINT_MASK)) {
return true;
@@ -813,7 +813,7 @@ static int mesh_customdata_skin_state(bContext *C)
if (ob && ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (me->id.lib == NULL) {
+ if (!ID_IS_LINKED_DATABLOCK(me)) {
CustomData *data = GET_CD_DATA(me, vdata);
return CustomData_has_layer(data, CD_MVERT_SKIN);
}
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 0f1c72fcd55..69950ccc9a9 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1162,7 +1162,7 @@ static int object_delete_exec(bContext *C, wmOperator *op)
Base *base_other;
for (scene_iter = bmain->scene.first; scene_iter; scene_iter = scene_iter->id.next) {
- if (scene_iter != scene && !(scene_iter->id.lib)) {
+ if (scene_iter != scene && !ID_IS_LINKED_DATABLOCK(scene_iter)) {
base_other = BKE_scene_base_find(scene_iter, base->object);
if (base_other) {
if (is_indirectly_used && ID_REAL_USERS(base->object) <= 1) {
@@ -1515,7 +1515,8 @@ static int convert_poll(bContext *C)
Object *obact = CTX_data_active_object(C);
Scene *scene = CTX_data_scene(C);
- return (!scene->id.lib && obact && scene->obedit != obact && (obact->flag & SELECT) && !(obact->id.lib));
+ return (!ID_IS_LINKED_DATABLOCK(scene) && obact && scene->obedit != obact &&
+ (obact->flag & SELECT) && !ID_IS_LINKED_DATABLOCK(obact));
}
/* Helper for convert_exec */
@@ -2305,7 +2306,7 @@ static int join_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
- if (!ob || ob->id.lib) return 0;
+ if (!ob || ID_IS_LINKED_DATABLOCK(ob)) return 0;
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_ARMATURE))
return ED_operator_screenactive(C);
@@ -2358,7 +2359,7 @@ static int join_shapes_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
- if (!ob || ob->id.lib) return 0;
+ if (!ob || ID_IS_LINKED_DATABLOCK(ob)) return 0;
/* only meshes supported at the moment */
if (ob->type == OB_MESH)
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index d7b7fd7040e..db8a4c1960f 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -584,7 +584,7 @@ static int edit_constraint_poll_generic(bContext *C, StructRNA *rna_type)
return 0;
}
- if (ob->id.lib || (ptr.id.data && ((ID *)ptr.id.data)->lib)) {
+ if (ID_IS_LINKED_DATABLOCK(ob) || (ptr.id.data && ID_IS_LINKED_DATABLOCK(ptr.id.data))) {
CTX_wm_operator_poll_msg_set(C, "Cannot edit library data");
return 0;
}
diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c
index 47ee6752e51..acee69daab7 100644
--- a/source/blender/editors/object/object_data_transfer.c
+++ b/source/blender/editors/object/object_data_transfer.c
@@ -300,7 +300,7 @@ static void data_transfer_exec_preprocess_objects(
}
me = ob->data;
- if (me->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(me)) {
/* Do not transfer to linked data, not supported. */
BKE_reportf(op->reports, RPT_WARNING, "Skipping object '%s', linked data '%s' cannot be modified",
ob->id.name + 2, me->id.name + 2);
@@ -330,7 +330,7 @@ static bool data_transfer_exec_is_object_valid(
me->id.tag &= ~LIB_TAG_DOIT;
return true;
}
- else if (me->id.lib == NULL) {
+ else if (!ID_IS_LINKED_DATABLOCK(me)) {
/* Do not transfer apply operation more than once. */
/* XXX This is not nice regarding vgroups, which are half-Object data... :/ */
BKE_reportf(op->reports, RPT_WARNING,
@@ -387,7 +387,7 @@ static int data_transfer_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
- if (reverse_transfer && ((ID *)(ob_src->data))->lib) {
+ if (reverse_transfer && ID_IS_LINKED_DATABLOCK(ob_src->data)) {
/* Do not transfer to linked data, not supported. */
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 01a567931b3..3dc7d8ebd4b 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -470,7 +470,7 @@ void ED_object_editmode_enter(bContext *C, int flag)
View3D *v3d = NULL;
bool ok = false;
- if (scene->id.lib) return;
+ if (ID_IS_LINKED_DATABLOCK(scene)) return;
if (sa && sa->spacetype == SPACE_VIEW3D)
v3d = sa->spacedata.first;
@@ -539,7 +539,7 @@ void ED_object_editmode_enter(bContext *C, int flag)
* BKE_object_obdata_is_libdata that prevent the bugfix #6614, so
* i add this little hack here.
*/
- if (arm->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(arm)) {
error_libdata();
return;
}
@@ -621,7 +621,7 @@ static int editmode_toggle_poll(bContext *C)
Object *ob = CTX_data_active_object(C);
/* covers proxies too */
- if (ELEM(NULL, ob, ob->data) || ((ID *)ob->data)->lib)
+ if (ELEM(NULL, ob, ob->data) || ID_IS_LINKED_DATABLOCK(ob->data))
return 0;
/* if hidden but in edit mode, we still display */
@@ -848,7 +848,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
Nurb *nu;
bool do_depgraph_update = false;
- if (scene->id.lib) return;
+ if (ID_IS_LINKED_DATABLOCK(scene)) return;
if (!(ob = OBACT)) return;
@@ -1436,7 +1436,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
{
data = ob->data;
- if (data && data->lib) {
+ if (data && ID_IS_LINKED_DATABLOCK(data)) {
linked_data = true;
continue;
}
@@ -1519,7 +1519,7 @@ static void UNUSED_FUNCTION(image_aspect) (Scene *scene, View3D *v3d)
int a, b, done;
if (scene->obedit) return; // XXX get from context
- if (scene->id.lib) return;
+ if (ID_IS_LINKED_DATABLOCK(scene)) return;
for (base = FIRSTBASE; base; base = base->next) {
if (TESTBASELIB(v3d, base)) {
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 264945b00bf..b44ddf925a8 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -817,9 +817,9 @@ int edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag
PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", rna_type);
Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C);
- if (!ob || ob->id.lib) return 0;
+ if (!ob || ID_IS_LINKED_DATABLOCK(ob)) return 0;
if (obtype_flag && ((1 << ob->type) & obtype_flag) == 0) return 0;
- if (ptr.id.data && ((ID *)ptr.id.data)->lib) return 0;
+ if (ptr.id.data && ID_IS_LINKED_DATABLOCK(ptr.id.data)) return 0;
return 1;
}
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 94d1a258063..9a6fe5ae48b 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -291,17 +291,17 @@ static int make_proxy_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Object *ob = ED_object_active_context(C);
/* sanity checks */
- if (!scene || scene->id.lib || !ob)
+ if (!scene || ID_IS_LINKED_DATABLOCK(scene) || !ob)
return OPERATOR_CANCELLED;
/* Get object to work on - use a menu if we need to... */
- if (ob->dup_group && ob->dup_group->id.lib) {
+ if (ob->dup_group && ID_IS_LINKED_DATABLOCK(ob->dup_group)) {
/* gives menu with list of objects in group */
/* proxy_group_objects_menu(C, op, ob, ob->dup_group); */
WM_enum_search_invoke(C, op, event);
return OPERATOR_CANCELLED;
}
- else if (ob->id.lib) {
+ else if (ID_IS_LINKED_DATABLOCK(ob)) {
uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("OK?"), ICON_QUESTION);
uiLayout *layout = UI_popup_menu_layout(pup);
@@ -1466,7 +1466,7 @@ static int make_links_scene_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- if (scene_to->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(scene_to)) {
BKE_report(op->reports, RPT_ERROR, "Cannot link objects into a linked scene");
return OPERATOR_CANCELLED;
}
@@ -1579,7 +1579,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
case MAKE_LINKS_ANIMDATA:
BKE_animdata_copy_id((ID *)ob_dst, (ID *)ob_src, false);
if (ob_dst->data && ob_src->data) {
- if (obdata_id->lib) {
+ if (ID_IS_LINKED_DATABLOCK(obdata_id)) {
is_lib = true;
break;
}
@@ -1621,7 +1621,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
Curve *cu_src = ob_src->data;
Curve *cu_dst = ob_dst->data;
- if (obdata_id->lib) {
+ if (ID_IS_LINKED_DATABLOCK(obdata_id)) {
is_lib = true;
break;
}
@@ -1749,7 +1749,7 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in
ob = base->object;
if ((base->flag & flag) == flag) {
- if (ob->id.lib == NULL && ob->id.us > 1) {
+ if (!ID_IS_LINKED_DATABLOCK(ob) && ob->id.us > 1) {
/* base gets copy of object */
obn = BKE_object_copy(ob);
base->object = obn;
@@ -1828,7 +1828,7 @@ static void new_id_matar(Material **matar, const int totcol)
for (a = 0; a < totcol; a++) {
id = (ID *)matar[a];
- if (id && id->lib == NULL) {
+ if (id && !ID_IS_LINKED_DATABLOCK(id)) {
if (id->newid) {
matar[a] = (Material *)id->newid;
id_us_plus(id->newid);
@@ -1857,10 +1857,10 @@ static void single_obdata_users(Main *bmain, Scene *scene, const int flag)
for (base = FIRSTBASE; base; base = base->next) {
ob = base->object;
- if (ob->id.lib == NULL && (base->flag & flag) == flag) {
+ if (!ID_IS_LINKED_DATABLOCK(ob) && (base->flag & flag) == flag) {
id = ob->data;
- if (id && id->us > 1 && id->lib == NULL) {
+ if (id && id->us > 1 && !ID_IS_LINKED_DATABLOCK(id)) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
switch (ob->type) {
@@ -1938,7 +1938,7 @@ static void single_object_action_users(Scene *scene, const int flag)
for (base = FIRSTBASE; base; base = base->next) {
ob = base->object;
- if (ob->id.lib == NULL && (flag == 0 || (base->flag & SELECT)) ) {
+ if (!ID_IS_LINKED_DATABLOCK(ob) && (flag == 0 || (base->flag & SELECT)) ) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
BKE_animdata_copy_id_action(&ob->id);
}
@@ -1955,7 +1955,7 @@ static void single_mat_users(Scene *scene, const int flag, const bool do_texture
for (base = FIRSTBASE; base; base = base->next) {
ob = base->object;
- if (ob->id.lib == NULL && (flag == 0 || (base->flag & SELECT)) ) {
+ if (!ID_IS_LINKED_DATABLOCK(ob) && (flag == 0 || (base->flag & SELECT)) ) {
for (a = 1; a <= ob->totcol; a++) {
ma = give_current_material(ob, a);
if (ma) {
@@ -2184,7 +2184,7 @@ static bool make_local_all__instance_indirect_unused(Main *bmain, Scene *scene)
bool changed = false;
for (ob = bmain->object.first; ob; ob = ob->id.next) {
- if (ob->id.lib && (ob->id.us == 0)) {
+ if (ID_IS_LINKED_DATABLOCK(ob) && (ob->id.us == 0)) {
Base *base;
id_us_plus(&ob->id);
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index 39bd34456be..e04114761e4 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -225,7 +225,7 @@ static int shape_key_mode_poll(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
- return (ob && !ob->id.lib && data && !data->lib && ob->mode != OB_MODE_EDIT);
+ return (ob && !ID_IS_LINKED_DATABLOCK(ob) && data && !ID_IS_LINKED_DATABLOCK(data) && ob->mode != OB_MODE_EDIT);
}
static int shape_key_mode_exists_poll(bContext *C)
@@ -234,7 +234,7 @@ static int shape_key_mode_exists_poll(bContext *C)
ID *data = (ob) ? ob->data : NULL;
/* same as shape_key_mode_poll */
- return (ob && !ob->id.lib && data && !data->lib && ob->mode != OB_MODE_EDIT) &&
+ return (ob && !ID_IS_LINKED_DATABLOCK(ob) && data && !ID_IS_LINKED_DATABLOCK(data) && ob->mode != OB_MODE_EDIT) &&
/* check a keyblock exists */
(BKE_keyblock_from_object(ob) != NULL);
}
@@ -246,14 +246,15 @@ static int shape_key_move_poll(bContext *C)
ID *data = (ob) ? ob->data : NULL;
Key *key = BKE_key_from_object(ob);
- return (ob && !ob->id.lib && data && !data->lib && ob->mode != OB_MODE_EDIT && key && key->totkey > 1);
+ return (ob && !ID_IS_LINKED_DATABLOCK(ob) && data && !ID_IS_LINKED_DATABLOCK(data) &&
+ ob->mode != OB_MODE_EDIT && key && key->totkey > 1);
}
static int shape_key_poll(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
- return (ob && !ob->id.lib && data && !data->lib);
+ return (ob && !ID_IS_LINKED_DATABLOCK(ob) && data && !ID_IS_LINKED_DATABLOCK(data));
}
static int shape_key_add_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index d2bbb73b597..6d80c4af292 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -391,7 +391,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, bool apply_l
changed = false;
}
- if (obdata->lib) {
+ if (ID_IS_LINKED_DATABLOCK(obdata)) {
BKE_reportf(reports, RPT_ERROR,
"Cannot apply to library data: Object \"%s\", %s \"%s\", aborting",
ob->id.name + 2, BKE_idcode_to_name(GS(obdata->name)), obdata->name + 2);
@@ -792,7 +792,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
if (ob->data == NULL) {
/* special support for dupligroups */
if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group && (ob->dup_group->id.tag & LIB_TAG_DOIT) == 0) {
- if (ob->dup_group->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(ob->dup_group)) {
tot_lib_error++;
}
else {
@@ -817,7 +817,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
}
}
- else if (((ID *)ob->data)->lib) {
+ else if (ID_IS_LINKED_DATABLOCK(ob->data)) {
tot_lib_error++;
}
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 414cc476be5..6e8aaebcccc 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -2447,8 +2447,8 @@ static int vertex_group_poll(bContext *C)
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
- return (ob && !ob->id.lib &&
- data && !data->lib &&
+ return (ob && !ID_IS_LINKED_DATABLOCK(ob) &&
+ data && !ID_IS_LINKED_DATABLOCK(data) &&
OB_TYPE_SUPPORT_VGROUP(ob->type) &&
ob->defbase.first);
}
@@ -2457,7 +2457,8 @@ static int vertex_group_supported_poll(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
- return (ob && !ob->id.lib && OB_TYPE_SUPPORT_VGROUP(ob->type) && data && !data->lib);
+ return (ob && !ID_IS_LINKED_DATABLOCK(ob) && OB_TYPE_SUPPORT_VGROUP(ob->type) &&
+ data && !ID_IS_LINKED_DATABLOCK(data));
}
static int vertex_group_mesh_poll(bContext *C)
@@ -2465,8 +2466,8 @@ static int vertex_group_mesh_poll(bContext *C)
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
- return (ob && !ob->id.lib &&
- data && !data->lib &&
+ return (ob && !ID_IS_LINKED_DATABLOCK(ob) &&
+ data && !ID_IS_LINKED_DATABLOCK(data) &&
ob->type == OB_MESH &&
ob->defbase.first);
}
@@ -2475,7 +2476,7 @@ static int UNUSED_FUNCTION(vertex_group_mesh_supported_poll)(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
- return (ob && !ob->id.lib && ob->type == OB_MESH && data && !data->lib);
+ return (ob && !ID_IS_LINKED_DATABLOCK(ob) && ob->type == OB_MESH && data && !ID_IS_LINKED_DATABLOCK(data));
}
@@ -2484,7 +2485,7 @@ static int UNUSED_FUNCTION(vertex_group_poll_edit) (bContext *C)
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
- if (!(ob && !ob->id.lib && data && !data->lib))
+ if (!(ob && !ID_IS_LINKED_DATABLOCK(ob) && data && !ID_IS_LINKED_DATABLOCK(data)))
return 0;
return BKE_object_is_in_editmode_vgroup(ob);
@@ -2496,7 +2497,7 @@ static int vertex_group_vert_select_poll_ex(bContext *C, const short ob_type_fla
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
- if (!(ob && !ob->id.lib && data && !data->lib))
+ if (!(ob && !ID_IS_LINKED_DATABLOCK(ob) && data && !ID_IS_LINKED_DATABLOCK(data)))
return false;
if (ob_type_flag && (((1 << ob->type) & ob_type_flag)) == 0) {
@@ -2536,7 +2537,7 @@ static int vertex_group_vert_select_unlocked_poll(bContext *C)
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
- if (!(ob && !ob->id.lib && data && !data->lib))
+ if (!(ob && !ID_IS_LINKED_DATABLOCK(ob) && data && !ID_IS_LINKED_DATABLOCK(data)))
return 0;
if (!(BKE_object_is_in_editmode_vgroup(ob) ||
@@ -2559,7 +2560,7 @@ static int vertex_group_vert_select_mesh_poll(bContext *C)
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
- if (!(ob && !ob->id.lib && data && !data->lib))
+ if (!(ob && !ID_IS_LINKED_DATABLOCK(ob) && data && !ID_IS_LINKED_DATABLOCK(data)))
return 0;
/* only difference to #vertex_group_vert_select_poll */
@@ -2748,7 +2749,7 @@ static int vertex_group_select_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = ED_object_context(C);
- if (!ob || ob->id.lib)
+ if (!ob || ID_IS_LINKED_DATABLOCK(ob))
return OPERATOR_CANCELLED;
vgroup_select_verts(ob, 1);
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 30c102b70c5..e22a145b3a6 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -4693,7 +4693,7 @@ static int particle_edit_toggle_poll(bContext *C)
if (ob == NULL || ob->type != OB_MESH)
return 0;
- if (!ob->data || ((ID *)ob->data)->lib)
+ if (!ob->data || ID_IS_LINKED_DATABLOCK(ob->data))
return 0;
if (CTX_data_edit_object(C))
return 0;
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 1297133e1a2..d6c89b9c7a5 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -974,7 +974,7 @@ static void remove_particle_systems_from_object(Object *ob_to)
if (ob_to->type != OB_MESH)
return;
- if (!ob_to->data || ((ID *)ob_to->data)->lib)
+ if (!ob_to->data || ID_IS_LINKED_DATABLOCK(ob_to->data))
return;
for (md = ob_to->modifiers.first; md; md = md_next) {
@@ -1004,7 +1004,7 @@ static bool copy_particle_systems_to_object(Scene *scene, Object *ob_from, Parti
if (ob_to->type != OB_MESH)
return false;
- if (!ob_to->data || ((ID *)ob_to->data)->lib)
+ if (!ob_to->data || ID_IS_LINKED_DATABLOCK(ob_to->data))
return false;
/* For remapping we need a valid DM.
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 0c0a6c93b3e..04a8f0a3a51 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -168,7 +168,7 @@ int ED_operator_screen_mainwinactive(bContext *C)
int ED_operator_scene_editable(bContext *C)
{
Scene *scene = CTX_data_scene(C);
- if (scene && scene->id.lib == NULL)
+ if (scene && !ID_IS_LINKED_DATABLOCK(scene))
return 1;
return 0;
}
@@ -178,7 +178,7 @@ int ED_operator_objectmode(bContext *C)
Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
- if (scene == NULL || scene->id.lib)
+ if (scene == NULL || ID_IS_LINKED_DATABLOCK(scene))
return 0;
if (CTX_data_edit_object(C))
return 0;
@@ -279,7 +279,7 @@ int ED_operator_node_editable(bContext *C)
{
SpaceNode *snode = CTX_wm_space_node(C);
- if (snode && snode->edittree && snode->edittree->id.lib == NULL)
+ if (snode && snode->edittree && !ID_IS_LINKED_DATABLOCK(snode->edittree))
return 1;
return 0;
@@ -341,20 +341,20 @@ int ED_operator_object_active(bContext *C)
int ED_operator_object_active_editable(bContext *C)
{
Object *ob = ED_object_active_context(C);
- return ((ob != NULL) && !(ob->id.lib) && !ed_object_hidden(ob));
+ return ((ob != NULL) && !ID_IS_LINKED_DATABLOCK(ob) && !ed_object_hidden(ob));
}
int ED_operator_object_active_editable_mesh(bContext *C)
{
Object *ob = ED_object_active_context(C);
- return ((ob != NULL) && !(ob->id.lib) && !ed_object_hidden(ob) &&
- (ob->type == OB_MESH) && !(((ID *)ob->data)->lib));
+ return ((ob != NULL) && !ID_IS_LINKED_DATABLOCK(ob) && !ed_object_hidden(ob) &&
+ (ob->type == OB_MESH) && !ID_IS_LINKED_DATABLOCK(ob->data));
}
int ED_operator_object_active_editable_font(bContext *C)
{
Object *ob = ED_object_active_context(C);
- return ((ob != NULL) && !(ob->id.lib) && !ed_object_hidden(ob) &&
+ return ((ob != NULL) && !ID_IS_LINKED_DATABLOCK(ob) && !ed_object_hidden(ob) &&
(ob->type == OB_FONT));
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 689b89e7b69..bf344e1f721 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1342,7 +1342,7 @@ static int texture_paint_toggle_poll(bContext *C)
Object *ob = CTX_data_active_object(C);
if (ob == NULL || ob->type != OB_MESH)
return 0;
- if (!ob->data || ((ID *)ob->data)->lib)
+ if (!ob->data || ID_IS_LINKED_DATABLOCK(ob->data))
return 0;
if (CTX_data_edit_object(C))
return 0;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 87855879ec5..3bcd610150c 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -247,7 +247,7 @@ static bool make_vertexcol(Object *ob) /* single ob */
{
Mesh *me;
- if ((ob->id.lib) ||
+ if (ID_IS_LINKED_DATABLOCK(ob) ||
((me = BKE_mesh_from_object(ob)) == NULL) ||
(me->totpoly == 0) ||
(me->edit_btmesh))
@@ -1841,7 +1841,7 @@ static int paint_poll_test(bContext *C)
Object *ob = CTX_data_active_object(C);
if (ob == NULL || ob->type != OB_MESH)
return 0;
- if (!ob->data || ((ID *)ob->data)->lib)
+ if (!ob->data || ID_IS_LINKED_DATABLOCK(ob->data))
return 0;
if (CTX_data_edit_object(C))
return 0;
diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c
index 51f4a61047d..074368a82c5 100644
--- a/source/blender/editors/space_logic/logic_ops.c
+++ b/source/blender/editors/space_logic/logic_ops.c
@@ -65,7 +65,7 @@ static int edit_sensor_poll(bContext *C)
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "sensor", &RNA_Sensor);
- if (ptr.data && ((ID *)ptr.id.data)->lib) return 0;
+ if (ptr.data && ID_IS_LINKED_DATABLOCK(ptr.id.data)) return 0;
return 1;
}
@@ -73,7 +73,7 @@ static int edit_controller_poll(bContext *C)
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "controller", &RNA_Controller);
- if (ptr.data && ((ID *)ptr.id.data)->lib) return 0;
+ if (ptr.data && ID_IS_LINKED_DATABLOCK(ptr.id.data)) return 0;
return 1;
}
@@ -81,7 +81,7 @@ static int edit_actuator_poll(bContext *C)
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "actuator", &RNA_Actuator);
- if (ptr.data && ((ID *)ptr.id.data)->lib) return 0;
+ if (ptr.data && ID_IS_LINKED_DATABLOCK(ptr.id.data)) return 0;
return 1;
}
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 43e9c262172..b8d3e2fb1fc 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -402,7 +402,7 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
if (group_restrict_flag(gr, flag)) {
for (gob = gr->gobject.first; gob; gob = gob->next) {
- if (gob->ob->id.lib)
+ if (ID_IS_LINKED_DATABLOCK(gob->ob))
continue;
gob->ob->restrictflag &= ~flag;
@@ -414,7 +414,7 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
}
else {
for (gob = gr->gobject.first; gob; gob = gob->next) {
- if (gob->ob->id.lib)
+ if (ID_IS_LINKED_DATABLOCK(gob->ob))
continue;
/* not in editmode */
@@ -655,7 +655,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
int but_flag = UI_BUT_DRAG_LOCK;
gr = (Group *)tselem->id;
- if (gr->id.lib)
+ if (ID_IS_LINKED_DATABLOCK(gr))
but_flag |= UI_BUT_DISABLED;
UI_block_emboss_set(block, UI_EMBOSS_NONE);
@@ -828,7 +828,7 @@ static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOops *soops
char buf[16] = "";
int but_flag = UI_BUT_DRAG_LOCK;
- if (id->lib)
+ if (ID_IS_LINKED_DATABLOCK(id))
but_flag |= UI_BUT_DISABLED;
UI_block_emboss_set(block, UI_EMBOSS_NONE);
@@ -993,7 +993,8 @@ static void tselem_draw_icon_uibut(struct DrawIconArg *arg, int icon)
}
else {
uiBut *but = uiDefIconBut(arg->block, UI_BTYPE_LABEL, 0, icon, arg->xb, arg->yb, UI_UNIT_X, UI_UNIT_Y, NULL,
- 0.0, 0.0, 1.0, arg->alpha, (arg->id && arg->id->lib) ? arg->id->lib->name : "");
+ 0.0, 0.0, 1.0, arg->alpha,
+ (arg->id && ID_IS_LINKED_DATABLOCK(arg->id)) ? arg->id->lib->name : "");
if (arg->id)
UI_but_drag_set_id(but, arg->id);
@@ -1567,7 +1568,7 @@ static void outliner_draw_tree_element(
else
offsx += 2 * ufac;
- if (tselem->type == 0 && tselem->id->lib) {
+ if (tselem->type == 0 && ID_IS_LINKED_DATABLOCK(tselem->id)) {
glPixelTransferf(GL_ALPHA_SCALE, 0.5f);
if (tselem->id->tag & LIB_TAG_MISSING) {
UI_icon_draw((float)startx + offsx, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_BROKEN);
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 07608b59d2e..b0cd3aabbfd 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -232,7 +232,7 @@ static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem,
else if (ELEM(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) {
BKE_report(reports, RPT_WARNING, "Cannot edit sequence name");
}
- else if (tselem->id->lib) {
+ else if (ID_IS_LINKED_DATABLOCK(tselem->id)) {
BKE_report(reports, RPT_WARNING, "Cannot edit external libdata");
}
else if (te->idcode == ID_LI && ((Library *)tselem->id)->parent) {
@@ -423,7 +423,7 @@ static int outliner_id_remap_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- if (old_id->lib) {
+ if (ID_IS_LINKED_DATABLOCK(old_id)) {
BKE_reportf(op->reports, RPT_WARNING,
"Old ID '%s' is linked from a library, indirect usages of this datablock will not be remapped",
old_id->name);
@@ -1982,7 +1982,7 @@ static int parent_drop_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "child", childname);
ob = (Object *)BKE_libblock_find_name(ID_OB, childname);
- if (ob->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(ob)) {
BKE_report(op->reports, RPT_INFO, "Can't edit library linked object");
return OPERATOR_CANCELLED;
}
@@ -2030,7 +2030,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
if (ob == par) {
return OPERATOR_CANCELLED;
}
- if (ob->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(ob)) {
BKE_report(op->reports, RPT_INFO, "Can't edit library linked object");
return OPERATOR_CANCELLED;
}
@@ -2239,7 +2239,7 @@ static int scene_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
RNA_string_get(op->ptr, "object", obname);
ob = (Object *)BKE_libblock_find_name(ID_OB, obname);
- if (ELEM(NULL, ob, scene) || scene->id.lib != NULL) {
+ if (ELEM(NULL, ob, scene) || ID_IS_LINKED_DATABLOCK(scene)) {
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index bfec62997e1..13adaff5224 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -435,7 +435,7 @@ static void id_local_cb(
bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te),
TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data))
{
- if (tselem->id->lib && (tselem->id->tag & LIB_TAG_EXTERN)) {
+ if (ID_IS_LINKED_DATABLOCK(tselem->id) && (tselem->id->tag & LIB_TAG_EXTERN)) {
/* if the ID type has no special local function,
* just clear the lib */
if (id_make_local(tselem->id, false) == false) {
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index a687f61d69f..b22e6595caf 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -490,7 +490,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
outliner_add_element(soops, &te->subtree, ob->poselib, te, 0, 0); // XXX FIXME.. add a special type for this
- if (ob->proxy && ob->id.lib == NULL)
+ if (ob->proxy && !ID_IS_LINKED_DATABLOCK(ob))
outliner_add_element(soops, &te->subtree, ob->proxy, te, TSE_PROXY, 0);
outliner_add_element(soops, &te->subtree, ob->gpd, te, 0, 0);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 94ed280f792..e7428fd79d9 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -92,7 +92,7 @@ static int text_edit_poll(bContext *C)
if (!text)
return 0;
- if (text->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(text)) {
// BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata");
return 0;
}
@@ -108,7 +108,7 @@ int text_space_edit_poll(bContext *C)
if (!st || !text)
return 0;
- if (text->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(text)) {
// BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata");
return 0;
}
@@ -128,7 +128,7 @@ static int text_region_edit_poll(bContext *C)
if (!ar || ar->regiontype != RGN_TYPE_WINDOW)
return 0;
- if (text->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(text)) {
// BKE_report(op->reports, RPT_ERROR, "Cannot edit external libdata");
return 0;
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 128adc8269b..4320699b8d7 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -7334,7 +7334,7 @@ static void draw_object_wire_color(Scene *scene, Base *base, unsigned char r_ob_
}
else {
/* Sets the 'colindex' */
- if (ob->id.lib) {
+ if (ID_IS_LINKED_DATABLOCK(ob)) {
colindex = (base->flag & (SELECT + BA_WAS_SEL)) ? 2 : 1;
}
/* Sets the 'theme_id' or fallback to wire */
@@ -8090,7 +8090,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
!(G.f & G_RENDER_OGL))
{
/* check > 0 otherwise grease pencil can draw into the circle select which is annoying. */
- drawcentercircle(v3d, rv3d, ob->obmat[3], do_draw_center, ob->id.lib || ob->id.us > 1);
+ drawcentercircle(v3d, rv3d, ob->obmat[3], do_draw_center, ID_IS_LINKED_DATABLOCK(ob) || ob->id.us > 1);
}
}
}
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 907fe90c067..4d5d03d6c9b 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -110,7 +110,7 @@ static bool view3d_operator_offset_lock_check(bContext *C, wmOperator *op)
bool ED_view3d_camera_lock_check(const View3D *v3d, const RegionView3D *rv3d)
{
return ((v3d->camera) &&
- (v3d->camera->id.lib == NULL) &&
+ (!ID_IS_LINKED_DATABLOCK(v3d->camera)) &&
(v3d->flag2 & V3D_LOCK_CAMERA) &&
(rv3d->persp == RV3D_CAMOB));
}
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 8418cf0980c..31377d0fce8 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -346,7 +346,7 @@ static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
fly->rv3d->persp = RV3D_PERSP;
}
- if (fly->rv3d->persp == RV3D_CAMOB && fly->v3d->camera->id.lib) {
+ if (fly->rv3d->persp == RV3D_CAMOB && ID_IS_LINKED_DATABLOCK(fly->v3d->camera)) {
BKE_report(op->reports, RPT_ERROR, "Cannot fly a camera from an external library");
return false;
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index c35646b9e92..00fd3cd48e5 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -507,7 +507,7 @@ static int view3d_camera_to_view_poll(bContext *C)
if (ED_view3d_context_user_region(C, &v3d, &ar)) {
RegionView3D *rv3d = ar->regiondata;
- if (v3d && v3d->camera && v3d->camera->id.lib == NULL) {
+ if (v3d && v3d->camera && !ID_IS_LINKED_DATABLOCK(v3d->camera)) {
if (rv3d && (rv3d->viewlock & RV3D_LOCKED) == 0) {
if (rv3d->persp != RV3D_CAMOB) {
return 1;
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index 384da277612..3269e0cfbfc 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -505,7 +505,7 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op)
walk->rv3d->persp = RV3D_PERSP;
}
- if (walk->rv3d->persp == RV3D_CAMOB && walk->v3d->camera->id.lib) {
+ if (walk->rv3d->persp == RV3D_CAMOB && ID_IS_LINKED_DATABLOCK(walk->v3d->camera)) {
BKE_report(op->reports, RPT_ERROR, "Cannot navigate a camera from an external library");
return false;
}
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 707c60f8701..fc32613c1ab 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -6429,7 +6429,7 @@ static void createTransObject(bContext *C, TransInfo *t)
}
/* select linked objects, but skip them later */
- if (ob->id.lib != NULL) {
+ if (ID_IS_LINKED_DATABLOCK(ob)) {
td->flag |= TD_SKIP;
}
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index e2f60955c81..1f1a778cac7 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -105,7 +105,7 @@ void ED_editors_init(bContext *C)
ob->mode = OB_MODE_OBJECT;
data = ob->data;
- if (ob == obact && !ob->id.lib && !(data && data->lib))
+ if (ob == obact && !ID_IS_LINKED_DATABLOCK(ob) && !(data && ID_IS_LINKED_DATABLOCK(data)))
ED_object_toggle_modes(C, mode);
}
}
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index b0812a81ee1..bb5d2b4cf29 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -269,6 +269,8 @@ typedef struct PreviewImage {
#define ID_MISSING(_id) (((_id)->tag & LIB_TAG_MISSING) != 0)
+#define ID_IS_LINKED_DATABLOCK(_id) (((ID *)(_id))->lib != NULL)
+
#ifdef GS
# undef GS
#endif
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 0eaeabccd99..1372d2b30a2 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -1624,7 +1624,7 @@ bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop)
flag = prop->editable ? prop->editable(ptr) : prop->flag;
return ((flag & PROP_EDITABLE) &&
(flag & PROP_REGISTER) == 0 &&
- (!id || !id->lib || (prop->flag & PROP_LIB_EXCEPTION)));
+ (!id || !ID_IS_LINKED_DATABLOCK(id) || (prop->flag & PROP_LIB_EXCEPTION)));
}
bool RNA_property_editable_flag(PointerRNA *ptr, PropertyRNA *prop)
@@ -1656,7 +1656,7 @@ bool RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index)
id = ptr->id.data;
- return (flag & PROP_EDITABLE) && (!id || !id->lib || (prop->flag & PROP_LIB_EXCEPTION));
+ return (flag & PROP_EDITABLE) && (!id || !ID_IS_LINKED_DATABLOCK(id) || (prop->flag & PROP_LIB_EXCEPTION));
}
bool RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop)
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index a7f5c21cc76..5dc4bbd83dd 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -718,10 +718,10 @@ static int rna_Object_active_material_editable(PointerRNA *ptr)
bool is_editable;
if ((ob->matbits == NULL) || (ob->actcol == 0) || ob->matbits[ob->actcol - 1]) {
- is_editable = (ob->id.lib == NULL);
+ is_editable = !ID_IS_LINKED_DATABLOCK(ob);
}
else {
- is_editable = ob->data ? (((ID *)ob->data)->lib == NULL) : false;
+ is_editable = ob->data ? !ID_IS_LINKED_DATABLOCK(ob->data) : false;
}
return is_editable ? PROP_EDITABLE : 0;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 8968c2a4543..4bd1bddb4dc 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -3884,7 +3884,7 @@ static void previews_id_ensure(bContext *C, Scene *scene, ID *id)
/* Only preview non-library datablocks, lib ones do not pertain to this .blend file!
* Same goes for ID with no user. */
- if (!id->lib && (id->us != 0)) {
+ if (!ID_IS_LINKED_DATABLOCK(id) && (id->us != 0)) {
UI_id_icon_render(C, scene, id, false, false);
UI_id_icon_render(C, scene, id, true, false);
}
@@ -4469,7 +4469,7 @@ static EnumPropertyItem *rna_id_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(pt
int i = 0;
for (; id; id = id->next) {
- if (local == false || id->lib == NULL) {
+ if (local == false || !ID_IS_LINKED_DATABLOCK(id)) {
item_tmp.identifier = item_tmp.name = id->name + 2;
item_tmp.value = i++;
RNA_enum_item_add(&item, &totitem, &item_tmp);