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-12-12 11:31:22 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-12-12 11:31:22 +0400
commitf06370dd446039227f6045041a3aeb04f0d378cf (patch)
treeda3f6d6cafa6f229d6da8fa511133aab4f7e9e7a /source/blender/editors/mesh
parent2ee180eab678c0b21e92aa0175ad93528d9009ae (diff)
fix for EDBM_index_arrays_ensure not working as intended.
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 17a9c7df41b..9852283430a 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -394,18 +394,23 @@ void EDBM_mesh_free(BMEditMesh *em)
void EDBM_index_arrays_ensure(BMEditMesh *em, const char htype)
{
+ /* assume if the array is non-null then its valid and no need to recalc */
+ const char htype_needed = ((em->vert_index ? 0 : BM_VERT) |
+ (em->edge_index ? 0 : BM_EDGE) |
+ (em->face_index ? 0 : BM_FACE)) & htype;
+
BLI_assert((htype & ~BM_ALL_NOLOOP) == 0);
/* in debug mode double check we didn't need to recalculate */
BLI_assert(EDBM_index_arrays_check(em) == TRUE);
- if (htype & BM_VERT) {
+ if (htype_needed & BM_VERT) {
em->vert_index = MEM_mallocN(sizeof(void **) * em->bm->totvert, "em->vert_index");
}
- if (htype & BM_EDGE) {
+ if (htype_needed & BM_EDGE) {
em->edge_index = MEM_mallocN(sizeof(void **) * em->bm->totedge, "em->edge_index");
}
- if (htype & BM_FACE) {
+ if (htype_needed & BM_FACE) {
em->face_index = MEM_mallocN(sizeof(void **) * em->bm->totface, "em->face_index");
}
@@ -413,19 +418,19 @@ void EDBM_index_arrays_ensure(BMEditMesh *em, const char htype)
{
#pragma omp section
{
- if (htype & BM_VERT) {
+ if (htype_needed & BM_VERT) {
BM_iter_as_array(em->bm, BM_VERTS_OF_MESH, NULL, (void **)em->vert_index, em->bm->totvert);
}
}
#pragma omp section
{
- if (htype & BM_EDGE) {
+ if (htype_needed & BM_EDGE) {
BM_iter_as_array(em->bm, BM_EDGES_OF_MESH, NULL, (void **)em->edge_index, em->bm->totedge);
}
}
#pragma omp section
{
- if (htype & BM_FACE) {
+ if (htype_needed & BM_FACE) {
BM_iter_as_array(em->bm, BM_FACES_OF_MESH, NULL, (void **)em->face_index, em->bm->totface);
}
}