diff --git a/source/blender/blenkernel/BKE_mesh_boolean_convert.hh b/source/blender/blenkernel/BKE_mesh_boolean_convert.hh index a006550e5ca..51c74691f8a 100644 --- a/source/blender/blenkernel/BKE_mesh_boolean_convert.hh +++ b/source/blender/blenkernel/BKE_mesh_boolean_convert.hh @@ -19,8 +19,7 @@ namespace blender::meshintersect { /** * Do a mesh boolean operation directly on meshes (without going back and forth from BMesh). - * \param transforms: An array of pointers to transform matrices used for each mesh's positions. - * It is allowed for the pointers to be null, meaning the transformation is the identity. + * \param transforms: An array of transform matrices used for each mesh's positions. * \param material_remaps: An array of maps from material slot numbers in the corresponding mesh * to the material slot in the first mesh. It is OK for material_remaps or any of its constituent * arrays to be empty. A -1 value means that the original index should be used with no mapping. @@ -28,7 +27,7 @@ namespace blender::meshintersect { * 'new' edges are the result of the intersections. */ Mesh *direct_mesh_boolean(Span meshes, - Span transforms, + Span transforms, const float4x4 &target_transform, Span> material_remaps, bool use_self, diff --git a/source/blender/blenkernel/intern/mesh_boolean_convert.cc b/source/blender/blenkernel/intern/mesh_boolean_convert.cc index 49518c874ee..c395218f120 100644 --- a/source/blender/blenkernel/intern/mesh_boolean_convert.cc +++ b/source/blender/blenkernel/intern/mesh_boolean_convert.cc @@ -233,7 +233,7 @@ void MeshesToIMeshInfo::input_medge_for_orig_index(int orig_index, * All allocation of memory for the IMesh comes from `arena`. */ static IMesh meshes_to_imesh(Span meshes, - Span obmats, + Span obmats, Span> material_remaps, const float4x4 &target_transform, IMeshArena &arena, @@ -295,9 +295,8 @@ static IMesh meshes_to_imesh(Span meshes, r_info->mesh_face_offset[mi] = f; /* Get matrix that transforms a coordinate in meshes[mi]'s local space * to the target space. */ - const float4x4 objn_mat = (obmats.is_empty() || obmats[mi] == nullptr) ? - float4x4::identity() : - clean_transform(*obmats[mi]); + const float4x4 objn_mat = obmats.is_empty() ? float4x4::identity() : + clean_transform(obmats[mi]); r_info->to_target_transform[mi] = inv_target_mat * objn_mat; r_info->has_negative_transform[mi] = math::is_negative(objn_mat); @@ -316,7 +315,7 @@ static IMesh meshes_to_imesh(Span meshes, * Skip the matrix multiplication for each point when there is no transform for a mesh, * for example when the first mesh is already in the target space. (Note the logic * directly above, which uses an identity matrix with a null input transform). */ - if (obmats.is_empty() || obmats[mi] == nullptr) { + if (obmats.is_empty() || obmats[mi] == float4x4::identity()) { threading::parallel_for(vert_positions.index_range(), 2048, [&](IndexRange range) { for (int i : range) { float3 co = vert_positions[i]; @@ -797,7 +796,7 @@ static Mesh *imesh_to_mesh(IMesh *im, MeshesToIMeshInfo &mim) #endif // WITH_GMP Mesh *direct_mesh_boolean(Span meshes, - Span transforms, + Span transforms, const float4x4 &target_transform, Span> material_remaps, const bool use_self, diff --git a/source/blender/modifiers/intern/MOD_boolean.cc b/source/blender/modifiers/intern/MOD_boolean.cc index 9a21d80fda5..59e0458542d 100644 --- a/source/blender/modifiers/intern/MOD_boolean.cc +++ b/source/blender/modifiers/intern/MOD_boolean.cc @@ -415,7 +415,7 @@ static Mesh *exact_boolean_mesh(BooleanModifierData *bmd, Mesh *mesh) { Vector meshes; - Vector obmats; + Vector obmats; Vector> material_remaps; @@ -428,7 +428,7 @@ static Mesh *exact_boolean_mesh(BooleanModifierData *bmd, } meshes.append(mesh); - obmats.append((float4x4 *)&ctx->object->object_to_world); + obmats.append(float4x4(ctx->object->object_to_world)); material_remaps.append({}); const BooleanModifierMaterialMode material_mode = BooleanModifierMaterialMode( @@ -451,7 +451,7 @@ static Mesh *exact_boolean_mesh(BooleanModifierData *bmd, } BKE_mesh_wrapper_ensure_mdata(mesh_operand); meshes.append(mesh_operand); - obmats.append((float4x4 *)&bmd->object->object_to_world); + obmats.append(float4x4(bmd->object->object_to_world)); if (material_mode == eBooleanModifierMaterialMode_Index) { material_remaps.append(get_material_remap_index_based(ctx->object, bmd->object)); } @@ -471,7 +471,7 @@ static Mesh *exact_boolean_mesh(BooleanModifierData *bmd, } BKE_mesh_wrapper_ensure_mdata(collection_mesh); meshes.append(collection_mesh); - obmats.append((float4x4 *)&ob->object_to_world); + obmats.append(float4x4(ob->object_to_world)); if (material_mode == eBooleanModifierMaterialMode_Index) { material_remaps.append(get_material_remap_index_based(ctx->object, ob)); } @@ -489,7 +489,7 @@ static Mesh *exact_boolean_mesh(BooleanModifierData *bmd, Mesh *result = blender::meshintersect::direct_mesh_boolean( meshes, obmats, - *(float4x4 *)&ctx->object->object_to_world, + float4x4(ctx->object->object_to_world), material_remaps, use_self, hole_tolerant,