Revision: 21654
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21654
Author:   joeedh
Date:     2009-07-17 08:05:09 +0200 (Fri, 17 Jul 2009)

Log Message:
-----------
some small edge split related things.  now you can split edges (with no 
additional geometry created) with mkey.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_opdefines.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators_private.h
    branches/bmesh/blender/source/blender/bmesh/operators/subdivideop.c
    branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c
    branches/bmesh/blender/source/blender/editors/mesh/mesh_intern.h
    branches/bmesh/blender/source/blender/editors/mesh/mesh_ops.c

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_opdefines.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_opdefines.c        
2009-07-17 05:09:33 UTC (rev 21653)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_opdefines.c        
2009-07-17 06:05:09 UTC (rev 21654)
@@ -6,6 +6,17 @@
   through the code and find all references to them!*/
 
 
+BMOpDefine def_edgesplit = {
+       "edgesplit",
+       {{BMOP_OPSLOT_ELEMENT_BUF, "edges"},
+       {BMOP_OPSLOT_INT, "numcuts"},
+       {BMOP_OPSLOT_ELEMENT_BUF, "outsplit"},
+       {0} /*null-terminating sentinel*/,
+       },
+       esplit_exec,
+       0
+};
+
 BMOpDefine def_mirror = {
        "mirror",
        /*maps welded vertices to verts they should weld to.*/
@@ -336,6 +347,7 @@
        &def_removedoubles,
        &def_finddoubles,
        &def_mirror,
+       &def_edgesplit,
 };
 
 int bmesh_total_ops = (sizeof(opdefines) / sizeof(void*));

Modified: 
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators_private.h
===================================================================
--- 
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators_private.h    
    2009-07-17 05:09:33 UTC (rev 21653)
+++ 
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators_private.h    
    2009-07-17 06:05:09 UTC (rev 21654)
@@ -35,5 +35,6 @@
 void bmesh_removedoubles_exec(BMesh *bm, BMOperator *op);
 void bmesh_finddoubles_exec(BMesh *bm, BMOperator *op);
 void bmesh_mirror_exec(BMesh *bm, BMOperator *op);
+void esplit_exec(BMesh *bm, BMOperator *op);
 
 #endif

Modified: branches/bmesh/blender/source/blender/bmesh/operators/subdivideop.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/subdivideop.c 
2009-07-17 05:09:33 UTC (rev 21653)
+++ branches/bmesh/blender/source/blender/bmesh/operators/subdivideop.c 
2009-07-17 06:05:09 UTC (rev 21654)
@@ -593,12 +593,12 @@
 };
 
 subdpattern *patterns[] = {
-       &q_1edge,
+       //&q_1edge,
        &q_2edge_op,
        &q_4edge,
        &q_3edge,
        &q_2edge,
-       &t_1edge,
+       //&t_1edge,
        &t_2edge,
        &t_3edge,
 };
@@ -822,4 +822,23 @@
        MEM_freeN(em2);
        BM_Free_Mesh(bm);
 }
-#endif
\ No newline at end of file
+#endif
+
+void esplit_exec(BMesh *bm, BMOperator *op)
+{
+       BMOIter siter;
+       BMEdge *e;
+       subdparams params;
+
+       params.numcuts = BMO_GetSlot(op, "numcuts")->data.i;
+       params.op = op;
+       
+       /*go through and split edges*/
+       BMO_ITER(e, &siter, bm, op, "edges", BM_EDGE) {
+               bm_subdivide_multicut(bm, e, &params, e->v1, e->v2);
+       }
+
+       BMO_Flag_To_Slot(bm, op, "outsplit",
+                        ELE_SPLIT, BM_ALL);
+}
+

Modified: branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c    
2009-07-17 05:09:33 UTC (rev 21653)
+++ branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c    
2009-07-17 06:05:09 UTC (rev 21654)
@@ -1355,3 +1355,40 @@
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
+
+static int editbmesh_edge_split(bContext *C, wmOperator *op)
+{
+       Scene *scene = CTX_data_scene(C);
+       Object *obedit= CTX_data_edit_object(C);
+       Mesh *me= ((Mesh *)obedit->data);
+       BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
+       BMesh *bm = em->bm;
+       BMOperator bmop;
+       int len = 0;
+       
+       BMO_InitOpf(bm, &bmop, "edgesplit edges=%he numcuts=%d", BM_SELECT, 
RNA_int_get(op->ptr,"number_cuts"));
+       BMO_Exec_Op(bm, &bmop);
+       len = BMO_GetSlot(&bmop, "outsplit")->len;
+       BMO_Finish_Op(bm, &bmop);
+       
+       DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+
+       return len ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+}
+
+void MESH_OT_edge_split(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Edge Split";
+       ot->idname= "MESH_OT_edge_split";
+       
+       /* api callbacks */
+       ot->exec= editbmesh_edge_split;
+       ot->poll= ED_operator_editmesh;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+       RNA_def_int(ot->srna, "number_cuts", 1, 1, 10, "Number of Cuts", "", 1, 
INT_MAX);
+}

Modified: branches/bmesh/blender/source/blender/editors/mesh/mesh_intern.h
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/mesh_intern.h    
2009-07-17 05:09:33 UTC (rev 21653)
+++ branches/bmesh/blender/source/blender/editors/mesh/mesh_intern.h    
2009-07-17 06:05:09 UTC (rev 21654)
@@ -295,6 +295,7 @@
 
 /* ************* bmesh_tools.c ***********/
 void MESH_OT_vert_connect(struct wmOperatorType *ot);
+void MESH_OT_edge_split(struct wmOperatorType *ot);
 
 #endif // MESH_INTERN_H
 

Modified: branches/bmesh/blender/source/blender/editors/mesh/mesh_ops.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/mesh_ops.c       
2009-07-17 05:09:33 UTC (rev 21653)
+++ branches/bmesh/blender/source/blender/editors/mesh/mesh_ops.c       
2009-07-17 06:05:09 UTC (rev 21654)
@@ -315,6 +315,7 @@
        WM_operatortype_append(MESH_OT_specials);
 
        WM_operatortype_append(MESH_OT_vert_connect);
+       WM_operatortype_append(MESH_OT_edge_split);
 }
 
 /* note mesh keymap also for other space? */
@@ -350,8 +351,9 @@
        RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_edges_select_sharp", 
SKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0);
        
        WM_keymap_add_item(keymap, "MESH_OT_vertices_transform_to_sphere", 
SKEY, KM_PRESS, KM_CTRL|KM_SHIFT , 0);
+       WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, 
KM_SHIFT, 0);
 
-       WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, 
KM_SHIFT, 0);
+       WM_keymap_add_item(keymap, "MESH_OT_edge_split", MKEY, KM_PRESS, 0, 0);
        
        /* selection mode */
        WM_keymap_add_item(keymap, "MESH_OT_selection_type", TABKEY, KM_PRESS, 
KM_CTRL, 0);


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to