Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/geometry/intern/mesh_merge_by_distance.cc')
-rw-r--r--source/blender/geometry/intern/mesh_merge_by_distance.cc44
1 files changed, 7 insertions, 37 deletions
diff --git a/source/blender/geometry/intern/mesh_merge_by_distance.cc b/source/blender/geometry/intern/mesh_merge_by_distance.cc
index 288fd407641..e5622a345d1 100644
--- a/source/blender/geometry/intern/mesh_merge_by_distance.cc
+++ b/source/blender/geometry/intern/mesh_merge_by_distance.cc
@@ -1228,10 +1228,6 @@ static void customdata_weld(
int src_i, dest_i;
int j;
- float co[3] = {0.0f, 0.0f, 0.0f};
-#ifdef USE_WELD_NORMALS
- float no[3] = {0.0f, 0.0f, 0.0f};
-#endif
short flag = 0;
/* interpolates a layer at a time */
@@ -1254,20 +1250,7 @@ static void customdata_weld(
/* if we found a matching layer, add the data */
if (dest->layers[dest_i].type == type) {
void *src_data = source->layers[src_i].data;
-
- if (type == CD_MVERT) {
- for (j = 0; j < count; j++) {
- MVert *mv_src = &((MVert *)src_data)[src_indices[j]];
- add_v3_v3(co, mv_src->co);
-#ifdef USE_WELD_NORMALS
- short *mv_src_no = mv_src->no;
- no[0] += mv_src_no[0];
- no[1] += mv_src_no[1];
- no[2] += mv_src_no[2];
-#endif
- }
- }
- else if (type == CD_MEDGE) {
+ if (type == CD_MEDGE) {
for (j = 0; j < count; j++) {
MEdge *me_src = &((MEdge *)src_data)[src_indices[j]];
flag |= me_src->flag;
@@ -1303,20 +1286,7 @@ static void customdata_weld(
for (dest_i = 0; dest_i < dest->totlayer; dest_i++) {
CustomDataLayer *layer_dst = &dest->layers[dest_i];
const int type = layer_dst->type;
- if (type == CD_MVERT) {
- MVert *mv = &((MVert *)layer_dst->data)[dest_index];
- mul_v3_fl(co, fac);
-
- copy_v3_v3(mv->co, co);
-#ifdef USE_WELD_NORMALS
- mul_v3_fl(no, fac);
- short *mv_no = mv->no;
- mv_no[0] = short(no[0]);
- mv_no[1] = short(no[1]);
- mv_no[2] = short(no[2]);
-#endif
- }
- else if (type == CD_MEDGE) {
+ if (type == CD_MEDGE) {
MEdge *me = &((MEdge *)layer_dst->data)[dest_index];
me->flag = flag;
}
@@ -1552,9 +1522,9 @@ std::optional<Mesh *> mesh_merge_by_distance_all(const Mesh &mesh,
KDTree_3d *tree = BLI_kdtree_3d_new(selection.size());
- const Span<MVert> verts = mesh.verts();
+ const Span<float3> positions = mesh.positions();
for (const int i : selection) {
- BLI_kdtree_3d_insert(tree, i, verts[i].co);
+ BLI_kdtree_3d_insert(tree, i, positions[i]);
}
BLI_kdtree_3d_balance(tree);
@@ -1579,7 +1549,7 @@ std::optional<Mesh *> mesh_merge_by_distance_connected(const Mesh &mesh,
const float merge_distance,
const bool only_loose_edges)
{
- const Span<MVert> verts = mesh.verts();
+ const Span<float3> positions = mesh.positions();
const Span<MEdge> edges = mesh.edges();
int vert_kill_len = 0;
@@ -1590,9 +1560,9 @@ std::optional<Mesh *> mesh_merge_by_distance_connected(const Mesh &mesh,
Array<WeldVertexCluster> vert_clusters(mesh.totvert);
- for (const int i : verts.index_range()) {
+ for (const int i : positions.index_range()) {
WeldVertexCluster &vc = vert_clusters[i];
- copy_v3_v3(vc.co, verts[i].co);
+ copy_v3_v3(vc.co, positions[i]);
vc.merged_verts = 0;
}
const float merge_dist_sq = square_f(merge_distance);