From b7a954218b0d1b90b67f228ae3ab8498710a1a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Wed, 23 Feb 2022 15:27:29 +0100 Subject: 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 --- source/blender/editors/space_view3d/view3d_iterators.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/editors/space_view3d') diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c index 990b4fc85b1..d711a3795c8 100644 --- a/source/blender/editors/space_view3d/view3d_iterators.c +++ b/source/blender/editors/space_view3d/view3d_iterators.c @@ -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; -- cgit v1.2.3