[Bf-blender-cvs] [865fdd61df0] blender2.8: 3D View: minor selection tweaks

Campbell Barton noreply at git.blender.org
Thu Mar 1 12:00:05 CET 2018


Commit: 865fdd61df0eb90c4f712430fb8dbc0d37087448
Author: Campbell Barton
Date:   Thu Mar 1 22:01:46 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB865fdd61df0eb90c4f712430fb8dbc0d37087448

3D View: minor selection tweaks

- don't initialize the GL context when cache is used.
- don't run second pass when the first one has no hits.

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

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

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

diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 0afef34194c..4225ee8b425 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -888,7 +888,7 @@ static bool drw_select_loop_pass(eDRWSelectStage stage, void *user_data)
 		}
 		if (data->gpu_select_mode == GPU_SELECT_NEAREST_FIRST_PASS) {
 			data->gpu_select_mode = GPU_SELECT_NEAREST_SECOND_PASS;
-			continue_pass = true;
+			continue_pass = (hits > 0);
 		}
 		data->pass += 1;
 	}
@@ -961,11 +961,6 @@ int view3d_opengl_select(
 	UI_Theme_Store(&theme_state);
 	UI_SetTheme(SPACE_VIEW3D, RGN_TYPE_WINDOW);
 
-#ifndef WITH_OPENGL_LEGACY
-	/* All of the queries need to be perform on the drawing context. */
-	DRW_opengl_context_enable();
-#endif
-
 	/* Re-use cache (rect must be smaller then the cached)
 	 * other context is assumed to be unchanged */
 	if (GPU_select_is_cached()) {
@@ -975,6 +970,11 @@ int view3d_opengl_select(
 		goto finally;
 	}
 
+#ifndef WITH_OPENGL_LEGACY
+	/* All of the queries need to be perform on the drawing context. */
+	DRW_opengl_context_enable();
+#endif
+
 	G.f |= G_PICKSEL;
 
 	/* Important we use the 'viewmat' and don't re-calculate since
@@ -1034,12 +1034,12 @@ int view3d_opengl_select(
 	if (vc->rv3d->rflag & RV3D_CLIPPING)
 		ED_view3d_clipping_disable();
 
-finally:
-
 #ifndef WITH_OPENGL_LEGACY
 	DRW_opengl_context_disable();
 #endif
 
+finally:
+
 	if (hits < 0) printf("Too many objects in select buffer\n");  /* XXX make error message */
 
 	UI_Theme_Restore(&theme_state);



More information about the Bf-blender-cvs mailing list