Cleanup: Access mesh bounds more directly
Simplifies the fix to #111120, because it is clearer that the threadsafe Mesh access is used rather than the potentially problematic object-level bounds access.
This commit is contained in:
parent
1d141e721c
commit
4eeabd274e
|
@ -106,14 +106,12 @@ static bool raycastMesh(SnapObjectContext *sctx,
|
||||||
|
|
||||||
/* Test BoundBox */
|
/* Test BoundBox */
|
||||||
if (ob_eval->data == me_eval) {
|
if (ob_eval->data == me_eval) {
|
||||||
const BoundBox *bb = BKE_object_boundbox_get(ob_eval);
|
const Bounds<float3> bounds = *me_eval->bounds_min_max();
|
||||||
if (bb) {
|
/* was BKE_boundbox_ray_hit_check, see: cf6ca226fa58 */
|
||||||
/* was BKE_boundbox_ray_hit_check, see: cf6ca226fa58 */
|
if (!isect_ray_aabb_v3_simple(
|
||||||
if (!isect_ray_aabb_v3_simple(
|
ray_start_local, ray_normal_local, bounds.min, bounds.max, &len_diff, nullptr))
|
||||||
ray_start_local, ray_normal_local, bb->vec[0], bb->vec[6], &len_diff, nullptr))
|
{
|
||||||
{
|
return retval;
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,8 +452,8 @@ static eSnapMode snapMesh(SnapObjectContext *sctx,
|
||||||
SnapData_Mesh nearest2d(sctx, me_eval, obmat);
|
SnapData_Mesh nearest2d(sctx, me_eval, obmat);
|
||||||
|
|
||||||
if (ob_eval->data == me_eval) {
|
if (ob_eval->data == me_eval) {
|
||||||
const BoundBox *bb = BKE_mesh_boundbox_get(ob_eval);
|
const Bounds<float3> bounds = *me_eval->bounds_min_max();
|
||||||
if (!nearest2d.snap_boundbox(bb->vec[0], bb->vec[6])) {
|
if (!nearest2d.snap_boundbox(bounds.min, bounds.max)) {
|
||||||
return SCE_SNAP_TO_NONE;
|
return SCE_SNAP_TO_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,6 +128,9 @@ static Volume *mesh_to_volume(ModifierData *md,
|
||||||
return input_volume;
|
return input_volume;
|
||||||
}
|
}
|
||||||
BKE_mesh_wrapper_ensure_mdata(mesh);
|
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) *
|
const float4x4 mesh_to_own_object_space_transform = float4x4(ctx->object->world_to_object) *
|
||||||
float4x4(object_to_convert->object_to_world);
|
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) {
|
auto bounds_fn = [&](float3 &r_min, float3 &r_max) {
|
||||||
const BoundBox *bb = BKE_object_boundbox_get(mvmd->object);
|
const Bounds<float3> bounds = *mesh->bounds_min_max();
|
||||||
r_min = bb->vec[0];
|
r_min = bounds.min;
|
||||||
r_max = bb->vec[6];
|
r_max = bounds.max;
|
||||||
};
|
};
|
||||||
|
|
||||||
const float voxel_size = geometry::volume_compute_voxel_size(
|
const float voxel_size = geometry::volume_compute_voxel_size(
|
||||||
|
|
Loading…
Reference in New Issue