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:
authorPhilipp Oeser <info@graphics-engineer.com>2021-01-15 21:01:57 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2021-01-18 17:00:37 +0300
commit1c2b2037956bf1d46a10842a4b503d20714bdcf2 (patch)
tree8c8a61cc26ced33d61f642c4e9ca2aedea839e2f /source/blender/editors/armature
parentb4530deec478e1982156a2a76bd4bdadaf651fb3 (diff)
Fix T84600: prevent bone groups operators on proxies and library
overrides Editing bone groups is not supported on proxies/overrides [changes a re lost on file reload], need to do proper polling (and also prevent this from rna) for: - adding bone groups - removing bone groups - renaming bone groups - setting bone groups colors Previously, this was hinted at by setting the layout inactive, with preoper polls, this is now not needed anymore. note: Selection of bone groups actually makes sense here and is supported, so this is not prevented in this patch, but UI wise this is not nice in the override case, because one cannot set an active_index (aka select) in the UI list. Maniphest Tasks: T84600 Differential Revision: https://developer.blender.org/D10131
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r--source/blender/editors/armature/pose_group.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c
index 1e5004ba341..6ef46a792c4 100644
--- a/source/blender/editors/armature/pose_group.c
+++ b/source/blender/editors/armature/pose_group.c
@@ -55,6 +55,21 @@
/* ********************************************** */
/* Bone Groups */
+static bool pose_group_poll(bContext *C)
+{
+ if (!ED_operator_posemode_context(C)) {
+ return false;
+ }
+
+ Object *obpose = ED_pose_object_from_context(C);
+ if ((obpose->proxy != NULL) || (obpose->proxy_group != NULL) || ID_IS_OVERRIDE_LIBRARY(obpose)) {
+ CTX_wm_operator_poll_msg_set(C, "Cannot edit bonegroups for proxies or library overrides");
+ return false;
+ }
+
+ return true;
+}
+
static int pose_group_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = ED_pose_object_from_context(C);
@@ -82,7 +97,7 @@ void POSE_OT_group_add(wmOperatorType *ot)
/* api callbacks */
ot->exec = pose_group_add_exec;
- ot->poll = ED_operator_posemode_context;
+ ot->poll = pose_group_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -116,7 +131,7 @@ void POSE_OT_group_remove(wmOperatorType *ot)
/* api callbacks */
ot->exec = pose_group_remove_exec;
- ot->poll = ED_operator_posemode_context;
+ ot->poll = pose_group_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -233,7 +248,7 @@ void POSE_OT_group_assign(wmOperatorType *ot)
/* api callbacks */
ot->invoke = pose_groups_menu_invoke;
ot->exec = pose_group_assign_exec;
- ot->poll = ED_operator_posemode_context;
+ ot->poll = pose_group_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -281,7 +296,7 @@ void POSE_OT_group_unassign(wmOperatorType *ot)
/* api callbacks */
ot->exec = pose_group_unassign_exec;
- ot->poll = ED_operator_posemode_context;
+ ot->poll = pose_group_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -346,7 +361,7 @@ void POSE_OT_group_move(wmOperatorType *ot)
/* api callbacks */
ot->exec = group_move_exec;
- ot->poll = ED_operator_posemode_context;
+ ot->poll = pose_group_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -437,7 +452,7 @@ void POSE_OT_group_sort(wmOperatorType *ot)
/* api callbacks */
ot->exec = group_sort_exec;
- ot->poll = ED_operator_posemode_context;
+ ot->poll = pose_group_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;