diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2013-10-29 06:42:51 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2013-10-29 06:42:51 +0400 |
commit | a7b44c82e5b90e83a588fabb22fda5ac41891bdf (patch) | |
tree | 2fdc4134bdc21e47d05fe69176bc5c85a4c448cd /source/blender/editors/mesh | |
parent | 427844c28d2083ffcec93066ebee3fcf0fd01e42 (diff) |
Triangulate Modifier: using different ngon and quad methods
Quads: Beauty, Fixed, Fixed Alternate, Shortest Diagonal
Ngons: Beauty, Scanfill
* Shortest Diagonal is the default method in the modifier (popular
elsewhere), but beauty is the default in Ctrl+T).
* Remove the need for output slot and beauty operator to be called
after Clt+T
Patch with collaborations and reviewed by Campbell Barton
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 18 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_ops.c | 7 |
2 files changed, 10 insertions, 15 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index e557b07dba2..b35ed10b157 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -3204,21 +3204,12 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op) Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); BMOperator bmop; - const bool use_beauty = RNA_boolean_get(op->ptr, "use_beauty"); + const int quad_method = RNA_enum_get(op->ptr, "quad_method"); + const int ngon_method = RNA_enum_get(op->ptr, "ngon_method"); - EDBM_op_init(em, &bmop, op, "triangulate faces=%hf use_beauty=%b", BM_ELEM_SELECT, use_beauty); + EDBM_op_init(em, &bmop, op, "triangulate faces=%hf quad_method=%i ngon_method=%i", BM_ELEM_SELECT, quad_method, ngon_method); BMO_op_exec(em->bm, &bmop); - BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true); - - /* now call beauty fill */ - if (use_beauty) { - EDBM_op_call_and_selectf( - em, op, "geom.out", true, - "beautify_fill faces=%S edges=%S", - &bmop, "faces.out", &bmop, "edges.out"); - } - if (!EDBM_op_finish(em, &bmop, op, true)) { return OPERATOR_CANCELLED; } @@ -3243,7 +3234,8 @@ void MESH_OT_quads_convert_to_tris(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - RNA_def_boolean(ot->srna, "use_beauty", 1, "Beauty", "Use best triangulation division"); + RNA_def_enum(ot->srna, "quad_method", modifier_triangulate_quad_method_items, MOD_TRIANGULATE_QUAD_BEAUTY, "Quad Method", "Method for splitting the quads into triangles"); + RNA_def_enum(ot->srna, "ngon_method", modifier_triangulate_ngon_method_items, MOD_TRIANGULATE_NGON_BEAUTY, "Ngon Method", "Method for splitting the ngons into triangles"); } static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 86f69ab8538..3c42beb8b12 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -29,6 +29,7 @@ */ #include "DNA_scene_types.h" +#include "DNA_modifier_types.h" #include "BLI_math.h" @@ -359,9 +360,11 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "MESH_OT_beautify_fill", FKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0); kmi = WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL, 0); - RNA_boolean_set(kmi->ptr, "use_beauty", true); + RNA_enum_set(kmi->ptr, "quad_method", MOD_TRIANGULATE_QUAD_BEAUTY); + RNA_enum_set(kmi->ptr, "ngon_method", MOD_TRIANGULATE_NGON_BEAUTY); kmi = WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); - RNA_boolean_set(kmi->ptr, "use_beauty", false); + RNA_enum_set(kmi->ptr, "quad_method", MOD_TRIANGULATE_QUAD_FIXED); + RNA_enum_set(kmi->ptr, "ngon_method", MOD_TRIANGULATE_NGON_SCANFILL); WM_keymap_add_item(keymap, "MESH_OT_tris_convert_to_quads", JKEY, KM_PRESS, KM_ALT, 0); |