[Bf-blender-cvs] [87128eda79] temp-select-pick: Testing functions: for mixed_bones_object_selectbuffer
Campbell Barton
noreply at git.blender.org
Tue Mar 7 16:20:11 CET 2017
Commit: 87128eda7985b41693060c1b71499790fde3faf5
Author: Campbell Barton
Date: Mon Mar 6 22:22:21 2017 +1100
Branches: temp-select-pick
https://developer.blender.org/rB87128eda7985b41693060c1b71499790fde3faf5
Testing functions: for mixed_bones_object_selectbuffer
- OpenGL Select for old behavior
- Occlusion Queries for possible new behavior, for now we just do one pass since its possible to avoid the second two.
===================================================================
M source/blender/editors/space_view3d/view3d_select.c
M source/blender/editors/space_view3d/view3d_view.c
M source/blender/gpu/intern/gpu_select.c
===================================================================
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index a42e9683bd..a636345bd1 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -96,6 +96,9 @@
#include "GPU_draw.h"
+#include "GPU_select.h"
+#include "PIL_time_utildefines.h"
+
#include "view3d_intern.h" /* own include */
float ED_view3d_select_dist_px(void)
@@ -1238,7 +1241,8 @@ static short mixed_bones_object_selectbuffer(
BLI_rcti_init(&rect, mval[0] - 14, mval[0] + 14, mval[1] - 14, mval[1] + 14);
hits15 = view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect, select_mode);
- if (hits15 == 1) {
+ if (hits15 == 1 || GPU_select_query_check_active()) {
+ // ^^^ for testing only
return selectbuffer_ret_hits_15(buffer, hits15);
}
else if (hits15 > 0) {
@@ -1467,8 +1471,9 @@ static bool ed_object_select_pick(
bool do_nearest;
/* if objects have posemode set, the bones are in the same selection buffer */
-
+ TIMEIT_START(select);
hits = mixed_bones_object_selectbuffer(&vc, buffer, mval, true, enumerate, &do_nearest);
+ TIMEIT_END(select);
if (hits > 0) {
/* note: bundles are handling in the same way as bones */
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 9ccef05961..c3ce29d99f 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1180,6 +1180,7 @@ short view3d_opengl_select(
rctf rect;
short hits;
const bool use_obedit_skip = (scene->obedit != NULL) && (vc->obedit == NULL);
+ const bool is_new_select = GPU_select_query_check_active();
G.f |= G_PICKSEL;
@@ -1203,10 +1204,10 @@ short view3d_opengl_select(
if (vc->rv3d->rflag & RV3D_CLIPPING)
ED_view3d_clipping_set(vc->rv3d);
- if (select_mode == VIEW3D_SELECT_DEPTH_SORT_NEAREST) {
+ if (is_new_select && select_mode == VIEW3D_SELECT_DEPTH_SORT_NEAREST) {
GPU_select_begin(buffer, bufsize, &rect, GPU_SELECT_DEPTH_SORT_NEAREST, 0);
}
- else if (select_mode == VIEW3D_SELECT_DEPTH_SORT_ALL) {
+ else if (is_new_select && select_mode == VIEW3D_SELECT_DEPTH_SORT_ALL) {
GPU_select_begin(buffer, bufsize, &rect, GPU_SELECT_DEPTH_SORT_ALL, 0);
}
else {
diff --git a/source/blender/gpu/intern/gpu_select.c b/source/blender/gpu/intern/gpu_select.c
index 9bcbb6f635..d0ec97c6cb 100644
--- a/source/blender/gpu/intern/gpu_select.c
+++ b/source/blender/gpu/intern/gpu_select.c
@@ -146,6 +146,7 @@ static GPUQueryState g_query_state = {0};
*/
void GPU_select_begin(unsigned int *buffer, unsigned int bufsize, const rctf *input, char mode, int oldhits)
{
+ printf("gl select\n");
g_query_state.select_is_active = true;
g_query_state.query_issued = false;
g_query_state.active_query = 0;
More information about the Bf-blender-cvs
mailing list