Edit Mesh: Fkey back, add edge-face or fill 'edge net'
Make fgon will be different operator.
This commit is contained in:
2009-01-30 19:14:50 +00:00
parent 30ee0806fb
commit a7b0df894e
4 changed files with 35 additions and 48 deletions

View 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,12 +744,38 @@ 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;
// XXX DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
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";
/* 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

View 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;

View 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);

View 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);