=bmesh= fixed a shapekey issue with undo

This commit is contained in:
Joseph Eagar 2011-04-17 05:08:03 +00:00
parent 0e9ce1b40d
commit 2a24370bab
4 changed files with 5 additions and 3 deletions

@ -574,7 +574,7 @@ BMesh *BKE_mesh_to_bmesh(Mesh *me, Object *ob)
bm = BM_Make_Mesh(ob, allocsize);
BMO_CallOpf(bm, "mesh_to_bmesh mesh=%p object=%p", me, ob);
BMO_CallOpf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%i", me, ob, 1);
return bm;
}

@ -516,6 +516,7 @@ BMOpDefine def_mesh_to_bmesh = {
"mesh_to_bmesh",
{{BMOP_OPSLOT_PNT, "mesh"}, //pointer to a Mesh structure
{BMOP_OPSLOT_PNT, "object"}, //pointer to an Object structure
{BMOP_OPSLOT_INT, "set_shapekey"}, //load active shapekey coordinates into verts
{0, /*null-terminating sentinel*/}},
mesh_to_bmesh_exec,
0

@ -59,6 +59,7 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op) {
BLI_array_declare(fedges);
float (*keyco)[3]= NULL;
int *keyi;
int set_key = BMO_Get_Int(op, "set_shapekey");
int i, j, li, allocsize[4] = {512, 512, 2048, 512};
if (!me || !me->totvert) return; /*sanity check*/
@ -119,7 +120,7 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op) {
CustomData_bmesh_init_pool(&bm->pdata, allocsize[3]);
for (i=0; i<me->totvert; i++, mvert++) {
v = BM_Make_Vert(bm, keyco ? keyco[i] : mvert->co, NULL);
v = BM_Make_Vert(bm, keyco&&set_key ? keyco[i] : mvert->co, NULL);
normal_short_to_float_v3(v->no, mvert->no);
vt[i] = v;

@ -602,7 +602,7 @@ static void undoMesh_to_editbtMesh(void *umv, void *emv, void *obdata)
BMEdit_Free(em);
bm = BM_Make_Mesh(ob, allocsize);
BMO_CallOpf(bm, "mesh_to_bmesh mesh=%p object=%p", me, ob);
BMO_CallOpf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%i", me, ob, 0);
em2 = BMEdit_Create(bm);
*em = *em2;