Fix #110259: snapping with Xray alpha 1.0 occludes edited geometry

The edited mesh is not occluded even with Xray alpha 1.0, but it still
occludes other meshes that are not in edit mode.

Therefore, to resolve, alpha is still considered in general occlusion,
but is ignored in occlusion of edited meshes.
This commit is contained in:
Germano Cavalcante
2023-07-19 10:47:49 -03:00
parent 18096bd18a
commit 734b01d9c0

View File

@@ -18,6 +18,7 @@
#include "DEG_depsgraph_query.h"
#include "ED_transform_snap_object_context.h"
#include "ED_view3d.h"
#include "transform_snap_object.hh"
@@ -613,7 +614,11 @@ static eSnapMode snapEditMesh(SnapCache_EditMesh *em_cache,
}
}
nearest2d.clip_planes_enable(sctx);
/* #XRAY_ENABLED can return false even with the XRAY flag enabled, this happens because the
* alpha is 1.0 in this case. But even with the alpha being 1.0, the edit mesh is still not
* occluded. */
const bool skip_occlusion_plane = XRAY_FLAG_ENABLED(sctx->runtime.v3d);
nearest2d.clip_planes_enable(sctx, skip_occlusion_plane);
BVHTreeNearest nearest{};
nearest.index = -1;