remove mesh and object arguments from bmesh operators, these are stored within the BMesh its self.

This commit is contained in:
Campbell Barton 2011-09-09 02:21:57 +00:00
parent d841067c35
commit 0727893231
8 changed files with 21 additions and 30 deletions

@ -61,7 +61,7 @@ struct Scene;
extern "C" {
#endif
struct BMesh *BKE_mesh_to_bmesh(struct Mesh *me, struct Object *ob);
struct BMesh *BKE_mesh_to_bmesh(struct Object *ob);
/*
this function recreates a tesselation.

@ -569,14 +569,14 @@ Mesh *copy_mesh(Mesh *me)
return men;
}
BMesh *BKE_mesh_to_bmesh(Mesh *me, Object *ob)
BMesh *BKE_mesh_to_bmesh(Object *ob)
{
BMesh *bm;
int allocsize[4] = {512,512,2048,512};
bm = BM_Make_Mesh(ob, allocsize);
BMO_CallOpf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%i", me, ob, 1);
BMO_CallOpf(bm, "mesh_to_bmesh set_shapekey=%i", 1);
return bm;
}

@ -143,7 +143,7 @@ defining edges[0], and define the winding of the new face.*/
struct BMFace *BM_Make_Ngon ( struct BMesh *bm, struct BMVert *v1, struct BMVert *v2, struct BMEdge **edges, int len, int nodouble );
/*stuff for dealing with header flags*/
BM_INLINE int BM_TestHFlag(void *element, const int flag);
BM_INLINE int BM_TestHFlag(const void *element, const int flag);
/*stuff for dealing with header flags*/
BM_INLINE void BM_SetHFlag(void *element, const int flag);

@ -3,10 +3,9 @@
#include "bmesh.h"
BM_INLINE int BM_TestHFlag(void *element, const int flag)
BM_INLINE int BM_TestHFlag(const void *element, const int flag)
{
BMHeader *e = element;
return e->flag & flag;
return ((BMHeader *)element)->flag & flag;
}
/*stuff for dealing with header flags*/

@ -497,7 +497,6 @@ static BMOpDefine def_transform = {
static BMOpDefine def_object_load_bmesh = {
"object_load_bmesh",
{{BMOP_OPSLOT_PNT, "scene"},
{BMOP_OPSLOT_PNT, "object"},
{0, /*null-terminating sentinel*/}},
object_load_bmesh_exec,
0,
@ -511,9 +510,7 @@ static BMOpDefine def_object_load_bmesh = {
*/
static BMOpDefine def_bmesh_to_mesh = {
"bmesh_to_mesh",
{{BMOP_OPSLOT_PNT, "mesh"}, //pointer to a mesh structure to fill in
{BMOP_OPSLOT_PNT, "object"}, //pointer to an object structure
{BMOP_OPSLOT_INT, "notesselation"}, //don't calculate mfaces
{{BMOP_OPSLOT_INT, "notesselation"}, //don't calculate mfaces
{0, /*null-terminating sentinel*/}},
bmesh_to_mesh_exec,
0,
@ -527,9 +524,7 @@ static BMOpDefine def_bmesh_to_mesh = {
*/
static 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
{{BMOP_OPSLOT_INT, "set_shapekey"}, //load active shapekey coordinates into verts
{0, /*null-terminating sentinel*/}},
mesh_to_bmesh_exec,
0

@ -44,8 +44,8 @@
*/
void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op) {
Object *ob = BMO_Get_Pnt(op, "object");
Mesh *me = BMO_Get_Pnt(op, "mesh");
Object *ob = bm->ob;
Mesh *me = ob->data;
MVert *mvert;
BLI_array_declare(verts);
MEdge *medge;
@ -347,12 +347,9 @@ static void loops_to_corners(BMesh *bm, Mesh *me, int findex,
}
}
void object_load_bmesh_exec(BMesh *bm, BMOperator *op) {
Object *ob = BMO_Get_Pnt(op, "object");
/* Scene *scene = BMO_Get_Pnt(op, "scene"); */
Mesh *me = ob->data;
BMO_CallOpf(bm, "bmesh_to_mesh mesh=%p object=%p", me, ob);
void object_load_bmesh_exec(BMesh *bm, BMOperator *UNUSED(op))
{
BMO_CallOpf(bm, "bmesh_to_mesh");
}
@ -396,8 +393,8 @@ static BMVert **bmesh_to_mesh_vertex_map(BMesh *bm, int ototvert)
}
void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op) {
Mesh *me = BMO_Get_Pnt(op, "mesh");
/* Object *ob = BMO_Get_Pnt(op, "object"); */
Object *ob = bm->ob;
Mesh *me = ob->data;
MLoop *mloop;
KeyBlock *block;
MPoly *mpoly;

@ -3562,7 +3562,7 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO
EDBM_CallOpf(em, wmop, "del geom=%hvef context=%i", BM_SELECT, DEL_VERTS);
BM_Compute_Normals(bmnew);
BMO_CallOpf(bmnew, "bmesh_to_mesh mesh=%p object=%p", basenew->object->data, basenew->object);
BMO_CallOpf(bmnew, "bmesh_to_mesh");
BM_Free_Mesh(bmnew);
((Mesh*)basenew->object->data)->edit_btmesh = NULL;

@ -270,9 +270,9 @@ void EDBM_MakeEditBMesh(ToolSettings *ts, Scene *UNUSED(scene), Object *ob)
printf("yeek!! bmesh conversion issue! may lose lots of geometry!\n");
/*BMESH_TODO need to write smarter code here*/
bm = BKE_mesh_to_bmesh(me, ob);
bm = BKE_mesh_to_bmesh(ob);
} else {
bm = BKE_mesh_to_bmesh(me, ob);
bm = BKE_mesh_to_bmesh(ob);
}
me->edit_btmesh = BMEdit_Create(bm);
@ -286,7 +286,7 @@ void EDBM_LoadEditBMesh(Scene *scene, Object *ob)
Mesh *me = ob->data;
BMesh *bm = me->edit_btmesh->bm;
BMO_CallOpf(bm, "object_load_bmesh scene=%p object=%p", scene, ob);
BMO_CallOpf(bm, "object_load_bmesh scene=%p", scene);
}
void EDBM_FreeEditBMesh(BMEditMesh *tm)
@ -580,7 +580,7 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata)
BMEdit_RecalcTesselation throughout the code.*/
BMEdit_RecalcTesselation(em);
BMO_CallOpf(em->bm, "bmesh_to_mesh mesh=%p notesselation=%i", me, 1);
BMO_CallOpf(em->bm, "bmesh_to_mesh notesselation=%i", 1);
me->selectmode = em->selectmode;
return me;
@ -600,7 +600,7 @@ static void undoMesh_to_editbtMesh(void *umv, void *emv, void *UNUSED(obdata))
BMEdit_Free(em);
bm = BM_Make_Mesh(ob, allocsize);
BMO_CallOpf(bm, "mesh_to_bmesh mesh=%p object=%p set_shapekey=%i", me, ob, 0);
BMO_CallOpf(bm, "mesh_to_bmesh set_shapekey=%i", 0);
em2 = BMEdit_Create(bm);
*em = *em2;