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/blenloader | |
parent | 1bb2077250aed65e9445468161e01aa219a89624 (diff) |
Cleanup: Use `ID_IS_LINKED` instead of direct `id.lib` pointer check.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/blend_validate.c | 6 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 6 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/blenloader/intern/blend_validate.c b/source/blender/blenloader/intern/blend_validate.c index 5b093223fda..7d641d976e3 100644 --- a/source/blender/blenloader/intern/blend_validate.c +++ b/source/blender/blenloader/intern/blend_validate.c @@ -64,7 +64,7 @@ bool BLO_main_validate_libraries(Main *bmain, ReportList *reports) int i = set_listbasepointers(bmain, lbarray); while (i--) { for (ID *id = lbarray[i]->first; id != NULL; id = id->next) { - if (id->lib != NULL) { + if (ID_IS_LINKED(id)) { is_valid = false; BKE_reportf(reports, RPT_ERROR, @@ -115,7 +115,7 @@ bool BLO_main_validate_libraries(Main *bmain, ReportList *reports) int totnames = 0; LinkNode *names = BLO_blendhandle_get_datablock_names(bh, GS(id->name), false, &totnames); for (; id != NULL; id = id->next) { - if (id->lib == NULL) { + if (!ID_IS_LINKED(id)) { is_valid = false; BKE_reportf(reports, RPT_ERROR, @@ -179,7 +179,7 @@ bool BLO_main_validate_shapekeys(Main *bmain, ReportList *reports) if (!BKE_key_idtype_support(GS(id->name))) { break; } - if (id->lib == NULL) { + if (!ID_IS_LINKED(id)) { /* We assume lib data is valid... */ Key *shapekey = BKE_key_from_id(id); if (shapekey != NULL && shapekey->from != id) { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 2ee66206878..3e9ea8db758 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1625,7 +1625,7 @@ static void change_link_placeholder_to_real_ID_pointer(ListBase *mainlist, void blo_clear_proxy_pointers_from_lib(Main *oldmain) { LISTBASE_FOREACH (Object *, ob, &oldmain->objects) { - if (ob->id.lib != NULL && ob->proxy_from != NULL && ob->proxy_from->id.lib == NULL) { + if (ID_IS_LINKED(ob) && ob->proxy_from != NULL && !ID_IS_LINKED(ob->proxy_from)) { ob->proxy_from = NULL; } } diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index f77d0361e51..2598c53a5e0 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -444,7 +444,7 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) Collection *collection = BKE_collection_add(bmain, collection_master, name); collection->id.lib = scene->id.lib; - if (collection->id.lib != NULL) { + if (ID_IS_LINKED(collection)) { collection->id.tag |= LIB_TAG_INDIRECT; } collections[layer] = collection; @@ -574,10 +574,10 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene) static void do_version_collection_propagate_lib_to_children(Collection *collection) { - if (collection->id.lib != NULL) { + if (ID_IS_LINKED(collection)) { for (CollectionChild *collection_child = collection->children.first; collection_child != NULL; collection_child = collection_child->next) { - if (collection_child->collection->id.lib == NULL) { + if (!ID_IS_LINKED(collection_child->collection)) { collection_child->collection->id.lib = collection->id.lib; } do_version_collection_propagate_lib_to_children(collection_child->collection); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 90d58514eb5..56ff7151cb1 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -840,7 +840,7 @@ static void write_renderinfo(WriteData *wd, Main *mainvar) current_screen_compat(mainvar, false, &curscreen, &curscene, &view_layer); LISTBASE_FOREACH (Scene *, sce, &mainvar->scenes) { - if (sce->id.lib == NULL && (sce == curscene || (sce->r.scemode & R_BG_RENDER))) { + if (!ID_IS_LINKED(sce) && (sce == curscene || (sce->r.scemode & R_BG_RENDER))) { RenderInfo data; data.sfra = sce->r.sfra; data.efra = sce->r.efra; |