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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-03-30 10:45:13 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-30 10:45:13 +0400
commite0d94b724441ac30e8b99991bb73beb8e133d57b (patch)
tree317dfbab8449a322df5940930d0e5a05d22b067f /source
parent0740e9e46406dc6d8690a149e43932a6963d0568 (diff)
minor speedup converting a BMesh to a Mesh - avoid loop over all faces to count how many loops to use, since BMesh stores totloop.
also use camel case for UndoMesh (convention)
Diffstat (limited to 'source')
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.c22
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c8
2 files changed, 12 insertions, 18 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index c5cc0a01b9c..1db0280b4af 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -435,31 +435,25 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess)
BMLoop *l;
BMFace *f;
BMIter iter, liter;
- int i, j, *keyi, ototvert, totloop;
+ int i, j, *keyi, ototvert;
ototvert = me->totvert;
- /* new Vertex block */
+ /* new vertex block */
if (bm->totvert == 0) mvert = NULL;
else mvert = MEM_callocN(bm->totvert * sizeof(MVert), "loadeditbMesh vert");
- /* new Edge block */
+ /* new edge block */
if (bm->totedge == 0) medge = NULL;
else medge = MEM_callocN(bm->totedge * sizeof(MEdge), "loadeditbMesh edge");
- /* build ngon data */
- /* new Ngon Face block */
+ /* new ngon face block */
if (bm->totface == 0) mpoly = NULL;
else mpoly = MEM_callocN(bm->totface * sizeof(MPoly), "loadeditbMesh poly");
- /* find number of loops to allocate */
- totloop = 0;
- BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) {
- totloop += f->len;
- }
-
- if (totloop == 0) mloop = NULL;
- else mloop = MEM_callocN(totloop * sizeof(MLoop), "loadeditbMesh loop");
+ /* new loop block */
+ if (bm->totloop == 0) mloop = NULL;
+ else mloop = MEM_callocN(bm->totloop * sizeof(MLoop), "loadeditbMesh loop");
/* lets save the old verts just in case we are actually working on
* a key ... we now do processing of the keys at the end */
@@ -478,7 +472,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess)
/* add new custom data */
me->totvert = bm->totvert;
me->totedge = bm->totedge;
- me->totloop = totloop;
+ me->totloop = bm->totloop;
me->totpoly = bm->totface;
/* will be overwritten with a valid value if 'dotess' is set, otherwise we
* end up with 'me->totface' and me->mface == NULL which can crash [#28625]
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 7bb1cc6944e..f824a9062c9 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -512,11 +512,11 @@ static void *getEditMesh(bContext *C)
return NULL;
}
-typedef struct undomesh {
+typedef struct UndoMesh {
Mesh me;
int selectmode;
char obname[MAX_ID_NAME - 2];
-} undomesh;
+} UndoMesh;
/* undo simply makes copies of a bmesh */
static void *editbtMesh_to_undoMesh(void *emv, void *obdata)
@@ -524,7 +524,7 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata)
BMEditMesh *em = emv;
Mesh *obme = obdata;
- undomesh *um = MEM_callocN(sizeof(undomesh), "undo Mesh");
+ UndoMesh *um = MEM_callocN(sizeof(UndoMesh), "undo Mesh");
BLI_strncpy(um->obname, em->ob->id.name + 2, sizeof(um->obname));
/* make sure shape keys work */
@@ -543,7 +543,7 @@ static void undoMesh_to_editbtMesh(void *umv, void *em_v, void *UNUSED(obdata))
{
BMEditMesh *em = em_v, *em_tmp;
Object *ob;
- undomesh *um = umv;
+ UndoMesh *um = umv;
BMesh *bm;
/* BMESH_TODO - its possible the name wont be found right?, should fallback */