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>2011-11-16 16:38:40 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-16 16:38:40 +0400
commitda849bbfc042a2f879031f3736974ade45348d6e (patch)
treee810725d273a5ac4ae612835d51a58267c4c1ed8 /source/blender/editors/util
parentdfe90e54cda718acbb1ce2fabe69a1fc317899c1 (diff)
prepare for flagging the bmesh has having invalid index values, so we can skip looping over all elements if its already valid.
- went over every BM_SetIndex call and added comments about its use, if its setting dirty values or correct ones. - replace loops over all elements _just_ to set index values, with a new function, BM_ElemIndex_Ensure(...), this will eventually only initialize values when they are dirty.
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r--source/blender/editors/util/crazyspace.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c
index 8c5d7d6990b..26db6ff32ac 100644
--- a/source/blender/editors/util/crazyspace.c
+++ b/source/blender/editors/util/crazyspace.c
@@ -146,13 +146,8 @@ void crazyspace_set_quats_editmesh(BMEditMesh *em, float *origcos, float *mapped
int *vert_table = MEM_callocN(sizeof(int)*em->bm->totvert, "vert_table");
int index = 0;
- /* BMESH_TODO this should be valid now, leaving here until we can ensure this - campbell */
- BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- BM_SetIndex(v, index);
- index++;
- }
-
- index = 0;
+ BM_ElemIndex_Ensure(em->bm, BM_VERT);
+
BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
if (!BM_TestHFlag(v, BM_SELECT) || BM_TestHFlag(v, BM_HIDDEN))
continue;
@@ -179,17 +174,16 @@ void crazyspace_set_quats_editmesh(BMEditMesh *em, float *origcos, float *mapped
}
}
- /* BMESH_TODO, don't overwrite invalid index info! */
-
index = 0;
BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
if (vert_table[index] != 0)
- BM_SetIndex(v, vert_table[index]-1);
+ BM_SetIndex(v, vert_table[index]-1); /* set_dirty! */
else
- BM_SetIndex(v, -1);
+ BM_SetIndex(v, -1); /* set_dirty! */
index++;
}
+ em->bm->elem_index_dirty |= BM_VERT;
MEM_freeN(vert_table);
#if 0