Fix #132894: Overlay Next: Edit Mode Xray not working when set to 1.0

Add state.xray_flag_enabled.
This commit is contained in:
Miguel Pozo
2025-01-13 19:52:29 +01:00
parent 2f228fb0f6
commit 5f24c61225
3 changed files with 9 additions and 7 deletions

View File

@@ -59,6 +59,7 @@ void Instance::init()
state.xray_enabled = XRAY_ACTIVE(state.v3d);
state.xray_enabled_and_not_wire = state.xray_enabled && (state.v3d->shading.type > OB_WIRE);
state.xray_opacity = state.xray_enabled ? XRAY_ALPHA(state.v3d) : 1.0f;
state.xray_flag_enabled = SHADING_XRAY_FLAG_ENABLED(state.v3d->shading);
if (!state.hide_overlays) {
state.overlay = state.v3d->overlay;

View File

@@ -89,7 +89,7 @@ class Meshes : Overlay {
}
offset_data_ = state.offset_data_get();
xray_enabled_ = state.xray_enabled;
xray_enabled_ = state.xray_flag_enabled;
ToolSettings *tsettings = state.scene->toolsettings;
select_edge_ = (tsettings->selectmode & SCE_SELECT_EDGE);
@@ -100,7 +100,7 @@ class Meshes : Overlay {
show_retopology_ = (edit_flag & V3D_OVERLAY_EDIT_RETOPOLOGY) && !state.xray_enabled;
show_mesh_analysis_ = (edit_flag & V3D_OVERLAY_EDIT_STATVIS);
show_face_ = (edit_flag & V3D_OVERLAY_EDIT_FACES);
show_face_dots_ = ((edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) || state.xray_enabled) &
show_face_dots_ = ((edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) || state.xray_flag_enabled) &
select_face_;
show_weight_ = (edit_flag & V3D_OVERLAY_EDIT_WEIGHT);
@@ -113,14 +113,14 @@ class Meshes : Overlay {
uint4 data_mask = data_mask_get(edit_flag);
float backwire_opacity = (state.xray_enabled) ? 0.5f : 1.0f;
float backwire_opacity = (state.xray_flag_enabled) ? 0.5f : 1.0f;
float face_alpha = (show_face_) ? 1.0f : 0.0f;
float retopology_offset = RETOPOLOGY_OFFSET(state.v3d);
/* Cull back-faces for retopology face pass. This makes it so back-faces are not drawn.
* Doing so lets us distinguish back-faces from front-faces. */
DRWState face_culling = (show_retopology_) ? DRW_STATE_CULL_BACK : DRWState(0);
GPUTexture **depth_tex = (state.xray_enabled) ? &res.depth_tx : &res.dummy_depth_tx;
GPUTexture **depth_tex = (state.xray_flag_enabled) ? &res.depth_tx : &res.dummy_depth_tx;
{
auto &pass = edit_mesh_prepass_ps_;
@@ -138,7 +138,7 @@ class Meshes : Overlay {
DRWState pass_state = DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR |
DRW_STATE_DEPTH_LESS_EQUAL;
if (state.xray_enabled) {
if (state.xray_flag_enabled) {
pass_state |= DRW_STATE_BLEND_ALPHA;
}
@@ -365,6 +365,7 @@ class Meshes : Overlay {
manager.submit(edit_mesh_prepass_ps_, view);
manager.submit(edit_mesh_analysis_ps_, view);
manager.submit(edit_mesh_weight_ps_, view);
manager.submit(edit_mesh_faces_ps_, view);
if (xray_enabled_) {
GPU_debug_group_end();
@@ -376,7 +377,6 @@ class Meshes : Overlay {
view_edit_vert_.sync(view.viewmat(), offset_data_.winmat_polygon_offset(view.winmat(), 1.5f));
manager.submit(edit_mesh_normals_ps_, view);
manager.submit(edit_mesh_faces_ps_, view);
manager.submit(edit_mesh_cages_ps_, view_edit_cage_);
manager.submit(edit_mesh_edges_ps_, view_edit_edge_);
manager.submit(edit_mesh_verts_ps_, view_edit_vert_);
@@ -404,7 +404,6 @@ class Meshes : Overlay {
GPU_framebuffer_bind(framebuffer);
manager.submit(edit_mesh_normals_ps_, view);
manager.submit(edit_mesh_faces_ps_, view);
manager.submit(edit_mesh_cages_ps_, view_edit_cage_);
manager.submit(edit_mesh_edges_ps_, view_edit_edge_);
manager.submit(edit_mesh_verts_ps_, view_edit_vert_);

View File

@@ -143,6 +143,8 @@ struct State {
bool hide_overlays = false;
bool xray_enabled = false;
bool xray_enabled_and_not_wire = false;
/* Can be true even if Xray Alpha is 1.0. */
bool xray_flag_enabled = false;
/* Brings the active pose armature in front of all objects. */
bool do_pose_xray = false;
/* Add a veil on top of all surfaces to make the active pose armature pop out. */