Cleanup: Access mesh bounds directly
Similar to 4eeabd274e
, helps simplify fix to #111120
This commit is contained in:
parent
0c2afa7c17
commit
ab9716f058
|
@ -470,7 +470,9 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev
|
|||
op->customdata = cd;
|
||||
|
||||
/* Select the front facing face of the mesh bounding box. */
|
||||
const BoundBox *bb = BKE_mesh_boundbox_get(cd->active_object);
|
||||
const blender::Bounds<float3> bounds = *mesh->bounds_min_max();
|
||||
BoundBox bb;
|
||||
BKE_boundbox_init_from_minmax(&bb, bounds.min, bounds.max);
|
||||
|
||||
/* Indices of the Bounding Box faces. */
|
||||
const int BB_faces[6][4] = {
|
||||
|
@ -482,10 +484,10 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev
|
|||
{2, 3, 7, 6},
|
||||
};
|
||||
|
||||
copy_v3_v3(cd->preview_plane[0], bb->vec[BB_faces[0][0]]);
|
||||
copy_v3_v3(cd->preview_plane[1], bb->vec[BB_faces[0][1]]);
|
||||
copy_v3_v3(cd->preview_plane[2], bb->vec[BB_faces[0][2]]);
|
||||
copy_v3_v3(cd->preview_plane[3], bb->vec[BB_faces[0][3]]);
|
||||
copy_v3_v3(cd->preview_plane[0], bb.vec[BB_faces[0][0]]);
|
||||
copy_v3_v3(cd->preview_plane[1], bb.vec[BB_faces[0][1]]);
|
||||
copy_v3_v3(cd->preview_plane[2], bb.vec[BB_faces[0][2]]);
|
||||
copy_v3_v3(cd->preview_plane[3], bb.vec[BB_faces[0][3]]);
|
||||
|
||||
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
||||
|
||||
|
@ -509,15 +511,15 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev
|
|||
/* Check if there is a face that is more aligned towards the view. */
|
||||
for (int i = 0; i < 6; i++) {
|
||||
normal_tri_v3(
|
||||
current_normal, bb->vec[BB_faces[i][0]], bb->vec[BB_faces[i][1]], bb->vec[BB_faces[i][2]]);
|
||||
current_normal, bb.vec[BB_faces[i][0]], bb.vec[BB_faces[i][1]], bb.vec[BB_faces[i][2]]);
|
||||
current_dot = dot_v3v3(current_normal, view_normal);
|
||||
|
||||
if (current_dot < min_dot) {
|
||||
min_dot = current_dot;
|
||||
copy_v3_v3(cd->preview_plane[0], bb->vec[BB_faces[i][0]]);
|
||||
copy_v3_v3(cd->preview_plane[1], bb->vec[BB_faces[i][1]]);
|
||||
copy_v3_v3(cd->preview_plane[2], bb->vec[BB_faces[i][2]]);
|
||||
copy_v3_v3(cd->preview_plane[3], bb->vec[BB_faces[i][3]]);
|
||||
copy_v3_v3(cd->preview_plane[0], bb.vec[BB_faces[i][0]]);
|
||||
copy_v3_v3(cd->preview_plane[1], bb.vec[BB_faces[i][1]]);
|
||||
copy_v3_v3(cd->preview_plane[2], bb.vec[BB_faces[i][2]]);
|
||||
copy_v3_v3(cd->preview_plane[3], bb.vec[BB_faces[i][3]]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue