Fix T95976: on cage GPU subdivision breaks X-ray selection

When X-ray mode is active the selection is done using the mesh data to
select what is closest to the cursor. When GPU subdivision is active with
the "show on cage" modifier option, this fails as the mesh used for selection
is the unsubdivided one.

This creates a subdivision wrapper before running the selection routines to
ensure that subdivision is available on the CPU side as well.

Differential Revision: https://developer.blender.org/D14188
This commit is contained in:
Kévin Dietrich 2022-02-23 15:27:29 +01:00
parent 17e0634902
commit b7a954218b
Notes: blender-bot 2023-02-13 16:09:39 +01:00
Referenced by issue #95976, Regression: Toggle X-Ray breaks Face selection mode when Show On Cage active.
1 changed files with 5 additions and 0 deletions

View File

@ -39,6 +39,7 @@
#include "BKE_editmesh.h"
#include "BKE_mesh_iterators.h"
#include "BKE_mesh_runtime.h"
#include "BKE_mesh_wrapper.h"
#include "BKE_modifier.h"
#include "DEG_depsgraph.h"
@ -348,6 +349,7 @@ void mesh_foreachScreenVert(
Mesh *me = editbmesh_get_eval_cage_from_orig(
vc->depsgraph, vc->scene, vc->obedit, &CD_MASK_BAREMESH);
me = BKE_mesh_wrapper_ensure_subdivision(vc->obedit, me);
ED_view3d_check_mats_rv3d(vc->rv3d);
@ -410,6 +412,7 @@ void mesh_foreachScreenEdge(ViewContext *vc,
Mesh *me = editbmesh_get_eval_cage_from_orig(
vc->depsgraph, vc->scene, vc->obedit, &CD_MASK_BAREMESH);
me = BKE_mesh_wrapper_ensure_subdivision(vc->obedit, me);
ED_view3d_check_mats_rv3d(vc->rv3d);
@ -497,6 +500,7 @@ void mesh_foreachScreenEdge_clip_bb_segment(ViewContext *vc,
Mesh *me = editbmesh_get_eval_cage_from_orig(
vc->depsgraph, vc->scene, vc->obedit, &CD_MASK_BAREMESH);
me = BKE_mesh_wrapper_ensure_subdivision(vc->obedit, me);
ED_view3d_check_mats_rv3d(vc->rv3d);
@ -568,6 +572,7 @@ void mesh_foreachScreenFace(
Mesh *me = editbmesh_get_eval_cage_from_orig(
vc->depsgraph, vc->scene, vc->obedit, &CD_MASK_BAREMESH);
me = BKE_mesh_wrapper_ensure_subdivision(vc->obedit, me);
ED_view3d_check_mats_rv3d(vc->rv3d);
data.vc = *vc;