#include "ED_mesh.h"
#include "ED_screen.h"
#include "ED_view3d.h"
+#include "bmesh.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+static int bmesh_test_exec(bContext *C, wmOperator *op)
+{
+ Object *obedit= CTX_data_edit_object(C);
+ EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
+ EditMesh *em2;
+ BMesh *bm;
+
+ bm = editmesh_to_bmesh(em);
+
+#if 1 /*edge subdivide test*/
+ //BM_esubdivideflag(obedit, bm, SELECT, 0.292f*5.0, B_SMOOTH, G.rt==0?1:G.rt, 0);
+ BM_esubdivideflag(obedit, bm, SELECT, 0, 0, G.rt==0?1:G.rt, SUBDIV_SELECT_INNER);
+
+#endif
+
+#if 0
+ /*dissolve vert test*/
+ {
+ BMOperator op;
+ BMOpSlot *eoutput, *foutput;
+ int i;
+
+ BMO_Init_Op(&op, BMOP_DISSOLVE_VERTS);
+ BMO_HeaderFlag_To_Slot(bm, &op, BMOP_DISVERTS_VERTIN, BM_SELECT, BM_VERT);
+ BMO_Exec_Op(bm, &op);
+
+ BMO_Finish_Op(bm, &op);
+ }
+#endif
+
+#if 0
+ /*triangulator test code*/
+ {
+ BMOperator op;
+ BMOpSlot *eoutput, *foutput;
+ int i;
+
+ BMO_Init_Op(&op, BMOP_TRIANGULATE);
+ BMO_HeaderFlag_To_Slot(bm, &op, BMOP_TRIANG_FACEIN, BM_SELECT, BM_FACE);
+ BMO_Exec_Op(bm, &op);
+
+ eoutput = BMO_GetSlot(&op, BMOP_TRIANG_NEW_EDGES);
+ foutput = BMO_GetSlot(&op, BMOP_TRIANG_NEW_FACES);
+
+ /*select new faces/edges*/
+ for (i=0; i<eoutput->len; i++) {
+ BM_Select(bm, ((void**)eoutput->data.buf)[i], 1);
+ }
+
+ for (i=0; i<foutput->len; i++) {
+ BM_Select(bm, ((void**)foutput->data.buf)[i], 1);
+ }
+
+ BMO_Finish_Op(bm, &op);
+
+ }
+#endif
+ em2 = bmesh_to_editmesh(bm);
+
+ /*free em's data, then copy the contents of the em2 struct
+ to em, then free the em2 struct.*/
+ free_editMesh(em);
+ *em = *em2;
+ MEM_freeN(em2);
+
+ BM_Free_Mesh(bm);
+
+ WM_event_add_notifier(C, NC_OBJECT|ND_DRAW|ND_TRANSFORM|ND_GEOM_SELECT, obedit);
+ return OPERATOR_FINISHED;
+}
+
+void MESH_OT_bmesh_test(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "bmesh test op";
+ ot->idname= "MESH_OT_bmesh_test";
+
+ /* api callbacks */
+ ot->exec= bmesh_test_exec;
+ ot->poll= ED_operator_editmesh;
+
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
/* ******************** **************** */
void EM_select_more(EditMesh *em)