diff options
Diffstat (limited to 'source/blender/blenkernel/intern/cloth.c')
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 6b25095a87a..7c8c1cf6653 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -30,7 +30,6 @@ #include "DNA_scene_types.h" #include "BLI_edgehash.h" -#include "BLI_ghash.h" #include "BLI_linklist.h" #include "BLI_math.h" #include "BLI_rand.h" @@ -587,7 +586,7 @@ void cloth_free_modifier(ClothModifierData *clmd) } if (cloth->sew_edge_graph) { - BLI_ghash_free(cloth->sew_edge_graph, MEM_freeN, NULL); + BLI_edgeset_free(cloth->sew_edge_graph); cloth->sew_edge_graph = NULL; } @@ -669,7 +668,7 @@ void cloth_free_modifier_extern(ClothModifierData *clmd) } if (cloth->sew_edge_graph) { - BLI_ghash_free(cloth->sew_edge_graph, MEM_freeN, NULL); + BLI_edgeset_free(cloth->sew_edge_graph); cloth->sew_edge_graph = NULL; } @@ -1557,9 +1556,8 @@ static bool find_internal_spring_target_vertex(BVHTreeFromMesh *treedata, *r_tar_v_idx = vert_idx; return true; } - - return false; - + + return false; } static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) @@ -1693,8 +1691,7 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SEW) { /* cloth->sew_edge_graph should not exist before this */ BLI_assert(cloth->sew_edge_graph == NULL); - cloth->sew_edge_graph = BLI_ghash_new( - BLI_ghashutil_inthash_v2_p, BLI_ghashutil_inthash_v2_cmp, "cloth_sewing_edges_graph"); + cloth->sew_edge_graph = BLI_edgeset_new("cloth_sewing_edges_graph"); } /* Structural springs. */ @@ -1709,18 +1706,7 @@ static int cloth_build_springs(ClothModifierData *clmd, Mesh *mesh) spring->lin_stiffness = 1.0f; spring->type = CLOTH_SPRING_TYPE_SEWING; - /* set indices of verts of the sewing edge symmetrically in sew_edge_graph */ - unsigned int *vertex_index_pair = MEM_mallocN(sizeof(unsigned int) * 2, - "sewing_edge_index_pair_01"); - if (medge[i].v1 < medge[i].v2) { - vertex_index_pair[0] = medge[i].v1; - vertex_index_pair[1] = medge[i].v2; - } - else { - vertex_index_pair[0] = medge[i].v2; - vertex_index_pair[1] = medge[i].v1; - } - BLI_ghash_insert(cloth->sew_edge_graph, vertex_index_pair, NULL); + BLI_edgeset_insert(cloth->sew_edge_graph, medge[i].v1, medge[i].v2); } else { shrink_factor = cloth_shrink_factor(clmd, cloth->verts, spring->ij, spring->kl); |