[Bf-blender-cvs] [1cc07050623] blender2.8: Armature: support select-linked deselection

Campbell Barton noreply at git.blender.org
Thu Dec 6 04:01:08 CET 2018


Commit: 1cc070506232cc59e993cc8ddad9b272c413a860
Author: Campbell Barton
Date:   Thu Dec 6 14:00:07 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB1cc070506232cc59e993cc8ddad9b272c413a860

Armature: support select-linked deselection

Matches edit-mesh mode.

===================================================================

M	release/scripts/presets/keyconfig/keymap_data/blender_default.py
M	source/blender/editors/armature/armature_select.c

===================================================================

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 78f71999065..4464a073007 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -3920,7 +3920,10 @@ def km_armature(params):
         ("armature.select_more", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "ctrl": True}, None),
         ("armature.select_less", {"type": 'NUMPAD_MINUS', "value": 'PRESS', "ctrl": True}, None),
         ("armature.select_similar", {"type": 'G', "value": 'PRESS', "shift": True}, None),
-        ("armature.select_linked", {"type": 'L', "value": 'PRESS'}, None),
+        ("armature.select_linked", {"type": 'L', "value": 'PRESS'},
+         {"properties": [("deselect", False)]}),
+        ("armature.select_linked", {"type": 'L', "value": 'PRESS', "shift": True},
+         {"properties": [("deselect", True)]}),
         ("armature.shortest_path_pick", {"type": params.select_mouse, "value": params.select_mouse_value, "ctrl": True}, None),
         # Editing.
         op_menu("VIEW3D_MT_edit_armature_delete", {"type": 'X', "value": 'PRESS'}),
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 */



More information about the Bf-blender-cvs mailing list