Fix T76445: Selecting an object no longer cycles past the active

In 2.79, selecting an object would cycle past the first object
even if selection cycling wasn't in use.

Restore this behavior as it wasn't intentionally removed
and it's useful to be able to select an object behind the
current active object.
This commit is contained in:
Campbell Barton 2020-05-06 12:18:18 +10:00
parent c036ef1369
commit c6aa014d3a
Notes: blender-bot 2023-02-14 10:04:50 +01:00
Referenced by issue #76445, selection of object behind other objects by clicking multiple times is reset by mouse movement.
1 changed files with 15 additions and 4 deletions

View File

@ -1663,20 +1663,31 @@ static int selectbuffer_ret_hits_5(uint *buffer,
/**
* Populate a select buffer with objects and bones, if there are any.
* Checks three selection levels and compare.
*
* \param do_nearest_xray_if_supported: When set, read in hits that don't stop
* at the nearest surface. The hit's must still be ordered by depth.
* Needed so we can step to the next, non-active object when it's already selected, see: T76445.
*/
static int mixed_bones_object_selectbuffer(ViewContext *vc,
uint *buffer,
const int mval[2],
eV3DSelectObjectFilter select_filter,
bool do_nearest)
bool do_nearest,
bool do_nearest_xray_if_supported)
{
rcti rect;
int hits15, hits9 = 0, hits5 = 0;
bool has_bones15 = false, has_bones9 = false, has_bones5 = false;
const int select_mode = (do_nearest ? VIEW3D_SELECT_PICK_NEAREST : VIEW3D_SELECT_PICK_ALL);
int select_mode = (do_nearest ? VIEW3D_SELECT_PICK_NEAREST : VIEW3D_SELECT_PICK_ALL);
int hits = 0;
if (do_nearest_xray_if_supported) {
if ((U.gpu_flag & USER_GPU_FLAG_NO_DEPT_PICK) == 0) {
select_mode = VIEW3D_SELECT_PICK_ALL;
}
}
/* we _must_ end cache before return, use 'goto finally' */
view3d_opengl_select_cache_begin();
@ -1780,7 +1791,7 @@ static int mixed_bones_object_selectbuffer_extended(ViewContext *vc,
do_nearest = do_nearest && !enumerate;
int hits = mixed_bones_object_selectbuffer(vc, buffer, mval, select_filter, do_nearest);
int hits = mixed_bones_object_selectbuffer(vc, buffer, mval, select_filter, do_nearest, true);
return hits;
}
@ -1912,7 +1923,7 @@ Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2])
const bool do_nearest = !XRAY_ACTIVE(vc.v3d);
const int hits = mixed_bones_object_selectbuffer(
&vc, buffer, mval, VIEW3D_SELECT_FILTER_NOP, do_nearest);
&vc, buffer, mval, VIEW3D_SELECT_FILTER_NOP, do_nearest, false);
if (hits > 0) {
const bool has_bones = selectbuffer_has_bones(buffer, hits);