bmesh inset: outset option

This commit is contained in:
Campbell Barton 2012-03-19 21:40:17 +00:00
parent 9beef61199
commit e6834fcf85
3 changed files with 17 additions and 6 deletions

@ -1089,6 +1089,7 @@ static BMOpDefine bmo_inset_def = {
{BMO_OP_SLOT_BOOL, "use_even_offset"}, {BMO_OP_SLOT_BOOL, "use_even_offset"},
{BMO_OP_SLOT_BOOL, "use_relative_offset"}, {BMO_OP_SLOT_BOOL, "use_relative_offset"},
{BMO_OP_SLOT_FLT, "thickness"}, {BMO_OP_SLOT_FLT, "thickness"},
{BMO_OP_SLOT_BOOL, "use_outset"},
{0} /* null-terminating sentine */}, {0} /* null-terminating sentine */},
bmo_inset_exec, bmo_inset_exec,
0 0

@ -60,7 +60,8 @@ static void edge_loop_tangent(BMEdge *e, BMLoop *e_loop, float r_no[3])
void bmo_inset_exec(BMesh *bm, BMOperator *op) void bmo_inset_exec(BMesh *bm, BMOperator *op)
{ {
const int use_boundary = BMO_slot_bool_get(op, "use_boundary"); const int use_outset = BMO_slot_bool_get(op, "use_outset");
const int use_boundary = BMO_slot_bool_get(op, "use_boundary") && (use_outset == FALSE);
const int use_even_offset = BMO_slot_bool_get(op, "use_even_offset"); const int use_even_offset = BMO_slot_bool_get(op, "use_even_offset");
const int use_even_boundry = use_even_offset; /* could make own option */ const int use_even_boundry = use_even_offset; /* could make own option */
const int use_relative_offset = BMO_slot_bool_get(op, "use_relative_offset"); const int use_relative_offset = BMO_slot_bool_get(op, "use_relative_offset");
@ -77,8 +78,14 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
BMFace *f; BMFace *f;
int i, j, k; int i, j, k;
BM_mesh_elem_flag_disable_all(bm, BM_FACE, BM_ELEM_TAG); if (use_outset == FALSE) {
BMO_slot_buffer_hflag_enable(bm, op, "faces", BM_FACE, BM_ELEM_TAG, FALSE); BM_mesh_elem_flag_disable_all(bm, BM_FACE, BM_ELEM_TAG);
BMO_slot_buffer_hflag_enable(bm, op, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
}
else {
BM_mesh_elem_flag_enable_all(bm, BM_FACE, BM_ELEM_TAG);
BMO_slot_buffer_hflag_disable(bm, op, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
}
/* first count all inset edges we will split */ /* first count all inset edges we will split */
/* fill in array and initialize tagging */ /* fill in array and initialize tagging */

@ -4581,11 +4581,12 @@ static int mesh_inset_exec(bContext *C, wmOperator *op)
const int use_boundary = RNA_boolean_get(op->ptr, "use_boundary"); const int use_boundary = RNA_boolean_get(op->ptr, "use_boundary");
const int use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset"); const int use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset");
const int use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset"); const int use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset");
const float thickness = RNA_float_get(op->ptr, "thickness"); const float thickness = RNA_float_get(op->ptr, "thickness");
const int use_outset = RNA_boolean_get(op->ptr, "use_outset");
EDBM_InitOpf(em, &bmop, op, EDBM_InitOpf(em, &bmop, op,
"inset faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b thickness=%f", "inset faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b thickness=%f use_outset=%b",
BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, thickness); BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, thickness, use_outset);
BMO_op_exec(em->bm, &bmop); BMO_op_exec(em->bm, &bmop);
@ -4629,4 +4630,6 @@ void MESH_OT_inset(wmOperatorType *ot)
prop = RNA_def_float(ot->srna, "thickness", 0.01f, 0.0f, FLT_MAX, "thickness", "", 0.0f, 10.0f); prop = RNA_def_float(ot->srna, "thickness", 0.01f, 0.0f, FLT_MAX, "thickness", "", 0.0f, 10.0f);
/* use 1 rather then 10 for max else dragging the button moves too far */ /* use 1 rather then 10 for max else dragging the button moves too far */
RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4); RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4);
RNA_def_boolean(ot->srna, "use_outset", FALSE, "Outset", "outset rather then inset");
} }