From 1d88aeb95fc40771be7ef3a835af4206c845aa9b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 Mar 2022 14:37:20 +1100 Subject: View 3D: support for select passthrough when picking selected items Currently this isn't used in the key-map, it will eventually allow the 3D viewports tweak tool to match the behavior of other editors that support tweaking a selection without first de-selecting all other elements. --- source/blender/editors/armature/armature_select.c | 22 ++++++++++++------- source/blender/editors/armature/pose_select.c | 26 ++++++++++++++--------- 2 files changed, 30 insertions(+), 18 deletions(-) (limited to 'source/blender/editors/armature') diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index d1a5c128c35..08d5d6558e0 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -965,14 +965,20 @@ bool ED_armature_edit_select_pick_bone(bContext *C, } } - if ((params->sel_op == SEL_OP_SET) && (found || params->deselect_all)) { - /* Deselect everything. */ - uint bases_len = 0; - Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data( - view_layer, v3d, &bases_len); - ED_armature_edit_deselect_all_multi_ex(bases, bases_len); - MEM_freeN(bases); - changed = true; + if (params->sel_op == SEL_OP_SET) { + if ((found && params->select_passthrough) && + (ED_armature_ebone_selectflag_get(ebone) & selmask)) { + found = false; + } + else if (found || params->deselect_all) { + /* Deselect everything. */ + uint bases_len = 0; + Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data( + view_layer, v3d, &bases_len); + ED_armature_edit_deselect_all_multi_ex(bases, bases_len); + MEM_freeN(bases); + changed = true; + } } if (found) { diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index 1cf56389580..8790a10f3e5 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -136,19 +136,25 @@ bool ED_armature_pose_select_pick_bone(ViewLayer *view_layer, } } - if ((params->sel_op == SEL_OP_SET) && (found || params->deselect_all)) { - /* Don't use 'BKE_object_pose_base_array_get_unique' - * because we may be selecting from object mode. */ - FOREACH_VISIBLE_BASE_BEGIN (view_layer, v3d, base_iter) { - Object *ob_iter = base_iter->object; - if ((ob_iter->type == OB_ARMATURE) && (ob_iter->mode & OB_MODE_POSE)) { - if (ED_pose_deselect_all(ob_iter, SEL_DESELECT, true)) { - ED_pose_bone_select_tag_update(ob_iter); + if (params->sel_op == SEL_OP_SET) { + if ((found && params->select_passthrough) && (bone->flag & BONE_SELECTED)) { + found = false; + } + else if (found || params->deselect_all) { + /* Deselect everything. */ + /* Don't use 'BKE_object_pose_base_array_get_unique' + * because we may be selecting from object mode. */ + FOREACH_VISIBLE_BASE_BEGIN (view_layer, v3d, base_iter) { + Object *ob_iter = base_iter->object; + if ((ob_iter->type == OB_ARMATURE) && (ob_iter->mode & OB_MODE_POSE)) { + if (ED_pose_deselect_all(ob_iter, SEL_DESELECT, true)) { + ED_pose_bone_select_tag_update(ob_iter); + } } } + FOREACH_VISIBLE_BASE_END; + changed = true; } - FOREACH_VISIBLE_BASE_END; - changed = true; } if (found) { -- cgit v1.2.3