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-02 00:09:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-02 00:09:17 +0400
commit9aafe32147064a41aa653a95c89b50d9585ab3c1 (patch)
tree8d3f000b54f9adf3245548cb4586973ea5f3ec22
parentd534f0e16dfdf3ed2a3360ad9f317a258cd8cc8e (diff)
bmmesh api - use struct rather than int[4] to initialize mesh sizes.
also correct bad assert() in previous commit.
-rw-r--r--source/blender/blenkernel/intern/customdata.c1
-rw-r--r--source/blender/blenkernel/intern/mesh.c2
-rw-r--r--source/blender/blenkernel/intern/modifiers_bmesh.c10
-rw-r--r--source/blender/bmesh/bmesh.h52
-rw-r--r--source/blender/bmesh/bmesh_class.h46
-rw-r--r--source/blender/bmesh/bmesh_operator_api.h6
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.c10
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.c16
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.h10
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api_inline.c22
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers.c3
-rw-r--r--source/blender/bmesh/operators/bmo_dissolve.c6
-rw-r--r--source/blender/bmesh/operators/bmo_dupe.c2
-rw-r--r--source/blender/bmesh/operators/bmo_edgesplit.c2
-rw-r--r--source/blender/bmesh/operators/bmo_mesh_conv.c8
-rw-r--r--source/blender/bmesh/tools/BME_bevel.c1
-rw-r--r--source/blender/editors/mesh/bmesh_tools.c10
-rw-r--r--source/blender/editors/mesh/bmesh_utils.c2
-rw-r--r--source/blender/editors/mesh/knifetool.c2
19 files changed, 105 insertions, 106 deletions
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 1d6e6be0fba..09525e23c6b 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -51,6 +51,7 @@
#include "BLI_mempool.h"
#include "BLI_utildefines.h"
+#include "BKE_utildefines.h"
#include "BKE_customdata.h"
#include "BKE_customdata_file.h"
#include "BKE_global.h"
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index f9dc0ef0b93..33ef226f411 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -526,7 +526,7 @@ BMesh *BKE_mesh_to_bmesh(Mesh *me, Object *ob)
{
BMesh *bm;
- bm = BM_mesh_create(ob, bm_mesh_allocsize_default);
+ bm = BM_mesh_create(ob, &bm_mesh_allocsize_default);
BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%b", me, ob, TRUE);
diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c
index 6bca40be1e2..fb7e18e295e 100644
--- a/source/blender/blenkernel/intern/modifiers_bmesh.c
+++ b/source/blender/blenkernel/intern/modifiers_bmesh.c
@@ -143,8 +143,12 @@ BMEditMesh *DM_to_editbmesh(Object *ob, DerivedMesh *dm, BMEditMesh *existing, i
BMEditMesh *em = existing;
BMesh *bm;
- if (em) bm = em->bm;
- else bm = BM_mesh_create(ob, bm_mesh_allocsize_default);
+ if (em) {
+ bm = em->bm;
+ }
+ else {
+ bm = BM_mesh_create(ob, &bm_mesh_allocsize_default);
+ }
DM_to_bmesh_ex(dm, bm);
@@ -164,7 +168,7 @@ BMesh *DM_to_bmesh(Object *ob, DerivedMesh *dm)
{
BMesh *bm;
- bm = BM_mesh_create(ob, bm_mesh_allocsize_default);
+ bm = BM_mesh_create(ob, &bm_mesh_allocsize_default);
DM_to_bmesh_ex(dm, bm);
diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h
index 17658d86e7e..9cf71e66b1c 100644
--- a/source/blender/bmesh/bmesh.h
+++ b/source/blender/bmesh/bmesh.h
@@ -201,63 +201,13 @@ extern "C" {
#include "DNA_listBase.h"
#include "DNA_customdata_types.h"
+#include <stdlib.h>
#include "BLI_utildefines.h"
#include "bmesh_class.h"
/*forward declarations*/
-/*
- * BMHeader
- *
- * All mesh elements begin with a BMHeader. This structure
- * hold several types of data
- *
- * 1: The type of the element (vert, edge, loop or face)
- * 2: Persistant "header" flags/markings (sharp, seam, select, hidden, ect)
- note that this is different from the "tool" flags.
- * 3: Unique ID in the bmesh.
- * 4: some elements for internal record keeping.
- *
-*/
-
-/* BMHeader->htype (char) */
-enum {
- BM_VERT = 1,
- BM_EDGE = 2,
- BM_LOOP = 4,
- BM_FACE = 8
-};
-
-#define BM_ALL (BM_VERT | BM_EDGE | BM_LOOP | BM_FACE)
-
-/* BMHeader->hflag (char) */
-enum {
- BM_ELEM_SELECT = (1 << 0),
- BM_ELEM_HIDDEN = (1 << 1),
- BM_ELEM_SEAM = (1 << 2),
- BM_ELEM_SMOOTH = (1 << 3), /* used for faces and edges, note from the user POV,
- * this is a sharp edge when disabled */
-
- BM_ELEM_TAG = (1 << 4), /* internal flag, used for ensuring correct normals
- * during multires interpolation, and any other time
- * when temp tagging is handy.
- * always assume dirty & clear before use. */
-
- /* we have 2 spare flags which is awesome but since we're limited to 8
- * only add new flags with care! - campbell */
- /* BM_ELEM_SPARE = (1 << 5), */
- /* BM_ELEM_SPARE = (1 << 6), */
-
- BM_ELEM_INTERNAL_TAG = (1 << 7) /* for low level internal API tagging,
- * since tools may want to tag verts and
- * not have functions clobber them */
-};
-
-/* Mesh Level Ops */
-extern int bm_mesh_allocsize_default[4];
-
-
/* ------------------------------------------------------------------------- */
/* bmesh_inline.c */
diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h
index f071e00211c..1c7717ac5f0 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -47,6 +47,19 @@ struct Object;
*
* hrm. it doesnt but stull works ok, remove the comment above? - campbell.
*/
+
+/**
+ * BMHeader
+ *
+ * All mesh elements begin with a BMHeader. This structure
+ * hold several types of data
+ *
+ * 1: The type of the element (vert, edge, loop or face)
+ * 2: Persistant "header" flags/markings (smooth, seam, select, hidden, ect)
+ * note that this is different from the "tool" flags.
+ * 3: Unique ID in the bmesh.
+ * 4: some elements for internal record keeping.
+ */
typedef struct BMHeader {
void *data; /* customdata layers */
int index; /* notes:
@@ -188,4 +201,37 @@ typedef struct BMesh {
int opflag; /* current operator flag */
} BMesh;
+/* BMHeader->htype (char) */
+enum {
+ BM_VERT = 1,
+ BM_EDGE = 2,
+ BM_LOOP = 4,
+ BM_FACE = 8
+};
+
+#define BM_ALL (BM_VERT | BM_EDGE | BM_LOOP | BM_FACE)
+
+/* BMHeader->hflag (char) */
+enum {
+ BM_ELEM_SELECT = (1 << 0),
+ BM_ELEM_HIDDEN = (1 << 1),
+ BM_ELEM_SEAM = (1 << 2),
+ BM_ELEM_SMOOTH = (1 << 3), /* used for faces and edges, note from the user POV,
+ * this is a sharp edge when disabled */
+
+ BM_ELEM_TAG = (1 << 4), /* internal flag, used for ensuring correct normals
+ * during multires interpolation, and any other time
+ * when temp tagging is handy.
+ * always assume dirty & clear before use. */
+
+ /* we have 2 spare flags which is awesome but since we're limited to 8
+ * only add new flags with care! - campbell */
+ /* BM_ELEM_SPARE = (1 << 5), */
+ /* BM_ELEM_SPARE = (1 << 6), */
+
+ BM_ELEM_INTERNAL_TAG = (1 << 7) /* for low level internal API tagging,
+ * since tools may want to tag verts and
+ * not have functions clobber them */
+};
+
#endif /* __BMESH_CLASS_H__ */
diff --git a/source/blender/bmesh/bmesh_operator_api.h b/source/blender/bmesh/bmesh_operator_api.h
index c4fbae4da8e..04cca767d9e 100644
--- a/source/blender/bmesh/bmesh_operator_api.h
+++ b/source/blender/bmesh/bmesh_operator_api.h
@@ -31,13 +31,9 @@
extern "C" {
#endif
-#include "BLI_memarena.h"
#include "BLI_ghash.h"
-#include "BKE_utildefines.h"
-
#include <stdarg.h>
-#include <string.h> /* for memcpy */
/*
* operators represent logical, executable mesh modules. all topological
@@ -140,7 +136,7 @@ typedef struct BMOperator {
int needflag;
int flag;
struct BMOpSlot slots[BMO_OP_MAX_SLOTS]; void (*exec)(BMesh *bm, struct BMOperator *op);
- MemArena *arena;
+ struct MemArena *arena;
} BMOperator;
#define MAX_SLOTNAME 32
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
index 7ff8fd0b7f4..a0fd3ec9250 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -589,17 +589,17 @@ BMesh *BM_mesh_copy(BMesh *bmold)
int i, j;
/* allocate a bmesh */
- bm = BM_mesh_create(bmold->ob, bm_mesh_allocsize_default);
+ bm = BM_mesh_create(bmold->ob, &bm_mesh_allocsize_default);
CustomData_copy(&bmold->vdata, &bm->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_copy(&bmold->edata, &bm->edata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_copy(&bmold->ldata, &bm->ldata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_copy(&bmold->pdata, &bm->pdata, CD_MASK_BMESH, CD_CALLOC, 0);
- CustomData_bmesh_init_pool(&bm->vdata, bm_mesh_allocsize_default[0]);
- CustomData_bmesh_init_pool(&bm->edata, bm_mesh_allocsize_default[1]);
- CustomData_bmesh_init_pool(&bm->ldata, bm_mesh_allocsize_default[2]);
- CustomData_bmesh_init_pool(&bm->pdata, bm_mesh_allocsize_default[3]);
+ CustomData_bmesh_init_pool(&bm->vdata, bm_mesh_allocsize_default.totvert);
+ CustomData_bmesh_init_pool(&bm->edata, bm_mesh_allocsize_default.totedge);
+ CustomData_bmesh_init_pool(&bm->ldata, bm_mesh_allocsize_default.totloop);
+ CustomData_bmesh_init_pool(&bm->pdata, bm_mesh_allocsize_default.totface);
vtable = MEM_mallocN(sizeof(BMVert *) * bmold->totvert, "BM_mesh_copy vtable");
etable = MEM_mallocN(sizeof(BMEdge *) * bmold->totedge, "BM_mesh_copy etable");
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index 98436640b11..8778dad421f 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -44,14 +44,14 @@
#include "bmesh_private.h"
/* used as an extern, defined in bmesh.h */
-int bm_mesh_allocsize_default[4] = {512, 512, 2048, 512};
+BMAllocTemplate bm_mesh_allocsize_default = {512, 512, 2048, 512};
-static void bm_mempool_init(BMesh *bm, const int allocsize[4])
+static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize)
{
- bm->vpool = BLI_mempool_create(sizeof(BMVert), allocsize[0], allocsize[0], FALSE, TRUE);
- bm->epool = BLI_mempool_create(sizeof(BMEdge), allocsize[1], allocsize[1], FALSE, TRUE);
- bm->lpool = BLI_mempool_create(sizeof(BMLoop), allocsize[2], allocsize[2], FALSE, FALSE);
- bm->fpool = BLI_mempool_create(sizeof(BMFace), allocsize[3], allocsize[3], FALSE, TRUE);
+ bm->vpool = BLI_mempool_create(sizeof(BMVert), allocsize->totvert, allocsize->totvert, FALSE, TRUE);
+ bm->epool = BLI_mempool_create(sizeof(BMEdge), allocsize->totedge, allocsize->totedge, FALSE, TRUE);
+ bm->lpool = BLI_mempool_create(sizeof(BMLoop), allocsize->totloop, allocsize->totloop, FALSE, FALSE);
+ bm->fpool = BLI_mempool_create(sizeof(BMFace), allocsize->totface, allocsize->totface, FALSE, TRUE);
#ifdef USE_BMESH_HOLES
bm->looplistpool = BLI_mempool_create(sizeof(BMLoopList), allocsize[3], allocsize[3], FALSE, FALSE);
@@ -70,7 +70,7 @@ static void bm_mempool_init(BMesh *bm, const int allocsize[4])
*
* \note ob is needed by multires
*/
-BMesh *BM_mesh_create(struct Object *ob, const int allocsize[4])
+BMesh *BM_mesh_create(struct Object *ob, BMAllocTemplate *allocsize)
{
/* allocate the structure */
BMesh *bm = MEM_callocN(sizeof(BMesh), __func__);
@@ -173,7 +173,7 @@ void BM_mesh_clear(BMesh *bm)
bm->ob = ob;
/* allocate the memory pools for the mesh elements */
- bm_mempool_init(bm, bm_mesh_allocsize_default);
+ bm_mempool_init(bm, &bm_mesh_allocsize_default);
bm->stackdepth = 1;
bm->totflags = 1;
diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h
index 373b530894a..ea80696a855 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.h
+++ b/source/blender/bmesh/intern/bmesh_mesh.h
@@ -27,7 +27,9 @@
* \ingroup bmesh
*/
-BMesh *BM_mesh_create(struct Object *ob, const int allocsize[4]);
+struct BMAllocTemplate;
+
+BMesh *BM_mesh_create(struct Object *ob, struct BMAllocTemplate *allocsize);
void BM_mesh_free(BMesh *bm);
void BM_mesh_data_free(BMesh *bm);
@@ -46,4 +48,10 @@ BMVert *BM_vert_at_index(BMesh *bm, const int index);
BMEdge *BM_edge_at_index(BMesh *bm, const int index);
BMFace *BM_face_at_index(BMesh *bm, const int index);
+typedef struct BMAllocTemplate {
+ int totvert, totedge, totloop, totface;
+} BMAllocTemplate;
+
+extern BMAllocTemplate bm_mesh_allocsize_default;
+
#endif /* __BMESH_MESH_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.c b/source/blender/bmesh/intern/bmesh_operator_api_inline.c
index a7c8f1612eb..5b88d9f1b96 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api_inline.c
+++ b/source/blender/bmesh/intern/bmesh_operator_api_inline.c
@@ -94,14 +94,9 @@ BM_INLINE void BMO_slot_map_ptr_insert(BMesh *bm, BMOperator *op, const char *sl
BM_INLINE int BMO_slot_map_contains(BMesh *UNUSED(bm), BMOperator *op, const char *slotname, void *element)
{
BMOpSlot *slot = BMO_slot_get(op, slotname);
+ BLI_assert(slot->slottype == BMO_OP_SLOT_MAPPING);
- /*sanity check*/
- if (slot->slottype != BMO_OP_SLOT_MAPPING) {
-#ifdef DEBUG
- printf("%s: invalid type %d\n", __func__, slot->slottype);
-#endif
- return 0;
- }
+ /* sanity check */
if (!slot->data.ghash) return 0;
return BLI_ghash_haskey(slot->data.ghash, element);
@@ -112,14 +107,9 @@ BM_INLINE void *BMO_slot_map_data_get(BMesh *UNUSED(bm), BMOperator *op, const c
{
BMOElemMapping *mapping;
BMOpSlot *slot = BMO_slot_get(op, slotname);
+ BLI_assert(slot->slottype == BMO_OP_SLOT_MAPPING);
- /*sanity check*/
- if (slot->slottype != BMO_OP_SLOT_MAPPING) {
-#ifdef DEBUG
- printf("%s: invalid type %d\n", __func__, slot->slottype);
-#endif
- return NULL;
- }
+ /* sanity check */
if (!slot->data.ghash) return NULL;
mapping = (BMOElemMapping *)BLI_ghash_lookup(slot->data.ghash, element);
@@ -132,7 +122,7 @@ BM_INLINE void *BMO_slot_map_data_get(BMesh *UNUSED(bm), BMOperator *op, const c
BM_INLINE float BMO_slot_map_float_get(BMesh *bm, BMOperator *op, const char *slotname,
void *element)
{
- float *val = (float*) BMO_slot_map_data_get(bm, op, slotname, element);
+ float *val = (float *) BMO_slot_map_data_get(bm, op, slotname, element);
if (val) return *val;
return 0.0f;
@@ -141,7 +131,7 @@ BM_INLINE float BMO_slot_map_float_get(BMesh *bm, BMOperator *op, const char *sl
BM_INLINE int BMO_slot_map_int_get(BMesh *bm, BMOperator *op, const char *slotname,
void *element)
{
- int *val = (int*) BMO_slot_map_data_get(bm, op, slotname, element);
+ int *val = (int *) BMO_slot_map_data_get(bm, op, slotname, element);
if (val) return *val;
return 0;
diff --git a/source/blender/bmesh/intern/bmesh_walkers.c b/source/blender/bmesh/intern/bmesh_walkers.c
index 3116de3922b..f18a0835e5e 100644
--- a/source/blender/bmesh/intern/bmesh_walkers.c
+++ b/source/blender/bmesh/intern/bmesh_walkers.c
@@ -27,8 +27,7 @@
*/
#include <stdlib.h>
-
-
+#include <string.h> /* for memcpy */
#include "BLI_listbase.h"
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index 2d8f99475d6..162992f7df8 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -174,12 +174,14 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
}
}
- if (BMO_error_occurred(bm)) goto cleanup;
+ if (BMO_error_occurred(bm)) {
+ goto cleanup;
+ }
BMO_slot_buffer_from_flag(bm, op, "regionout", FACE_NEW, BM_FACE);
cleanup:
- /* free/cleanu */
+ /* free/cleanup */
for (i = 0; i < BLI_array_count(regions); i++) {
if (regions[i]) MEM_freeN(regions[i]);
}
diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c
index 7c8192d1ccf..5c800ba083a 100644
--- a/source/blender/bmesh/operators/bmo_dupe.c
+++ b/source/blender/bmesh/operators/bmo_dupe.c
@@ -440,7 +440,7 @@ void bmo_split_exec(BMesh *bm, BMOperator *op)
BMO_slot_copy(&dupeop, splitop, "isovertmap",
"isovertmap");
- /* cleanu */
+ /* cleanup */
BMO_op_finish(bm, &delop);
BMO_op_finish(bm, &dupeop);
}
diff --git a/source/blender/bmesh/operators/bmo_edgesplit.c b/source/blender/bmesh/operators/bmo_edgesplit.c
index 4d4d429a237..059ee882fb8 100644
--- a/source/blender/bmesh/operators/bmo_edgesplit.c
+++ b/source/blender/bmesh/operators/bmo_edgesplit.c
@@ -20,6 +20,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <string.h> /* for memcpy */
+
#include "MEM_guardedalloc.h"
#include "BLI_array.h"
diff --git a/source/blender/bmesh/operators/bmo_mesh_conv.c b/source/blender/bmesh/operators/bmo_mesh_conv.c
index 27a1b5459ed..9cab8cd5f91 100644
--- a/source/blender/bmesh/operators/bmo_mesh_conv.c
+++ b/source/blender/bmesh/operators/bmo_mesh_conv.c
@@ -137,10 +137,10 @@ void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
printf("shapekey <-> mesh mismatch!\n");
}
- CustomData_bmesh_init_pool(&bm->vdata, bm_mesh_allocsize_default[0]);
- CustomData_bmesh_init_pool(&bm->edata, bm_mesh_allocsize_default[1]);
- CustomData_bmesh_init_pool(&bm->ldata, bm_mesh_allocsize_default[2]);
- CustomData_bmesh_init_pool(&bm->pdata, bm_mesh_allocsize_default[3]);
+ CustomData_bmesh_init_pool(&bm->vdata, bm_mesh_allocsize_default.totvert);
+ CustomData_bmesh_init_pool(&bm->edata, bm_mesh_allocsize_default.totedge);
+ CustomData_bmesh_init_pool(&bm->ldata, bm_mesh_allocsize_default.totloop);
+ CustomData_bmesh_init_pool(&bm->pdata, bm_mesh_allocsize_default.totface);
for (i = 0, mvert = me->mvert; i < me->totvert; i++, mvert++) {
v = BM_vert_create(bm, keyco && set_key ? keyco[i] : mvert->co, NULL);
diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c
index 31892cc0663..09e88b77323 100644
--- a/source/blender/bmesh/tools/BME_bevel.c
+++ b/source/blender/bmesh/tools/BME_bevel.c
@@ -39,6 +39,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_ghash.h"
+#include "BLI_memarena.h"
#include "bmesh.h"
#include "bmesh_private.h"
diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c
index cf30af4f7e2..8cf798e4a4a 100644
--- a/source/blender/editors/mesh/bmesh_tools.c
+++ b/source/blender/editors/mesh/bmesh_tools.c
@@ -3206,16 +3206,16 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO
if (!em)
return OPERATOR_CANCELLED;
- bmnew = BM_mesh_create(obedit, bm_mesh_allocsize_default);
+ bmnew = BM_mesh_create(obedit, &bm_mesh_allocsize_default);
CustomData_copy(&em->bm->vdata, &bmnew->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_copy(&em->bm->edata, &bmnew->edata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_copy(&em->bm->ldata, &bmnew->ldata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_copy(&em->bm->pdata, &bmnew->pdata, CD_MASK_BMESH, CD_CALLOC, 0);
- CustomData_bmesh_init_pool(&bmnew->vdata, bm_mesh_allocsize_default[0]);
- CustomData_bmesh_init_pool(&bmnew->edata, bm_mesh_allocsize_default[1]);
- CustomData_bmesh_init_pool(&bmnew->ldata, bm_mesh_allocsize_default[2]);
- CustomData_bmesh_init_pool(&bmnew->pdata, bm_mesh_allocsize_default[3]);
+ CustomData_bmesh_init_pool(&bmnew->vdata, bm_mesh_allocsize_default.totvert);
+ CustomData_bmesh_init_pool(&bmnew->edata, bm_mesh_allocsize_default.totedge);
+ CustomData_bmesh_init_pool(&bmnew->ldata, bm_mesh_allocsize_default.totloop);
+ CustomData_bmesh_init_pool(&bmnew->pdata, bm_mesh_allocsize_default.totface);
basenew = ED_object_add_duplicate(bmain, scene, editbase, USER_DUP_MESH); /* 0 = fully linked */
assign_matarar(basenew->object, give_matarar(obedit), *give_totcolp(obedit)); /* new in 2.5 */
diff --git a/source/blender/editors/mesh/bmesh_utils.c b/source/blender/editors/mesh/bmesh_utils.c
index e5c79150dab..830534e3315 100644
--- a/source/blender/editors/mesh/bmesh_utils.c
+++ b/source/blender/editors/mesh/bmesh_utils.c
@@ -546,7 +546,7 @@ static void undoMesh_to_editbtMesh(void *umv, void *emv, void *UNUSED(obdata))
BMEdit_Free(em);
- bm = BM_mesh_create(ob, bm_mesh_allocsize_default);
+ bm = BM_mesh_create(ob, &bm_mesh_allocsize_default);
BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%b", &um->me, ob, FALSE);
em2 = BMEdit_Create(bm, TRUE);
diff --git a/source/blender/editors/mesh/knifetool.c b/source/blender/editors/mesh/knifetool.c
index bc2f01a2483..ba0067faaaa 100644
--- a/source/blender/editors/mesh/knifetool.c
+++ b/source/blender/editors/mesh/knifetool.c
@@ -29,13 +29,13 @@
#include "MEM_guardedalloc.h"
-
#include "BLI_blenlib.h"
#include "BLI_array.h"
#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_smallhash.h"
#include "BLI_scanfill.h"
+#include "BLI_memarena.h"
#include "BKE_DerivedMesh.h"
#include "BKE_context.h"