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
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2022-02-17 19:07:25 +0300
committerBastien Montagne <bastien@blender.org>2022-02-17 19:08:00 +0300
commitb5e3700b793f730b404315493ceadb60e4af708d (patch)
tree6d5374dcbe17ef359dd0c05ce90e1202e30322c0 /source
parentc99d1d5d0db8ac7af0d479341e1bd87ead681387 (diff)
Cleanup: Replace direct `id.lib` pointer checks with `ID_IS_LINKED` macro usages.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/brush.c2
-rw-r--r--source/blender/blenkernel/intern/lib_id_delete.c4
-rw-r--r--source/blender/blenkernel/intern/lib_override.c2
-rw-r--r--source/blender/blenloader/intern/versioning_common.cc2
-rw-r--r--source/blender/editors/util/ed_util_ops.cc2
-rw-r--r--source/blender/makesdna/DNA_scene_types.h2
6 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index f091ebe1e32..4531783c72a 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -147,7 +147,7 @@ static void brush_make_local(Main *bmain, ID *id, const int flags)
/* NOTE: assert below ensures that the comment above is valid, and that that exception is
* acceptable for the time being. */
BKE_lib_id_make_local(bmain, &brush->clone.image->id, 0);
- BLI_assert(brush->clone.image->id.lib == NULL && brush->clone.image->id.newid == NULL);
+ BLI_assert(!ID_IS_LINKED(brush->clone.image) && brush->clone.image->id.newid == NULL);
}
if (force_local) {
diff --git a/source/blender/blenkernel/intern/lib_id_delete.c b/source/blender/blenkernel/intern/lib_id_delete.c
index cf25af1c637..ba5556c8b2d 100644
--- a/source/blender/blenkernel/intern/lib_id_delete.c
+++ b/source/blender/blenkernel/intern/lib_id_delete.c
@@ -234,7 +234,7 @@ static size_t id_delete(Main *bmain, const bool do_tagged_deletion)
for (id = lb->first; id; id = id_next) {
id_next = id->next;
/* NOTE: in case we delete a library, we also delete all its datablocks! */
- if ((id->tag & tag) || (id->lib != NULL && (id->lib->id.tag & tag))) {
+ if ((id->tag & tag) || (ID_IS_LINKED(id) && (id->lib->id.tag & tag))) {
BLI_remlink(lb, id);
BLI_addtail(&tagged_deleted_ids, id);
/* Do not tag as no_main now, we want to unlink it first (lower-level ID management
@@ -290,7 +290,7 @@ static size_t id_delete(Main *bmain, const bool do_tagged_deletion)
for (id = lb->first; id; id = id_next) {
id_next = id->next;
/* NOTE: in case we delete a library, we also delete all its datablocks! */
- if ((id->tag & tag) || (id->lib != NULL && (id->lib->id.tag & tag))) {
+ if ((id->tag & tag) || (ID_IS_LINKED(id) && (id->lib->id.tag & tag))) {
id->tag |= tag;
BKE_id_remapper_add(remapper, id, NULL);
}
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index 02cdd6fcd20..8a988bd30b5 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -2127,7 +2127,7 @@ static void lib_override_library_main_resync_on_library_indirect_level(
"ID override %s from library level %d still found as needing resync, when all "
"IDs from that level should have been processed after tackling library level %d",
id->name,
- id->lib != NULL ? id->lib->temp_index : 0,
+ ID_IS_LINKED(id) ? id->lib->temp_index : 0,
library_indirect_level);
id->tag &= ~LIB_TAG_LIB_OVERRIDE_NEED_RESYNC;
}
diff --git a/source/blender/blenloader/intern/versioning_common.cc b/source/blender/blenloader/intern/versioning_common.cc
index 6aac76642d5..281769410bd 100644
--- a/source/blender/blenloader/intern/versioning_common.cc
+++ b/source/blender/blenloader/intern/versioning_common.cc
@@ -56,7 +56,7 @@ ID *do_versions_rename_id(Main *bmain,
ListBase *lb = which_libbase(bmain, id_type);
ID *id = nullptr;
LISTBASE_FOREACH (ID *, idtest, lb) {
- if (idtest->lib == nullptr) {
+ if (!ID_IS_LINKED(idtest)) {
if (STREQ(idtest->name + 2, name_src)) {
id = idtest;
}
diff --git a/source/blender/editors/util/ed_util_ops.cc b/source/blender/editors/util/ed_util_ops.cc
index 014944da916..25deacbcdd1 100644
--- a/source/blender/editors/util/ed_util_ops.cc
+++ b/source/blender/editors/util/ed_util_ops.cc
@@ -226,7 +226,7 @@ static int lib_id_fake_user_toggle_exec(bContext *C, wmOperator *op)
ID *id = (ID *)idptr.data;
- if ((id->lib != nullptr) || (ELEM(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT, ID_OB, ID_WS))) {
+ if (ID_IS_LINKED(id) || (ELEM(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT, ID_OB, ID_WS))) {
BKE_report(op->reports, RPT_ERROR, "Data-block type does not support fake user");
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 0d42abdb363..672af019177 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1988,7 +1988,7 @@ extern const char *RE_engine_id_CYCLES;
((v3d == NULL) || (((1 << (base)->object->type) & (v3d)->object_type_exclude_select) == 0)) && \
(((base)->flag & BASE_SELECTABLE) != 0))
#define BASE_SELECTED(v3d, base) (BASE_VISIBLE(v3d, base) && (((base)->flag & BASE_SELECTED) != 0))
-#define BASE_EDITABLE(v3d, base) (BASE_VISIBLE(v3d, base) && ((base)->object->id.lib == NULL))
+#define BASE_EDITABLE(v3d, base) (BASE_VISIBLE(v3d, base) && !ID_IS_LINKED((base)->object))
#define BASE_SELECTED_EDITABLE(v3d, base) \
(BASE_EDITABLE(v3d, base) && (((base)->flag & BASE_SELECTED) != 0))