diff options
author | Bastien Montagne <bastien@blender.org> | 2021-08-26 16:01:14 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-08-26 16:01:14 +0300 |
commit | edb95b3fcbb907fe4b93fecf9e398f41113b3ee4 (patch) | |
tree | 0f39a4b935d29a170ecaa887496a0a0ef4cae72a /source/blender/editors | |
parent | 1bb2077250aed65e9445468161e01aa219a89624 (diff) |
Cleanup: Use `ID_IS_LINKED` instead of direct `id.lib` pointer check.
Diffstat (limited to 'source/blender/editors')
6 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 0e5a6a79137..08d78552710 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -397,7 +397,7 @@ static bool id_search_add(const bContext *C, TemplateID *template_ui, uiSearchIt char name_ui[MAX_ID_FULL_NAME_UI]; int iconid = ui_id_icon_get(C, id, template_ui->preview); const bool use_lib_prefix = template_ui->preview || iconid; - const bool has_sep_char = (id->lib != NULL); + const bool has_sep_char = ID_IS_LINKED(id); /* When using previews, the library hint (linked, overridden, missing) is added with a * character prefix, otherwise we can use a icon. */ @@ -1112,7 +1112,7 @@ static void template_ID(const bContext *C, UI_but_flag_enable(but, UI_BUT_REDALERT); } - if (id->lib == NULL && !(ELEM(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_OB, ID_WS)) && + if (!ID_IS_LINKED(id) && !(ELEM(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_OB, ID_WS)) && (hide_buttons == false)) { uiDefIconButR(block, UI_BTYPE_ICON_TOGGLE, diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 93a790b53d0..1a41dc8e9fb 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -535,7 +535,7 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, BLI_STATIC_ASSERT(sizeof(name_buf) >= MAX_ID_FULL_NAME_UI, "Name string buffer should be big enough to hold full UI ID name"); name = name_buf; - has_sep_char = (id->lib != NULL); + has_sep_char = ID_IS_LINKED(id); } } else { diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 1a53d25ad39..c7d23943b6c 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -3055,7 +3055,7 @@ static void filelist_readjob_main_recursive(Main *bmain, FileList *filelist) ok = 1; if (ok) { if (!(filelist->filter_data.flags & FLF_HIDE_DOT) || id->name[2] != '.') { - if (id->lib == NULL) { + if (!ID_IS_LINKED(id)) { files->entry->relpath = BLI_strdup(id->name + 2); } else { diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 4f8feda3911..11efd3e33ef 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2338,7 +2338,7 @@ int ED_image_save_all_modified_info(const Main *bmain, ReportList *reports) if (image_should_be_saved(ima, &is_format_writable)) { if (BKE_image_has_packedfile(ima) || (ima->source == IMA_SRC_GENERATED)) { - if (ima->id.lib == NULL) { + if (!ID_IS_LINKED(ima)) { num_saveable_images++; } else { diff --git a/source/blender/editors/space_view3d/view3d_gizmo_camera.c b/source/blender/editors/space_view3d/view3d_gizmo_camera.c index e1d439bef15..30b9839935f 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_camera.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_camera.c @@ -75,7 +75,7 @@ static bool WIDGETGROUP_camera_poll(const bContext *C, wmGizmoGroupType *UNUSED( if (ob->type == OB_CAMERA) { Camera *camera = ob->data; /* TODO: support overrides. */ - if (camera->id.lib == NULL) { + if (!ID_IS_LINKED(camera)) { return true; } } @@ -408,7 +408,7 @@ static bool WIDGETGROUP_camera_view_poll(const bContext *C, wmGizmoGroupType *UN if (rv3d->persp == RV3D_CAMOB) { if (scene->r.mode & R_BORDER) { /* TODO: support overrides. */ - if (scene->id.lib == NULL) { + if (!ID_IS_LINKED(scene)) { return true; } } diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c index 7c6ce56eab0..1bdc2b2251e 100644 --- a/source/blender/editors/undo/memfile_undo.c +++ b/source/blender/editors/undo/memfile_undo.c @@ -116,7 +116,7 @@ static int memfile_undosys_step_id_reused_cb(LibraryIDLinkCallbackData *cb_data) BLI_assert((id_self->tag & LIB_TAG_UNDO_OLD_ID_REUSED) != 0); ID *id = *id_pointer; - if (id != NULL && id->lib == NULL && (id->tag & LIB_TAG_UNDO_OLD_ID_REUSED) == 0) { + if (id != NULL && !ID_IS_LINKED(id) && (id->tag & LIB_TAG_UNDO_OLD_ID_REUSED) == 0) { bool do_stop_iter = true; if (GS(id_self->name) == ID_OB) { Object *ob_self = (Object *)id_self; |