[Bf-blender-cvs] [c6aa014d3ab] blender-v2.83-release: Fix T76445: Selecting an object no longer cycles past the active

Campbell Barton noreply at git.blender.org
Wed May 6 04:23:34 CEST 2020


Commit: c6aa014d3abb0a2240cb7293d58c86be16b02ab3
Author: Campbell Barton
Date:   Wed May 6 12:18:18 2020 +1000
Branches: blender-v2.83-release
https://developer.blender.org/rBc6aa014d3abb0a2240cb7293d58c86be16b02ab3

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.

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

M	source/blender/editors/space_view3d/view3d_select.c

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

diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 0a272db1344..67c61b4ecac 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -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);



More information about the Bf-blender-cvs mailing list