Fix #118445: crash when snapping to face nearest

Caused by `dd1c12e4d0`.

We need to be a little more restricted to calculate the occlusion plane.
This commit is contained in:
Germano Cavalcante
2024-02-19 11:41:19 -03:00
parent 8675fc50dc
commit 4bf6a2e564

View File

@@ -1269,9 +1269,13 @@ eSnapMode ED_transform_snap_object_project_view3d_ex(SnapObjectContext *sctx,
{
eSnapMode retval = SCE_SNAP_TO_NONE;
float ray_depth_max = BVH_RAYCAST_DIST_MAX;
bool use_occlusion_plane = false;
const bool is_allways_occluded = !params->use_occlusion_test;
bool use_occlusion_plane = is_allways_occluded || !XRAY_ENABLED(v3d);
/* It is required `mval` to calculate the occlusion plane. */
if (mval) {
const bool is_allways_occluded = !params->use_occlusion_test;
use_occlusion_plane = is_allways_occluded || !XRAY_ENABLED(v3d);
}
if (use_occlusion_plane || (snap_to_flag & SCE_SNAP_TO_FACE)) {
const RegionView3D *rv3d = static_cast<const RegionView3D *>(region->regiondata);