Fix #119397: X-Ray not available in Rendered mode when using Workbench #119769
|
@ -114,7 +114,7 @@ static void OVERLAY_engine_init(void *vedata)
|
|||
pd->wireframe_mode = (v3d->shading.type == OB_WIRE);
|
||||
pd->clipping_state = RV3D_CLIPPING_ENABLED(v3d, rv3d) ? DRW_STATE_CLIP_PLANES : DRWState(0);
|
||||
pd->xray_opacity = XRAY_ALPHA(v3d);
|
||||
pd->xray_enabled = XRAY_ACTIVE(v3d);
|
||||
pd->xray_enabled = XRAY_ACTIVE(v3d, scene);
|
||||
pd->xray_enabled_and_not_wire = pd->xray_enabled && v3d->shading.type > OB_WIRE;
|
||||
pd->clear_in_front = (v3d->shading.type != OB_SOLID);
|
||||
pd->cfra = DEG_get_ctime(draw_ctx->depsgraph);
|
||||
|
|
|
@ -40,7 +40,7 @@ void Instance::init()
|
|||
BKE_scene_uses_blender_workbench(state.scene);
|
||||
state.is_wireframe_mode = (state.v3d->shading.type == OB_WIRE);
|
||||
state.hide_overlays = (state.v3d->flag2 & V3D_HIDE_OVERLAYS) != 0;
|
||||
state.xray_enabled = XRAY_ACTIVE(state.v3d);
|
||||
state.xray_enabled = XRAY_ACTIVE(state.v3d, state.scene);
|
||||
state.xray_enabled_and_not_wire = state.xray_enabled && (state.v3d->shading.type > OB_WIRE);
|
||||
state.xray_opacity = XRAY_ALPHA(state.v3d);
|
||||
state.cfra = DEG_get_ctime(state.depsgraph);
|
||||
|
|
|
@ -662,7 +662,7 @@ static EditBone *get_nearest_editbonepoint(
|
|||
use_cycle = !WM_cursor_test_motion_and_update(vc->mval);
|
||||
}
|
||||
|
||||
const bool do_nearest = !(XRAY_ACTIVE(vc->v3d) || use_cycle);
|
||||
const bool do_nearest = !(XRAY_ACTIVE(vc->v3d, vc->scene) || use_cycle);
|
||||
|
||||
/* matching logic from 'mixed_bones_object_selectbuffer' */
|
||||
int hits = 0;
|
||||
|
|
|
@ -1247,14 +1247,15 @@ void ED_view3d_shade_update(Main *bmain, View3D *v3d, ScrArea *area);
|
|||
#define SHADING_XRAY_FLAG_ENABLED(shading) (((shading).flag & SHADING_XRAY_FLAG(shading)) != 0)
|
||||
#define SHADING_XRAY_ENABLED(shading) \
|
||||
(SHADING_XRAY_FLAG_ENABLED(shading) && (SHADING_XRAY_ALPHA(shading) < 1.0f))
|
||||
#define SHADING_XRAY_ACTIVE(shading) \
|
||||
(SHADING_XRAY_ENABLED(shading) && ((shading).type < OB_MATERIAL))
|
||||
#define SHADING_XRAY_ACTIVE(shading, scene) \
|
||||
(SHADING_XRAY_ENABLED(shading) && \
|
||||
((shading).type < OB_MATERIAL || STREQ(scene->r.engine, RE_engine_id_BLENDER_WORKBENCH)))
|
||||
|
||||
#define XRAY_ALPHA(v3d) SHADING_XRAY_ALPHA((v3d)->shading)
|
||||
#define XRAY_FLAG(v3d) SHADING_XRAY_FLAG((v3d)->shading)
|
||||
#define XRAY_FLAG_ENABLED(v3d) SHADING_XRAY_FLAG_ENABLED((v3d)->shading)
|
||||
#define XRAY_ENABLED(v3d) SHADING_XRAY_ENABLED((v3d)->shading)
|
||||
#define XRAY_ACTIVE(v3d) SHADING_XRAY_ACTIVE((v3d)->shading)
|
||||
#define XRAY_ACTIVE(v3d, scene) SHADING_XRAY_ACTIVE((v3d)->shading, scene)
|
||||
|
||||
#define OVERLAY_RETOPOLOGY_ENABLED(overlay) \
|
||||
(((overlay).edit_flag & V3D_OVERLAY_EDIT_RETOPOLOGY) != 0)
|
||||
|
|
|
@ -2190,12 +2190,12 @@ static int mixed_bones_object_selectbuffer_extended(const ViewContext *vc,
|
|||
if (use_cycle) {
|
||||
/* Update the coordinates (even if the return value isn't used). */
|
||||
const bool has_motion = WM_cursor_test_motion_and_update(mval);
|
||||
if (!XRAY_ACTIVE(v3d)) {
|
||||
if (!XRAY_ACTIVE(v3d, vc->scene)) {
|
||||
do_nearest = has_motion;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!XRAY_ACTIVE(v3d)) {
|
||||
if (!XRAY_ACTIVE(v3d, vc->scene)) {
|
||||
do_nearest = true;
|
||||
}
|
||||
}
|
||||
|
@ -2432,7 +2432,7 @@ static Base *ed_view3d_give_base_under_cursor_ex(bContext *C,
|
|||
|
||||
const ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
const bool do_nearest = !XRAY_ACTIVE(vc.v3d);
|
||||
const bool do_nearest = !XRAY_ACTIVE(vc.v3d, vc.scene);
|
||||
const bool do_material_slot_selection = r_material_slot != nullptr;
|
||||
const int hits = mixed_bones_object_selectbuffer(
|
||||
&vc, &buffer, mval, VIEW3D_SELECT_FILTER_NOP, do_nearest, false, do_material_slot_selection);
|
||||
|
|
|
@ -676,12 +676,12 @@ int view3d_opengl_select_ex(const ViewContext *vc,
|
|||
ED_view3d_draw_setup_view(
|
||||
wm, vc->win, depsgraph, scene, region, v3d, vc->rv3d->viewmat, nullptr, &rect);
|
||||
|
||||
if (!XRAY_ACTIVE(v3d)) {
|
||||
if (!XRAY_ACTIVE(v3d, scene)) {
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
}
|
||||
|
||||
/* If in X-ray mode, we select the wires in priority. */
|
||||
if (XRAY_ACTIVE(v3d) && use_nearest) {
|
||||
if (XRAY_ACTIVE(v3d, scene) && use_nearest) {
|
||||
/* We need to call "GPU_select_*" API's inside DRW_draw_select_loop
|
||||
* because the OpenGL context created & destroyed inside this function. */
|
||||
DrawSelectLoopUserData drw_select_loop_user_data = {};
|
||||
|
@ -741,7 +741,7 @@ int view3d_opengl_select_ex(const ViewContext *vc,
|
|||
ED_view3d_draw_setup_view(
|
||||
wm, vc->win, depsgraph, scene, region, v3d, vc->rv3d->viewmat, nullptr, nullptr);
|
||||
|
||||
if (!XRAY_ACTIVE(v3d)) {
|
||||
if (!XRAY_ACTIVE(v3d, scene)) {
|
||||
GPU_depth_test(GPU_DEPTH_NONE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue