diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-06 15:11:01 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-06 15:11:01 +0300 |
commit | d2312602125a452e6562a76ab91779943c67396d (patch) | |
tree | da74fa2bce05d94d6bc800021d837b494e6936d7 /source/blender/editors/space_view3d | |
parent | b98b331d04fe3a335cc0656809b4b09196507500 (diff) |
Replace of (id->lib != NULL) check by meaningful macro.
Idea is to replace hard-to-track (id->lib != NULL) 'is linked datablock' check everywhere in Blender
by a macro doing the same thing. This will allow to easily spot those checks in future, and more importantly,
to easily change it (see work done in asset-engine branch).
Note: did not touch to readfile.c, since there most of the time 'id->lib' check actually concerns the pointer,
and not a check whether ID is linked or not. Will have a closer look at it later.
Reviewers: campbellbarton, brecht, sergey
Differential Revision: https://developer.blender.org/D2082
Diffstat (limited to 'source/blender/editors/space_view3d')
5 files changed, 6 insertions, 6 deletions
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; } |