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:
authorCampbell Barton <ideasman42@gmail.com>2012-03-23 09:18:03 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-23 09:18:03 +0400
commit24119cb79bb949980445a3184e1633976179dcbb (patch)
tree90c02345fe8075763880d2270112c8d1f5f9a2ff /source/blender/bmesh
parentda15fbf7b4bd55095af4132dc0d854ce062b3714 (diff)
minor speedup to vertex split function, avoid a hash lookup when its not needed.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index 6aaa2911bd9..4a71de98d37 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -1784,6 +1784,7 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len)
maxindex++;
}
+ BLI_array_free(stack);
/* Make enough verts to split v for each group */
verts = MEM_callocN(sizeof(BMVert *) * maxindex, __func__);
@@ -1794,6 +1795,10 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len)
/* Replace v with the new verts in each group */
BM_ITER(l, &liter, bm, BM_LOOPS_OF_VERT, v) {
+ /* call first since its faster then a hash lookup */
+ if (l->v != v) {
+ continue;
+ }
i = GET_INT_FROM_POINTER(BLI_ghash_lookup(visithash, l->e));
if (i == 0) {
continue;
@@ -1805,9 +1810,7 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len)
* towards vertex v, and another for the loop heading out from
* vertex v. Only need to swap the vertex on one of those times,
* on the outgoing loop. */
- if (l->v == v) {
- l->v = verts[i];
- }
+ l->v = verts[i];
}
BM_ITER(e, &eiter, bm, BM_EDGES_OF_VERT, v) {
@@ -1823,7 +1826,6 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len)
}
BLI_ghash_free(visithash, NULL, NULL);
- BLI_array_free(stack);
for (i = 0; i < maxindex; i++) {
BM_CHECK_ELEMENT(bm, verts[i]);