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/interface | |
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/interface')
4 files changed, 8 insertions, 8 deletions
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); |