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/armature
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/armature')
-rw-r--r--source/blender/editors/armature/pose_edit.c7
-rw-r--r--source/blender/editors/armature/pose_lib.c4
-rw-r--r--source/blender/editors/armature/pose_lib_2.c3
3 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index 90ee7c83436..2ad7a373012 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -23,6 +23,7 @@
#include "BKE_deform.h"
#include "BKE_global.h"
#include "BKE_layer.h"
+#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_report.h"
@@ -78,7 +79,7 @@ Object *ED_pose_object_from_context(bContext *C)
bool ED_object_posemode_enter_ex(struct Main *bmain, Object *ob)
{
- BLI_assert(!ID_IS_LINKED(ob));
+ BLI_assert(BKE_id_is_editable(bmain, &ob->id));
bool ok = false;
switch (ob->type) {
@@ -99,11 +100,11 @@ bool ED_object_posemode_enter_ex(struct Main *bmain, Object *ob)
bool ED_object_posemode_enter(bContext *C, Object *ob)
{
ReportList *reports = CTX_wm_reports(C);
- if (ID_IS_LINKED(ob)) {
+ struct Main *bmain = CTX_data_main(C);
+ if (!BKE_id_is_editable(bmain, &ob->id)) {
BKE_report(reports, RPT_WARNING, "Cannot pose libdata");
return false;
}
- struct Main *bmain = CTX_data_main(C);
bool ok = ED_object_posemode_enter_ex(bmain, ob);
if (ok) {
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_POSE, NULL);
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c
index 9796f6771d2..4b3ece64bf9 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -170,7 +170,7 @@ static bool has_poselib_pose_data_poll(bContext *C)
static bool has_poselib_pose_data_for_editing_poll(bContext *C)
{
Object *ob = get_poselib_object(C);
- return (ob && ob->poselib && !ID_IS_LINKED(ob->poselib));
+ return (ob && ob->poselib && BKE_id_is_editable(CTX_data_main(C), &ob->poselib->id));
}
/* ----------------------------------- */
@@ -377,7 +377,7 @@ static bool poselib_add_poll(bContext *C)
if (ED_operator_posemode(C)) {
Object *ob = get_poselib_object(C);
if (ob) {
- if ((ob->poselib == NULL) || !ID_IS_LINKED(ob->poselib)) {
+ if ((ob->poselib == NULL) || BKE_id_is_editable(CTX_data_main(C), &ob->poselib->id)) {
return true;
}
}
diff --git a/source/blender/editors/armature/pose_lib_2.c b/source/blender/editors/armature/pose_lib_2.c
index ced99f16794..9ee289145c4 100644
--- a/source/blender/editors/armature/pose_lib_2.c
+++ b/source/blender/editors/armature/pose_lib_2.c
@@ -103,7 +103,8 @@ static void poselib_keytag_pose(bContext *C, Scene *scene, PoseBlendData *pbd)
}
AnimData *adt = BKE_animdata_from_id(&pbd->ob->id);
- if (adt != NULL && adt->action != NULL && ID_IS_LINKED(&adt->action->id)) {
+ if (adt != NULL && adt->action != NULL &&
+ !BKE_id_is_editable(CTX_data_main(C), &adt->action->id)) {
/* Changes to linked-in Actions are not allowed. */
return;
}