diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-25 22:43:05 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-25 22:43:05 +0400 |
commit | 4bc32d5ded4362cd5cef36456946428bf099148d (patch) | |
tree | 7aee88699dbf963c94e3a237ef21c0977c4011b0 /source/blender/editors/mesh | |
parent | 66d9c0def922db300cda6d1987f2e0c0d5abd782 (diff) |
mesh tool to fill in holes, added in mesh clean menu,
unlike other face creation tools it copies data from surrounding faces.
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 36 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_ops.c | 1 |
3 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 1586138a4d3..538ed862e4e 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2752,7 +2752,43 @@ void MESH_OT_fill_grid(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } +static int edbm_fill_holes_exec(bContext *C, wmOperator *op) +{ + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BKE_editmesh_from_object(obedit); + const int sides = RNA_int_get(op->ptr, "sides"); + + if (!EDBM_op_call_and_selectf( + em, op, + "faces.out", true, + "holes_fill edges=%he sides=%i", + BM_ELEM_SELECT, sides)) + { + return OPERATOR_CANCELLED; + } + + EDBM_update_generic(em, true, true); + + return OPERATOR_FINISHED; +} + +void MESH_OT_fill_holes(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Fill Holes"; + ot->idname = "MESH_OT_fill_holes"; + ot->description = "Fill in holes (boundary edge loops)"; + + /* api callbacks */ + ot->exec = edbm_fill_holes_exec; + ot->poll = ED_operator_editmesh; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + RNA_def_int(ot->srna, "sides", 4, 0, INT_MAX, "Sides", "Number of sides (zero disables)", 0, 100); +} static int edbm_beautify_fill_exec(bContext *C, wmOperator *op) { diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 66079e37b91..c76b9819f75 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -196,6 +196,7 @@ void MESH_OT_knife_cut(struct wmOperatorType *ot); void MESH_OT_separate(struct wmOperatorType *ot); void MESH_OT_fill(struct wmOperatorType *ot); void MESH_OT_fill_grid(struct wmOperatorType *ot); +void MESH_OT_fill_holes(struct wmOperatorType *ot); void MESH_OT_beautify_fill(struct wmOperatorType *ot); void MESH_OT_quads_convert_to_tris(struct wmOperatorType *ot); void MESH_OT_tris_convert_to_quads(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 4f2924293ea..74aaa58d32d 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -102,6 +102,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_fill); WM_operatortype_append(MESH_OT_fill_grid); + WM_operatortype_append(MESH_OT_fill_holes); WM_operatortype_append(MESH_OT_beautify_fill); WM_operatortype_append(MESH_OT_quads_convert_to_tris); WM_operatortype_append(MESH_OT_tris_convert_to_quads); |