diff --git a/source/blender/editors/transform/transform_snap_object_mesh.cc b/source/blender/editors/transform/transform_snap_object_mesh.cc index 903ad07dd9d..e6958d0c273 100644 --- a/source/blender/editors/transform/transform_snap_object_mesh.cc +++ b/source/blender/editors/transform/transform_snap_object_mesh.cc @@ -106,14 +106,12 @@ static bool raycastMesh(SnapObjectContext *sctx, /* Test BoundBox */ if (ob_eval->data == me_eval) { - const BoundBox *bb = BKE_object_boundbox_get(ob_eval); - if (bb) { - /* was BKE_boundbox_ray_hit_check, see: cf6ca226fa58 */ - if (!isect_ray_aabb_v3_simple( - ray_start_local, ray_normal_local, bb->vec[0], bb->vec[6], &len_diff, nullptr)) - { - return retval; - } + const Bounds bounds = *me_eval->bounds_min_max(); + /* was BKE_boundbox_ray_hit_check, see: cf6ca226fa58 */ + if (!isect_ray_aabb_v3_simple( + ray_start_local, ray_normal_local, bounds.min, bounds.max, &len_diff, nullptr)) + { + return retval; } } @@ -454,8 +452,8 @@ static eSnapMode snapMesh(SnapObjectContext *sctx, SnapData_Mesh nearest2d(sctx, me_eval, obmat); if (ob_eval->data == me_eval) { - const BoundBox *bb = BKE_mesh_boundbox_get(ob_eval); - if (!nearest2d.snap_boundbox(bb->vec[0], bb->vec[6])) { + const Bounds bounds = *me_eval->bounds_min_max(); + if (!nearest2d.snap_boundbox(bounds.min, bounds.max)) { return SCE_SNAP_TO_NONE; } } diff --git a/source/blender/modifiers/intern/MOD_mesh_to_volume.cc b/source/blender/modifiers/intern/MOD_mesh_to_volume.cc index 8fd5c102f63..22afda23f19 100644 --- a/source/blender/modifiers/intern/MOD_mesh_to_volume.cc +++ b/source/blender/modifiers/intern/MOD_mesh_to_volume.cc @@ -128,6 +128,9 @@ static Volume *mesh_to_volume(ModifierData *md, return input_volume; } BKE_mesh_wrapper_ensure_mdata(mesh); + if (mesh->totvert == 0) { + return input_volume; + } const float4x4 mesh_to_own_object_space_transform = float4x4(ctx->object->world_to_object) * float4x4(object_to_convert->object_to_world); @@ -147,9 +150,9 @@ static Volume *mesh_to_volume(ModifierData *md, } auto bounds_fn = [&](float3 &r_min, float3 &r_max) { - const BoundBox *bb = BKE_object_boundbox_get(mvmd->object); - r_min = bb->vec[0]; - r_max = bb->vec[6]; + const Bounds bounds = *mesh->bounds_min_max(); + r_min = bounds.min; + r_max = bounds.max; }; const float voxel_size = geometry::volume_compute_voxel_size(