diff options
author | Ton Roosendaal <ton@blender.org> | 2009-01-31 12:23:17 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-01-31 12:23:17 +0300 |
commit | a60413abd177604f05e360383e3a9c2a9862529b (patch) | |
tree | 91a97029dc95dbc2046fda96bea85f74ff26c568 /source/blender/editors/mesh/editmesh_add.c | |
parent | 5ed79ee9d92599fe1f28535896fccdc2c542688b (diff) |
2.5
Edit mesh:
- fixed compile, shul only committed the function declaration, not
the code for 'make fgon'.
- Put the Fgon option under:
ALT+F: make fgon
SHIFT+ALT+F: clear fgon
(note, SHIFT+F = fill :)
- Fixed loop select to use two booleans, as Martin pointed me
correctly at! Using 1 variable was lazy coding.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_add.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_add.c | 74 |
1 files changed, 61 insertions, 13 deletions
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 9e1a047bf54..72c2e604b7f 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -264,7 +264,7 @@ void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot) /* ********************** */ /* selected faces get hidden edges */ -void make_fgon(EditMesh *em, int make) +int make_fgon(EditMesh *em, int make) { EditFace *efa; EditEdge *eed; @@ -272,7 +272,7 @@ void make_fgon(EditMesh *em, int make) float *nor=NULL; // reference int done=0; - if(!make) { + if(make==0) { for(efa= em->faces.first; efa; efa= efa->next) { if(efa->f & SELECT) { efa->fgonf= 0; @@ -280,12 +280,12 @@ void make_fgon(EditMesh *em, int make) efa->e2->h &= ~EM_FGON; efa->e3->h &= ~EM_FGON; if(efa->e4) efa->e4->h &= ~EM_FGON; + done= 1; } } EM_fgon_flags(em); // redo flags and indices for fgons -// XXX DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - BIF_undo_push("Clear FGon"); - return; + + return done; } /* tagging edges. rule is: @@ -337,13 +337,13 @@ void make_fgon(EditMesh *em, int make) } if(eve) { error("Cannot make polygon with interior vertices"); - return; + return 0; } // check for faces if(nor==NULL) { error("No faces selected to make FGon"); - return; + return 0; } // and there we go @@ -354,15 +354,61 @@ void make_fgon(EditMesh *em, int make) } } - if(done==0) { - error("Didn't find FGon to create"); - } - else { + if(done) EM_fgon_flags(em); // redo flags and indices for fgons + return done; +} + +static int make_fgon_exec(bContext *C, wmOperator *op) +{ + Object *obedit= CTX_data_edit_object(C); + EditMesh *em= ((Mesh *)obedit->data)->edit_mesh; + + if( make_fgon(em, 1) ) { + DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); + + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + + return OPERATOR_FINISHED; + } + return OPERATOR_CANCELLED; +} + +void MESH_OT_make_fgon(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Make F-gon"; + ot->idname= "MESH_OT_make_fgon"; + + /* api callbacks */ + ot->exec= make_fgon_exec; + ot->poll= ED_operator_editmesh; +} -// XXX DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - BIF_undo_push("Make FGon"); +static int clear_fgon_exec(bContext *C, wmOperator *op) +{ + Object *obedit= CTX_data_edit_object(C); + EditMesh *em= ((Mesh *)obedit->data)->edit_mesh; + + if( make_fgon(em, 0) ) { + DAG_object_flush_update(CTX_data_scene(C), obedit, OB_RECALC_DATA); + + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + + return OPERATOR_FINISHED; } + return OPERATOR_CANCELLED; +} + +void MESH_OT_clear_fgon(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Clear F-gon"; + ot->idname= "MESH_OT_clear_fgon"; + + /* api callbacks */ + ot->exec= clear_fgon_exec; + ot->poll= ED_operator_editmesh; } /* precondition; 4 vertices selected, check for 4 edges and create face */ @@ -411,6 +457,8 @@ static EditFace *addface_from_edges(EditMesh *em) return NULL; } +/* ******************************* */ + /* this also allows to prevent triangles being made in quads */ static int compareface_overlaps(EditFace *vl1, EditFace *vl2) { |