From 0a69e3b307f05aeab8bd84f69560b4118c9bfaf2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 20 Nov 2017 02:28:07 +1100 Subject: Option not to select with un-hide D1518 from @mba105 w/ edits --- source/blender/editors/armature/armature_edit.c | 8 +++++--- source/blender/editors/armature/pose_edit.c | 17 +++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'source/blender/editors/armature') diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index ab9a3e068d0..a2fbfe645f7 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -1564,17 +1564,18 @@ void ARMATURE_OT_hide(wmOperatorType *ot) RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected"); } -static int armature_reveal_exec(bContext *C, wmOperator *UNUSED(op)) +static int armature_reveal_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); bArmature *arm = obedit->data; EditBone *ebone; + const bool select = RNA_boolean_get(op->ptr, "select"); for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { if (arm->layer & ebone->layer) { if (ebone->flag & BONE_HIDDEN_A) { if (!(ebone->flag & BONE_UNSELECTABLE)) { - ebone->flag |= (BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL); + SET_FLAG_FROM_TEST(ebone->flag, select, (BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL)); } ebone->flag &= ~BONE_HIDDEN_A; } @@ -1593,7 +1594,7 @@ void ARMATURE_OT_reveal(wmOperatorType *ot) /* identifiers */ ot->name = "Reveal Bones"; ot->idname = "ARMATURE_OT_reveal"; - ot->description = "Unhide all bones that have been tagged to be hidden in Edit Mode"; + ot->description = "Reveal all bones hidden in Edit Mode"; /* api callbacks */ ot->exec = armature_reveal_exec; @@ -1602,4 +1603,5 @@ void ARMATURE_OT_reveal(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + RNA_def_boolean(ot->srna, "select", true, "Select", ""); } diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 57c01157f8e..acbf23ecf82 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -1098,16 +1098,18 @@ void POSE_OT_hide(wmOperatorType *ot) RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", ""); } -static int show_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) +static int show_pose_bone_cb(Object *ob, Bone *bone, void *data) { + const bool select = GET_INT_FROM_POINTER(data); + bArmature *arm = ob->data; if (arm->layer & bone->layer) { if (bone->flag & BONE_HIDDEN_P) { - bone->flag &= ~BONE_HIDDEN_P; if (!(bone->flag & BONE_UNSELECTABLE)) { - bone->flag |= BONE_SELECTED; + SET_FLAG_FROM_TEST(bone->flag, select, BONE_SELECTED); } + bone->flag &= ~BONE_HIDDEN_P; } } @@ -1115,12 +1117,13 @@ static int show_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) } /* active object is armature in posemode, poll checked */ -static int pose_reveal_exec(bContext *C, wmOperator *UNUSED(op)) +static int pose_reveal_exec(bContext *C, wmOperator *op) { Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); bArmature *arm = ob->data; + const bool select = RNA_boolean_get(op->ptr, "select"); - bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone_cb); + bone_looper(ob, arm->bonebase.first, SET_INT_IN_POINTER(select), show_pose_bone_cb); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob); @@ -1133,7 +1136,7 @@ void POSE_OT_reveal(wmOperatorType *ot) /* identifiers */ ot->name = "Reveal Selected"; ot->idname = "POSE_OT_reveal"; - ot->description = "Unhide all bones that have been tagged to be hidden in Pose Mode"; + ot->description = "Reveal all bones hidden in Pose Mode"; /* api callbacks */ ot->exec = pose_reveal_exec; @@ -1141,6 +1144,8 @@ void POSE_OT_reveal(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "select", true, "Select", ""); } /* ********************************************** */ -- cgit v1.2.3