Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-03-26 10:47:55 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-03-26 12:25:25 +0300
commit40f8ddf8297a062968fc6a1523aa210d69c22626 (patch)
tree27e26dd44f3e8778ad06012d184fcb11ed175c94 /source/blender/editors/armature/pose_select.c
parent30fbf905ef8bd587eef43030b81d75b9eb704bec (diff)
3D View: move deselect all logic into an option
This removes `VIEW3D_OT_select_or_deselect_all`, adding a deselect_all option to the `VIEW3D_OT_select` operator. - Add utility functions to simplify de-selecting all. - Return true from selection functions when they change the selection to avoid redundant updates. - Use arrays of bases when passing objects between selection utility functions since some users require bases. - Fix logical error in box selection that updated all objects after the first hit.
Diffstat (limited to 'source/blender/editors/armature/pose_select.c')
-rw-r--r--source/blender/editors/armature/pose_select.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c
index 285901f8dd0..5ef61f0f6c6 100644
--- a/source/blender/editors/armature/pose_select.c
+++ b/source/blender/editors/armature/pose_select.c
@@ -172,10 +172,10 @@ bool ED_armature_pose_select_pick_with_buffer(
if (!extend && !deselect && !toggle) {
{
- uint objects_len = 0;
- Object **objects = BKE_object_pose_array_get_unique(view_layer, v3d, &objects_len);
- ED_pose_deselect_all_multi(objects, objects_len, SEL_DESELECT, true);
- MEM_freeN(objects);
+ uint bases_len = 0;
+ Base **bases = BKE_object_pose_base_array_get_unique(view_layer, v3d, &bases_len);
+ ED_pose_deselect_all_multi_ex(bases, bases_len, SEL_DESELECT, true);
+ MEM_freeN(bases);
}
nearBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
arm->act_bone = nearBone;
@@ -283,10 +283,10 @@ static bool ed_pose_is_any_selected(Object *ob, bool ignore_visibility)
return false;
}
-static bool ed_pose_is_any_selected_multi(Object **objects, uint objects_len, bool ignore_visibility)
+static bool ed_pose_is_any_selected_multi(Base **bases, uint bases_len, bool ignore_visibility)
{
- for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
- Object *ob_iter = objects[ob_index];
+ for (uint base_index = 0; base_index < bases_len; base_index++) {
+ Object *ob_iter = bases[base_index]->object;
if (ed_pose_is_any_selected(ob_iter, ignore_visibility)) {
return true;
}
@@ -294,19 +294,34 @@ static bool ed_pose_is_any_selected_multi(Object **objects, uint objects_len, bo
return false;
}
-void ED_pose_deselect_all_multi(Object **objects, uint objects_len, int select_mode, const bool ignore_visibility)
+bool ED_pose_deselect_all_multi_ex(Base **bases, uint bases_len, int select_mode, const bool ignore_visibility)
{
if (select_mode == SEL_TOGGLE) {
select_mode = ed_pose_is_any_selected_multi(
- objects, objects_len, ignore_visibility) ? SEL_DESELECT : SEL_SELECT;
+ bases, bases_len, ignore_visibility) ? SEL_DESELECT : SEL_SELECT;
}
- for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
- Object *ob_iter = objects[ob_index];
+ bool changed_multi = false;
+ for (uint base_index = 0; base_index < bases_len; base_index++) {
+ Object *ob_iter = bases[base_index]->object;
if (ED_pose_deselect_all(ob_iter, select_mode, ignore_visibility)) {
ED_pose_bone_select_tag_update(ob_iter);
+ changed_multi = true;
}
}
+ return changed_multi;
+}
+
+
+bool ED_pose_deselect_all_multi(bContext *C, int select_mode, const bool ignore_visibility)
+{
+ ViewContext vc;
+ ED_view3d_viewcontext_init(C, &vc);
+ uint bases_len = 0;
+ Base **bases = BKE_view_layer_array_from_bases_in_mode(vc.view_layer, vc.v3d, &bases_len, {.object_mode = OB_MODE_POSE,});
+ bool changed_multi = ED_pose_deselect_all_multi_ex(bases, bases_len, select_mode, ignore_visibility);
+ MEM_freeN(bases);
+ return changed_multi;
}
/* ***************** Selections ********************** */