2.5
authorTon Roosendaal <ton@blender.org>
Fri, 30 Jan 2009 19:14:50 +0000 (19:14 +0000)
committerTon Roosendaal <ton@blender.org>
Fri, 30 Jan 2009 19:14:50 +0000 (19:14 +0000)
Edit Mesh: Fkey back, add edge-face or fill 'edge net'
Make fgon will be different operator.

source/blender/editors/mesh/editmesh_add.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/mesh/mesh_ops.c

index ef648932eb45c1b6de76a3c8a8146ffcac2f5b14..9e1a047bf5487c907e3e76c4f762fe04f9a88304 100644 (file)
@@ -77,7 +77,6 @@
 /* XXX */
 static void BIF_undo_push() {}
 static void error() {}
-static int pupmenu() {return 0;}
 #define add_numbut(a, b, c, d, e, f, g) {}
 /* XXX */
 
@@ -265,7 +264,7 @@ void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot)
 /* ********************** */
 
 /* selected faces get hidden edges */
-static void make_fgon(EditMesh *em, int make)
+void make_fgon(EditMesh *em, int make)
 {
        EditFace *efa;
        EditEdge *eed;
@@ -631,7 +630,7 @@ void addfaces_from_edgenet(EditMesh *em)
 // XXX DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
 }
 
-void addedgeface_mesh(EditMesh *em)
+static void addedgeface_mesh(EditMesh *em)
 {
        EditVert *eve, *neweve[4];
        EditEdge *eed;
@@ -662,19 +661,7 @@ void addedgeface_mesh(EditMesh *em)
                return;
        }
        else if(amount > 4) {
-               
-               /* Python Menu removed XXX */
-               int ret;
-               
-               /* facemenu, will add python items */
-               char facemenu[4096]= "Make Faces%t|Auto%x1|Make FGon%x2|Clear FGon%x3";
-               
-               ret= pupmenu(facemenu);
-               
-               if(ret==1) addfaces_from_edgenet(em);
-               else if(ret==2) make_fgon(em, 1);
-               else if(ret==3) make_fgon(em, 0);
-               
+               addfaces_from_edgenet(em);
                return;
        }
        else if(amount<2) {
@@ -757,13 +744,39 @@ void addedgeface_mesh(EditMesh *em)
                fix_new_face(em, efa);
                
                recalc_editnormals(em);
-               BIF_undo_push("Add face");
        }
+       }
+
+static int addedgeface_mesh_exec(bContext *C, wmOperator *op)
+{
+       Object *obedit= CTX_data_edit_object(C);
+       EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
+       
+       addedgeface_mesh(em);
+       
+       ED_undo_push(C, "Make Edge/Face");      // Note this will become depricated 
+       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
+       
+       DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA);     
+       
+       return OPERATOR_FINISHED;
+}
+
+void MESH_OT_add_edge_face(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Make Edge/Face";
+       ot->idname= "MESH_OT_add_edge_face";
        
-// XXX DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); 
+       /* api callbacks */
+       ot->exec= addedgeface_mesh_exec;
+       ot->poll= ED_operator_editmesh;
 }
 
 
+
+/* ************************ primitives ******************* */
+
 // HACK: these can also be found in cmoview.tga.c, but are here so that they can be found by linker
 // this hack is only used so that scons+mingw + split-sources hack works
        // ------------------------------- start copied code
index 3a9faec7e93aae90683bf2b43e637f813bc55e16..d39430f7548f69f1ea10299d88feed8f80f14c63 100644 (file)
@@ -110,7 +110,6 @@ static int snap_to_center() {return 0;}
 /* local prototypes ---------------*/
 static void free_tagged_edges_faces(EditMesh *em, EditEdge *eed, EditFace *efa);
 int EdgeLoopDelete(EditMesh *em);
-void addedgeface_mesh(EditMesh *em);
 
 /********* qsort routines *********/
 
@@ -6648,30 +6647,6 @@ void MESH_OT_edge_flip(wmOperatorType *ot)
        ot->poll= ED_operator_editmesh;
 }
 
