diff options
Diffstat (limited to 'source/blender/modifiers/intern')
-rw-r--r-- | source/blender/modifiers/intern/MOD_build.c | 13 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_mask.c | 33 |
2 files changed, 14 insertions, 32 deletions
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index f30529bc40f..1dc1a1f8d64 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -86,7 +86,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), float frac; MPoly *mpoly_dst; MLoop *ml_dst, *ml_src /*, *mloop_dst */; - GHashIterator *hashIter; + GHashIterator gh_iter; /* maps vert indices in old mesh to indices in new mesh */ GHash *vertHash = BLI_ghash_int_new("build ve apply gh"); /* maps edge indices in new mesh to indices in old mesh */ @@ -230,15 +230,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), BLI_ghash_size(edgeHash), 0, numLoops_dst, numFaces_dst); /* copy the vertices across */ - for (hashIter = BLI_ghashIterator_new(vertHash); - BLI_ghashIterator_done(hashIter) == false; - BLI_ghashIterator_step(hashIter) - ) - { + GHASH_ITER (gh_iter, vertHash) { MVert source; MVert *dest; - int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(hashIter)); - int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(hashIter)); + int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter)); + int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter)); source = mvert_src[oldIndex]; dest = CDDM_get_vert(result, newIndex); @@ -246,7 +242,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), DM_copy_vert_data(dm, result, oldIndex, newIndex, 1); *dest = source; } - BLI_ghashIterator_free(hashIter); /* copy the edges across, remapping indices */ for (i = 0; i < BLI_ghash_size(edgeHash); i++) { diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index 254ca0bda08..174f3df73d4 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -99,7 +99,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, const bool found_test = (mmd->flag & MOD_MASK_INV) == 0; DerivedMesh *result = NULL; GHash *vertHash = NULL, *edgeHash, *polyHash; - GHashIterator *hashIter; + GHashIterator gh_iter; MDeformVert *dvert, *dv; int numPolys = 0, numLoops = 0, numEdges = 0, numVerts = 0; int maxVerts, maxEdges, maxPolys; @@ -291,14 +291,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* using ghash-iterators, map data into new mesh */ /* vertices */ - for (hashIter = BLI_ghashIterator_new(vertHash); - BLI_ghashIterator_done(hashIter) == false; - BLI_ghashIterator_step(hashIter)) - { + GHASH_ITER (gh_iter, vertHash) { MVert source; MVert *dest; - int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(hashIter)); - int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(hashIter)); + int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter)); + int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter)); dm->getVert(dm, oldIndex, &source); dest = &mvert_new[newIndex]; @@ -306,17 +303,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DM_copy_vert_data(dm, result, oldIndex, newIndex, 1); *dest = source; } - BLI_ghashIterator_free(hashIter); /* edges */ - for (hashIter = BLI_ghashIterator_new(edgeHash); - BLI_ghashIterator_done(hashIter) == false; - BLI_ghashIterator_step(hashIter)) - { + GHASH_ITER (gh_iter, edgeHash) { MEdge source; MEdge *dest; - int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(hashIter)); - int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(hashIter)); + int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter)); + int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter)); dm->getEdge(dm, oldIndex, &source); dest = &medge_new[newIndex]; @@ -327,15 +320,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DM_copy_edge_data(dm, result, oldIndex, newIndex, 1); *dest = source; } - BLI_ghashIterator_free(hashIter); /* faces */ - for (hashIter = BLI_ghashIterator_new(polyHash); - BLI_ghashIterator_done(hashIter) == false; - BLI_ghashIterator_step(hashIter)) - { - int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(hashIter)); - int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(hashIter)); + GHASH_ITER (gh_iter, polyHash) { + int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter)); + int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter)); MPoly *source = &mpoly[oldIndex]; MPoly *dest = &mpoly_new[newIndex]; int oldLoopIndex = source->loopstart; @@ -354,8 +343,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } } - BLI_ghashIterator_free(hashIter); - MEM_freeN(loop_mapping); /* why is this needed? - campbell */ |