Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Parborg <darkdefende@gmail.com>2019-04-09 13:29:02 +0300
committerSebastian Parborg <darkdefende@gmail.com>2019-04-09 13:29:02 +0300
commitcc74020b5ac7d974e91279e23efc80141c229b3c (patch)
treeb48fe326706a8974f30385f8d861bcdd2bda0e7e /source/blender/editors/space_view3d
parentf55026d46861a3cb0108ad3f7bab8ed0610f660d (diff)
Fix T62114: Wireframe mode selection: selects backside objects when clicking frontside object in 3d-window
Now the depth order of objects when trying to select them is only used when not in X-ray mode. Before, this was only the case in wireframe mode regardless of X-ray settings. I've also unified the usage of V3D_XRAY and XRAY_FLAG as they were basically copies of each other. Reviewed By: Clément Differential Revision: http://developer.blender.org/D4504
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c9
2 files changed, 12 insertions, 11 deletions
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index ea44f19c4fe..3ff6a7146c6 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -943,7 +943,7 @@ static void do_lasso_select_meshobject__doSelectVert(void *userData, MVert *mv,
}
static bool do_lasso_select_paintvert(ViewContext *vc, const int mcords[][2], short moves, const eSelectOp sel_op)
{
- const bool use_zbuf = V3D_IS_ZBUF(vc->v3d);
+ const bool use_zbuf = !XRAY_ENABLED(vc->v3d);
Object *ob = vc->obact;
Mesh *me = ob->data;
rcti rect;
@@ -1472,7 +1472,7 @@ static int mixed_bones_object_selectbuffer_extended(
/* define if we use solid nearest select or not */
if (use_cycle) {
- if (v3d->shading.type > OB_WIRE) {
+ if (!XRAY_ACTIVE(v3d)) {
do_nearest = true;
if (len_manhattan_v2v2_int(mval, last_mval) <= WM_EVENT_CURSOR_MOTION_THRESHOLD) {
do_nearest = false;
@@ -1481,7 +1481,7 @@ static int mixed_bones_object_selectbuffer_extended(
copy_v2_v2_int(last_mval, mval);
}
else {
- if (v3d->shading.type > OB_WIRE) {
+ if (!XRAY_ACTIVE(v3d)) {
do_nearest = true;
}
}
@@ -1630,7 +1630,7 @@ Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2])
ED_view3d_viewcontext_init(C, &vc);
- const bool do_nearest = (vc.v3d->shading.type > OB_WIRE);
+ const bool do_nearest = !XRAY_ACTIVE(vc.v3d);
const int hits = mixed_bones_object_selectbuffer(
&vc, buffer, mval, VIEW3D_SELECT_FILTER_NOP, do_nearest);
@@ -1996,7 +1996,7 @@ static bool ed_wpaint_vertex_select_pick(
bool extend, bool deselect, bool toggle, Object *obact)
{
View3D *v3d = CTX_wm_view3d(C);
- const bool use_zbuf = V3D_IS_ZBUF(v3d);
+ const bool use_zbuf = !XRAY_ENABLED(v3d);
Mesh *me = obact->data; /* already checked for NULL */
uint index = 0;
@@ -2246,7 +2246,7 @@ static void do_paintvert_box_select__doSelectVert(void *userData, MVert *mv, con
static bool do_paintvert_box_select(
ViewContext *vc, const rcti *rect, const eSelectOp sel_op)
{
- const bool use_zbuf = V3D_IS_ZBUF(vc->v3d);
+ const bool use_zbuf = !XRAY_ENABLED(vc->v3d);
Mesh *me;
MVert *mvert;
unsigned int *rt;
@@ -3096,7 +3096,7 @@ static void paint_vertsel_circle_select_doSelectVert(void *userData, MVert *mv,
static bool paint_vertsel_circle_select(ViewContext *vc, const eSelectOp sel_op, const int mval[2], float rad)
{
BLI_assert(ELEM(sel_op, SEL_OP_SET, SEL_OP_ADD, SEL_OP_SUB));
- const bool use_zbuf = V3D_IS_ZBUF(vc->v3d);
+ const bool use_zbuf = !XRAY_ENABLED(vc->v3d);
Object *ob = vc->obact;
Mesh *me = ob->data;
bool bbsel;
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 21716f28b85..4e5dddf4742 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1049,7 +1049,7 @@ int view3d_opengl_select(
* the object & bone view locking takes 'rect' into account, see: T51629. */
ED_view3d_draw_setup_view(vc->win, depsgraph, scene, ar, v3d, vc->rv3d->viewmat, NULL, &rect);
- if (v3d->shading.type > OB_WIRE) {
+ if (!XRAY_ACTIVE(v3d)) {
GPU_depth_test(true);
}
@@ -1058,7 +1058,7 @@ int view3d_opengl_select(
}
/* If in xray mode, we select the wires in priority. */
- if ((v3d->shading.flag & V3D_XRAY_FLAG(v3d)) && use_nearest) {
+ if (XRAY_ACTIVE(v3d) && use_nearest) {
/* We need to call "GPU_select_*" API's inside DRW_draw_select_loop
* because the OpenGL context created & destroyed inside this function. */
struct DrawSelectLoopUserData drw_select_loop_user_data = {
@@ -1092,7 +1092,8 @@ int view3d_opengl_select(
.rect = &rect,
.gpu_select_mode = gpu_select_mode,
};
- draw_surface = (v3d->shading.type > OB_WIRE) || ((v3d->shading.flag & V3D_XRAY_FLAG(v3d)) == 0);
+ /* If are not in wireframe mode, we need to use the mesh surfaces to check for hits */
+ draw_surface = (v3d->shading.type > OB_WIRE) || !XRAY_ENABLED(v3d);
DRW_draw_select_loop(
depsgraph, ar, v3d,
use_obedit_skip, draw_surface, use_nearest, &rect,
@@ -1104,7 +1105,7 @@ int view3d_opengl_select(
G.f &= ~G_FLAG_PICKSEL;
ED_view3d_draw_setup_view(vc->win, depsgraph, scene, ar, v3d, vc->rv3d->viewmat, NULL, NULL);
- if (v3d->shading.type > OB_WIRE) {
+ if (!XRAY_ACTIVE(v3d)) {
GPU_depth_test(false);
}