diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-01-15 08:56:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-01-15 09:09:52 +0300 |
commit | df36e1c5dd3c5843bcdc58a7021c6defc25d56ad (patch) | |
tree | aca2080f7d5e17d72f4119aa8d8ca9839e461bf6 /source | |
parent | dedceb9395bb4383f7986540d6de551e4044640e (diff) |
Fix T71091: Object restrict selection conflicts with pose selection
Support pose bone selection when the object has hide_select enabled.
This is consistent with how all other modes work.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 19 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 15 |
2 files changed, 28 insertions, 6 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 3174edb0c05..2fbb0a740cf 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2254,6 +2254,10 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, FOREACH_OBJECT_IN_MODE_END; } else { + /* When selecting pose-bones in pose mode, check for visibility not select-ability + * as pose-bones have their own selection restriction flag. */ + const bool use_pose_exception = (DST.draw_ctx.object_pose != NULL); + const int object_type_exclude_select = (v3d->object_type_exclude_viewport | v3d->object_type_exclude_select); bool filter_exclude = false; @@ -2261,8 +2265,19 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, if (!BKE_object_is_visible_in_viewport(v3d, ob)) { continue; } - if ((ob->base_flag & BASE_SELECTABLE) && - (object_type_exclude_select & (1 << ob->type)) == 0) { + + if (use_pose_exception && (ob->mode & OB_MODE_POSE)) { + if ((ob->base_flag & BASE_VISIBLE_VIEWLAYER) == 0) { + continue; + } + } + else { + if ((ob->base_flag & BASE_SELECTABLE) == 0) { + continue; + } + } + + if ((object_type_exclude_select & (1 << ob->type)) == 0) { if (object_filter_fn != NULL) { if (ob->base_flag & BASE_FROM_DUPLI) { /* pass (use previous filter_exclude value) */ diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 85e9a2d7680..89baf60bd8c 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1785,7 +1785,13 @@ static int mixed_bones_object_selectbuffer_extended(ViewContext *vc, return hits; } -/* returns basact */ +/** + * \param has_bones: When true, skip non-bone hits, also allow bases to be used + * that are visible but not select-able, + * since you may be in pose mode with an an unselect-able object. + * + * \return the active base or NULL. + */ static Base *mouse_select_eval_buffer(ViewContext *vc, const uint *buffer, int hits, @@ -1827,7 +1833,7 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, base = FIRSTBASE(view_layer); while (base) { - if (BASE_SELECTABLE(v3d, base)) { + if (has_bones ? BASE_VISIBLE(v3d, base) : BASE_SELECTABLE(v3d, base)) { if (base->object->runtime.select_id == selcol) { break; } @@ -1844,7 +1850,8 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, while (base) { /* skip objects with select restriction, to prevent prematurely ending this loop * with an un-selectable choice */ - if ((base->flag & BASE_SELECTABLE) == 0) { + if (has_bones ? (base->flag & BASE_VISIBLE_VIEWLAYER) == 0 : + (base->flag & BASE_SELECTABLE) == 0) { base = base->next; if (base == NULL) { base = FIRSTBASE(view_layer); @@ -1854,7 +1861,7 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, } } - if (BASE_SELECTABLE(v3d, base)) { + if (has_bones ? BASE_VISIBLE(v3d, base) : BASE_SELECTABLE(v3d, base)) { for (a = 0; a < hits; a++) { if (has_bones) { /* skip non-bone objects */ |