From 1c24c04e6023f2d2a328dfcdc9f86cd381d029a3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 5 Apr 2018 18:20:27 +0200 Subject: Remove workspace object mode, reverts changes w/ 2.8 This caused too many problems syncing object modes with multiple objects/windows/workspaces, see: D3130 for details. --- source/blender/editors/armature/pose_select.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source/blender/editors/armature/pose_select.c') diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index 04e453c44c6..a66cedd8d4f 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -134,7 +134,6 @@ void ED_pose_bone_select(Object *ob, bPoseChannel *pchan, bool select) /* called from editview.c, for mode-less pose selection */ /* assumes scene obact and basact is still on old situation */ bool ED_do_pose_selectbuffer( - const EvaluationContext *eval_ctx, ViewLayer *view_layer, Base *base, const unsigned int *buffer, short hits, bool extend, bool deselect, bool toggle, bool do_nearest) { @@ -144,7 +143,7 @@ bool ED_do_pose_selectbuffer( if (!ob || !ob->pose) return 0; Object *ob_act = OBACT(view_layer); - Object *obedit = OBEDIT_FROM_EVAL_CTX(eval_ctx); + Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); nearBone = get_bone_from_selectbuffer(base, obedit, buffer, hits, 1, do_nearest); @@ -157,7 +156,7 @@ bool ED_do_pose_selectbuffer( * note, special exception for armature mode so we can do multi-select * we could check for multi-select explicitly but think its fine to * always give predictable behavior in weight paint mode - campbell */ - if ((ob_act == NULL) || ((ob_act != ob) && (eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT) == 0)) { + if ((ob_act == NULL) || ((ob_act != ob) && (ob_act->mode & OB_MODE_WEIGHT_PAINT) == 0)) { /* when we are entering into posemode via toggle-select, * from another active object - always select the bone. */ if (!extend && !deselect && toggle) { @@ -198,7 +197,7 @@ bool ED_do_pose_selectbuffer( if (ob_act) { /* in weightpaint we select the associated vertex group too */ - if (eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT) { + if (ob_act->mode & OB_MODE_WEIGHT_PAINT) { if (nearBone == arm->act_bone) { ED_vgroup_select_by_name(ob_act, nearBone->name); DEG_id_tag_update(&ob_act->id, OB_RECALC_DATA); @@ -876,7 +875,6 @@ void POSE_OT_select_grouped(wmOperatorType *ot) */ static int pose_select_mirror_exec(bContext *C, wmOperator *op) { - const WorkSpace *workspace = CTX_wm_workspace(C); Object *ob_act = CTX_data_active_object(C); Object *ob = BKE_object_pose_armature_get(ob_act); bArmature *arm; @@ -884,6 +882,10 @@ static int pose_select_mirror_exec(bContext *C, wmOperator *op) const bool active_only = RNA_boolean_get(op->ptr, "only_active"); const bool extend = RNA_boolean_get(op->ptr, "extend"); + if ((ob && (ob->mode & OB_MODE_POSE)) == 0) { + return OPERATOR_CANCELLED; + } + arm = ob->data; for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { @@ -920,7 +922,7 @@ static int pose_select_mirror_exec(bContext *C, wmOperator *op) arm->act_bone = pchan_mirror_act->bone; /* in weightpaint we select the associated vertex group too */ - if (workspace->object_mode & OB_MODE_WEIGHT_PAINT) { + if (ob_act->mode & OB_MODE_WEIGHT_PAINT) { ED_vgroup_select_by_name(ob_act, pchan_mirror_act->name); DEG_id_tag_update(&ob_act->id, OB_RECALC_DATA); } -- cgit v1.2.3