skip using bmesh operators for converting to/from undo meshes (gives some speedup)

This commit is contained in:
2012-03-29 01:41:56 +00:00
parent a308b6c0ec
commit 42076f0a1f
10 changed files with 24 additions and 20 deletions

View File

@@ -556,7 +556,7 @@ BMesh *BKE_mesh_to_bmesh(Mesh *me, Object *ob)
bm = BM_mesh_create(&bm_mesh_allocsize_default);
BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%b", me, ob, TRUE);
BM_mesh_bm_from_me(bm, me, TRUE, ob->shapenr);
return bm;
}

View File

@@ -110,7 +110,7 @@ void EDBM_mesh_normals_update(struct BMEditMesh *em);
void EDBM_mesh_make(struct ToolSettings *ts, struct Scene *scene, struct Object *ob);
void EDBM_mesh_free(struct BMEditMesh *tm);
void EDBM_mesh_load(struct Scene *scene, struct Object *ob);
void EDBM_mesh_load(struct Object *ob);
void EDBM_index_arrays_init(struct BMEditMesh *em, int forvert, int foredge, int forface);
void EDBM_index_arrays_free(struct BMEditMesh *em);

View File

@@ -301,12 +301,12 @@ void EDBM_mesh_make(ToolSettings *ts, Scene *UNUSED(scene), Object *ob)
me->edit_btmesh->ob = ob;
}
void EDBM_mesh_load(Scene *scene, Object *ob)
void EDBM_mesh_load(Object *ob)
{
Mesh *me = ob->data;
BMesh *bm = me->edit_btmesh->bm;
BMO_op_callf(bm, "object_load_bmesh scene=%p object=%p", scene, ob);
BM_mesh_bm_to_me(bm, me, FALSE);
#ifdef USE_TESSFACE_DEFAULT
BKE_mesh_tessface_calc(me);
@@ -552,7 +552,11 @@ static void undoMesh_to_editbtMesh(void *umv, void *em_v, void *UNUSED(obdata))
BMEdit_Free(em);
bm = BM_mesh_create(&bm_mesh_allocsize_default);
BMO_op_callf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%b", &um->me, ob, FALSE);
BM_mesh_bm_from_me(bm, &um->me, FALSE, ob->shapenr);
/* face normals need recalculation since we are not calling through an operator */
BM_mesh_normals_update(bm, TRUE);
em_tmp = BMEdit_Create(bm, TRUE);
*em = *em_tmp;
@@ -563,16 +567,16 @@ static void undoMesh_to_editbtMesh(void *umv, void *em_v, void *UNUSED(obdata))
MEM_freeN(em_tmp);
}
static void free_undo(void *umv)
static void free_undo(void *me_v)
{
if (((Mesh *)umv)->key) {
free_key(((Mesh *)umv)->key);
MEM_freeN(((Mesh *)umv)->key);
Mesh *me = me_v;
if (me->key) {
free_key(me->key);
MEM_freeN(me->key);
}
free_mesh(umv, 0);
MEM_freeN(umv);
free_mesh(me, FALSE);
MEM_freeN(me);
}
/* and this is all the undo system needs to know */

View File

@@ -614,7 +614,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
ED_uvedit_assign_image(bmain, scene, obedit, ima, NULL);
if (exitmode) {
EDBM_mesh_load(scene, obedit);
EDBM_mesh_load(obedit);
EDBM_mesh_free(me->edit_btmesh);
MEM_freeN(me->edit_btmesh);
me->edit_btmesh = NULL;

View File

@@ -543,7 +543,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
#else
/* toggle editmode using lower level functions so this can be called from python */
EDBM_mesh_make(scene->toolsettings, scene, ob);
EDBM_mesh_load(scene, ob);
EDBM_mesh_load(ob);
EDBM_mesh_free(me->edit_btmesh);
MEM_freeN(me->edit_btmesh);
me->edit_btmesh = NULL;

View File

@@ -327,7 +327,7 @@ void ED_object_exit_editmode(bContext *C, int flag)
return;
}
EDBM_mesh_load(scene, obedit);
EDBM_mesh_load(obedit);
if (freedata) {
EDBM_mesh_free(me->edit_btmesh);

View File

@@ -308,7 +308,7 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int *
BMEditMesh *em;
EDBM_mesh_load(scene, obedit);
EDBM_mesh_load(obedit);
EDBM_mesh_make(scene->toolsettings, scene, obedit);
em = me->edit_btmesh;

View File

@@ -128,7 +128,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
Mesh *me= obedit->data;
BMEditMesh *em;
EDBM_mesh_load(scene, obedit);
EDBM_mesh_load(obedit);
EDBM_mesh_make(scene->toolsettings, scene, obedit);
em= me->edit_btmesh;

View File

@@ -228,7 +228,7 @@ void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
/* exit/enter editmode to get new shape */
switch (ob->type) {
case OB_MESH:
EDBM_mesh_load(scene, ob);
EDBM_mesh_load(ob);
EDBM_mesh_make(scene->toolsettings, scene, ob);
BMEdit_RecalcTessellation(((Mesh*)ob->data)->edit_btmesh);
break;

View File

@@ -116,7 +116,7 @@ struct wmWindowManager;
/*new render funcs */
void EDBM_selectmode_set(struct BMEditMesh *em) {}
void EDBM_mesh_load(struct Scene *scene, struct Object *ob) {}
void EDBM_mesh_load(struct Object *ob) {}
void EDBM_mesh_make(struct ToolSettings *ts, struct Scene *scene, struct Object *ob) {}
void *g_system;