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
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2022-03-28 18:34:36 +0300
committerBastien Montagne <bastien@blender.org>2022-03-29 18:59:55 +0300
commit5596f79821caae3d4c1eb608ce77371904f74b80 (patch)
tree92dbb06728dd7bbecfa71d17dbe25cde49dfdeb5 /source/blender/editors/util
parent354db59fb12a5ee595ae650ac3a736e3cc6df39d (diff)
LibOverride: Massive edits to 'editable' IDs checks in editors code.
Add new `BKE_id_is_editable` helper in `BKE_lib_id.h`, that supercedes previous check (simple `ID_IS_LINKED()` macro) for many editing cases. This allows to also take into account 'system override' (aka non-editable override) case. Ref: {T95707}.
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r--source/blender/editors/util/ed_util.c5
-rw-r--r--source/blender/editors/util/ed_util_ops.cc3
2 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 32d405df841..f125482460c 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -19,6 +19,7 @@
#include "BKE_collection.h"
#include "BKE_global.h"
+#include "BKE_lib_id.h"
#include "BKE_lib_remap.h"
#include "BKE_main.h"
#include "BKE_material.h"
@@ -124,8 +125,8 @@ void ED_editors_init(bContext *C)
if (obact == NULL || ob->type != obact->type) {
continue;
}
- /* Object mode is enforced for linked data (or their obdata). */
- if (ID_IS_LINKED(ob) || (ob_data != NULL && ID_IS_LINKED(ob_data))) {
+ /* Object mode is enforced for non-editable data (or their obdata). */
+ if (!BKE_id_is_editable(bmain, &ob->id) || (ob_data != NULL && !BKE_id_is_editable(bmain, ob_data))) {
continue;
}
diff --git a/source/blender/editors/util/ed_util_ops.cc b/source/blender/editors/util/ed_util_ops.cc
index 25deacbcdd1..ccc28353518 100644
--- a/source/blender/editors/util/ed_util_ops.cc
+++ b/source/blender/editors/util/ed_util_ops.cc
@@ -226,7 +226,8 @@ static int lib_id_fake_user_toggle_exec(bContext *C, wmOperator *op)
ID *id = (ID *)idptr.data;
- if (ID_IS_LINKED(id) || (ELEM(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT, ID_OB, ID_WS))) {
+ if (!BKE_id_is_editable(CTX_data_main(C), 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;
}