forked from bartvdbraak/blender
add beauty option for triangle fill since you might want to use the initial scanfill result.
This commit is contained in:
parent
fd145b4df1
commit
555bcc3298
@ -1455,7 +1455,8 @@ static BMOpDefine bmo_beautify_fill_def = {
|
||||
static BMOpDefine bmo_triangle_fill_def = {
|
||||
"triangle_fill",
|
||||
/* slots_in */
|
||||
{{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
|
||||
{{"use_beauty", BMO_OP_SLOT_BOOL},
|
||||
{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */
|
||||
{{'\0'}},
|
||||
},
|
||||
/* slots_out */
|
||||
|
@ -149,9 +149,9 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
|
||||
|
||||
void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
|
||||
{
|
||||
const bool use_beauty = BMO_slot_bool_get(op->slots_in, "use_beauty");
|
||||
BMOIter siter;
|
||||
BMEdge *e;
|
||||
BMOperator bmop;
|
||||
ScanFillContext sf_ctx;
|
||||
/* ScanFillEdge *sf_edge; */ /* UNUSED */
|
||||
ScanFillVert *sf_vert, *sf_vert_1, *sf_vert_2;
|
||||
@ -203,11 +203,14 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
|
||||
BLI_scanfill_end(&sf_ctx);
|
||||
BLI_smallhash_release(&hash);
|
||||
|
||||
/* clean up fill */
|
||||
if (use_beauty) {
|
||||
BMOperator bmop;
|
||||
|
||||
BMO_op_initf(bm, &bmop, op->flag, "beautify_fill faces=%ff edges=%Fe", ELE_NEW, EDGE_MARK);
|
||||
BMO_op_exec(bm, &bmop);
|
||||
BMO_slot_buffer_flag_enable(bm, bmop.slots_out, "geom.out", BM_FACE | BM_EDGE, ELE_NEW);
|
||||
BMO_op_finish(bm, &bmop);
|
||||
}
|
||||
|
||||
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_EDGE | BM_FACE, ELE_NEW);
|
||||
}
|
||||
|
@ -3314,9 +3314,12 @@ static int edbm_fill_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
BMEditMesh *em = BMEdit_FromObject(obedit);
|
||||
int use_beauty = RNA_boolean_get(op->ptr, "use_beauty");
|
||||
BMOperator bmop;
|
||||
|
||||
if (!EDBM_op_init(em, &bmop, op, "triangle_fill edges=%he", BM_ELEM_SELECT)) {
|
||||
if (!EDBM_op_init(em, &bmop, op,
|
||||
"triangle_fill edges=%he use_beauty=%b",
|
||||
BM_ELEM_SELECT, use_beauty)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
@ -3348,6 +3351,8 @@ void MESH_OT_fill(wmOperatorType *ot)
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
RNA_def_boolean(ot->srna, "use_beauty", true, "Beauty", "Use best triangulation division");
|
||||
}
|
||||
|
||||
static int edbm_beautify_fill_exec(bContext *C, wmOperator *op)
|
||||
@ -3420,7 +3425,7 @@ 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 (currently quads only)");
|
||||
RNA_def_boolean(ot->srna, "use_beauty", 1, "Beauty", "Use best triangulation division");
|
||||
}
|
||||
|
||||
static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op)
|
||||
|
Loading…
Reference in New Issue
Block a user