Fix T42189

Own mistake - not copying enough data.
This commit is contained in:
Antonis Ryakiotakis 2014-10-20 12:35:35 +02:00 committed by Campbell Barton
parent 68b0b7c1f1
commit a0a5162545
Notes: blender-bot 2023-02-14 09:57:46 +01:00
Referenced by issue #42189, Unable to select some objects in View3D (when close)
2 changed files with 6 additions and 8 deletions

View File

@ -1181,14 +1181,14 @@ static short selectbuffer_ret_hits_15(unsigned int *UNUSED(buffer), const short
static short selectbuffer_ret_hits_9(unsigned int *buffer, const short hits15, const short hits9)
{
const int offs = 4 * hits15;
memcpy(buffer, buffer + offs, 4 * hits9);
memcpy(buffer, buffer + offs, 4 * hits9 * sizeof (unsigned int));
return hits9;
}
static short selectbuffer_ret_hits_5(unsigned int *buffer, const short hits15, const short hits9, const short hits5)
{
const int offs = 4 * hits15 + 4 * hits9;
memcpy(buffer, buffer + offs, 4 * hits5);
memcpy(buffer, buffer + offs, 4 * hits5 * sizeof (unsigned int));
return hits5;
}

View File

@ -1047,7 +1047,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
Scene *scene = vc->scene;
View3D *v3d = vc->v3d;
ARegion *ar = vc->ar;
rctf rect, selrect;
rctf rect;
short hits;
const bool use_obedit_skip = (scene->obedit != NULL) && (vc->obedit == NULL);
const bool do_passes = do_nearest && GPU_select_query_check_active();
@ -1064,8 +1064,6 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
else {
BLI_rctf_rcti_copy(&rect, input);
}
selrect = rect;
view3d_winmatrix_set(ar, v3d, &rect);
mul_m4_m4m4(vc->rv3d->persmat, vc->rv3d->winmat, vc->rv3d->viewmat);
@ -1079,9 +1077,9 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
ED_view3d_clipping_set(vc->rv3d);
if (do_passes)
GPU_select_begin(buffer, bufsize, &selrect, GPU_SELECT_NEAREST_FIRST_PASS, 0);
GPU_select_begin(buffer, bufsize, &rect, GPU_SELECT_NEAREST_FIRST_PASS, 0);
else
GPU_select_begin(buffer, bufsize, &selrect, GPU_SELECT_ALL, 0);
GPU_select_begin(buffer, bufsize, &rect, GPU_SELECT_ALL, 0);
view3d_select_loop(vc, scene, v3d, ar, use_obedit_skip);
@ -1089,7 +1087,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
/* second pass, to get the closest object to camera */
if (do_passes) {
GPU_select_begin(buffer, bufsize, &selrect, GPU_SELECT_NEAREST_SECOND_PASS, hits);
GPU_select_begin(buffer, bufsize, &rect, GPU_SELECT_NEAREST_SECOND_PASS, hits);
view3d_select_loop(vc, scene, v3d, ar, use_obedit_skip);