diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-12-06 06:00:07 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-12-06 06:00:07 +0300 |
commit | 1cc070506232cc59e993cc8ddad9b272c413a860 (patch) | |
tree | b216d3cbcf707df2ec224d68961cb015cf01e5fe /source/blender/editors/armature | |
parent | 8afc4cf3ea4ffcfc1a60c2caeb27c532eaee4462 (diff) |
Armature: support select-linked deselection
Matches edit-mesh mode.
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/armature_select.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index 1c5219e94c8..d817fbf5229 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -286,12 +286,11 @@ void *get_nearest_bone( /* **************** EditMode stuff ********************** */ -/* called in space.c */ -/* previously "selectconnected_armature" */ -static int armature_select_linked_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) +static int armature_select_linked_invoke(bContext *C, wmOperator *op, const wmEvent *event) { bArmature *arm; EditBone *bone, *curBone, *next; + const bool sel = !RNA_boolean_get(op->ptr, "deselect"); view3d_operator_needs_opengl(C); @@ -306,7 +305,12 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *UNUSED(op), co /* Select parents */ for (curBone = bone; curBone; curBone = next) { if ((curBone->flag & BONE_UNSELECTABLE) == 0) { - curBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); + if (sel) { + curBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); + } + else { + curBone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); + } } if (curBone->flag & BONE_CONNECTED) @@ -321,7 +325,12 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *UNUSED(op), co next = curBone->next; if ((curBone->parent == bone) && (curBone->flag & BONE_UNSELECTABLE) == 0) { if (curBone->flag & BONE_CONNECTED) { - curBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); + if (sel) { + curBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); + } + else { + curBone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); + } bone = curBone; break; } @@ -361,6 +370,8 @@ void ARMATURE_OT_select_linked(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", ""); } /* utility function for get_nearest_editbonepoint */ |