-static int addedgeface_mesh_exec(bContext *C, wmOperator *op)
-{
-       Object *obedit= CTX_data_edit_object(C);
-       EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
-       
-       addedgeface_mesh(em);
-       
-       ED_undo_push(C, "Make Edge/Face");      // Note this will become depricated 
-       WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit);
-       
-       return OPERATOR_FINISHED;
-}
-
-void MESH_OT_addedgeface_mesh(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Make Edge/Face";
-       ot->idname= "MESH_OT_addedgeface_mesh";
-       
-       /* api callbacks */
-       ot->exec= addedgeface_mesh_exec;
-       ot->poll= ED_operator_editmesh;
-}
-
 static int mesh_set_smooth_faces_exec(bContext *C, wmOperator *op)
 {
        Object *obedit= CTX_data_edit_object(C);
@@ -6735,7 +6710,6 @@ static int edit_faces_invoke(bContext *C, wmOperator *op, wmEvent *event)
        p+= sprintf(p, "|%s %%x%d", "quads to tris", 5);
        p+= sprintf(p, "|%s %%x%d", "tris to quads", 4);
        p+= sprintf(p, "|%s %%x%d", "flip triangle edges", 3);
-       p+= sprintf(p, "|%s %%x%d", "make edge/face", 2);
        p+= sprintf(p, "|%s %%x%d", "set smooth", 1);
        p+= sprintf(p, "|%s %%x%d", "set solid", 0);
        
@@ -6765,9 +6739,6 @@ static int edit_faces_exec(bContext *C, wmOperator *op)
                case 3: /* Flip triangle edges */
                        edge_flip_exec(C,op);
                        break;
-               case 2: /* Make Edge/Face */
-                       addedgeface_mesh_exec(C,op);
-                       break;
                case 1: /* Set Smooth */
                        mesh_set_smooth_faces_exec(C,op);
                        break;
index ee07600fd0a6a54645fba907b4c5efdd09d377a1..eae24b3993e5d0170f9470a98a0a988473a72251 100644 (file)
@@ -107,6 +107,7 @@ void MESH_OT_add_primitive_monkey(struct wmOperatorType *ot);
 void MESH_OT_add_primitive_uv_sphere(struct wmOperatorType *ot);
 void MESH_OT_add_primitive_ico_sphere(struct wmOperatorType *ot);
 void MESH_OT_dupli_extrude_cursor(struct wmOperatorType *ot);
+void MESH_OT_add_edge_face(struct wmOperatorType *ot);
 
 /* ******************* editmesh_lib.c */
 void EM_stats_update(EditMesh *em);
@@ -228,7 +229,6 @@ void MESH_OT_beauty_fill(struct wmOperatorType *ot);
 void MESH_OT_convert_quads_to_tris(struct wmOperatorType *ot);
 void MESH_OT_convert_tris_to_quads(struct wmOperatorType *ot);
 void MESH_OT_edge_flip(struct wmOperatorType *ot);
-void MESH_OT_addedgeface_mesh(struct wmOperatorType *ot);
 void MESH_OT_mesh_set_smooth_faces(struct wmOperatorType *ot);
 void MESH_OT_mesh_set_solid_faces(struct wmOperatorType *ot);
 
index a2a8cab8e874cebae00e3728bec054be3c6e9dd0..6990d5af751f1fc5d92216af2ceb0675c2ef09c1 100644 (file)
@@ -140,6 +140,8 @@ void ED_operatortypes_mesh(void)
        WM_operatortype_append(MESH_OT_separate);
        WM_operatortype_append(MESH_OT_dupli_extrude_cursor);
        WM_operatortype_append(MESH_OT_loop_select);
+       WM_operatortype_append(MESH_OT_add_edge_face);
+       
 }
 
 /* note mesh keymap also for other space? */
@@ -185,6 +187,7 @@ void ED_keymap_mesh(wmWindowManager *wm)
        WM_keymap_add_item(keymap, "MESH_OT_edit_faces", PKEY, KM_PRESS, KM_CTRL, 0);
        
        /* add */
+       WM_keymap_add_item(keymap, "MESH_OT_add_edge_face", FKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "MESH_OT_add_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
        WM_keymap_add_item(keymap, "OBJECT_OT_mesh_add", AKEY, KM_PRESS, KM_SHIFT, 0);
        WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, KM_SHIFT, 0);