Mesh Inset: following existing edges is now optional

This commit is contained in:
Campbell Barton 2014-02-15 13:51:54 +11:00
parent 8572ae89cd
commit 96d5e05e48
3 changed files with 10 additions and 3 deletions

@ -1673,6 +1673,7 @@ static BMOpDefine bmo_inset_region_def = {
{"use_even_offset", BMO_OP_SLOT_BOOL},
{"use_interpolate", BMO_OP_SLOT_BOOL},
{"use_relative_offset", BMO_OP_SLOT_BOOL},
{"use_edge_rail", BMO_OP_SLOT_BOOL},
{"thickness", BMO_OP_SLOT_FLT},
{"depth", BMO_OP_SLOT_FLT},
{"use_outset", BMO_OP_SLOT_BOOL},

@ -390,6 +390,7 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
const bool use_even_offset = BMO_slot_bool_get(op->slots_in, "use_even_offset");
const bool use_even_boundry = use_even_offset; /* could make own option */
const bool use_relative_offset = BMO_slot_bool_get(op->slots_in, "use_relative_offset");
const bool use_edge_rail = BMO_slot_bool_get(op->slots_in, "use_edge_rail");
const bool use_interpolate = BMO_slot_bool_get(op->slots_in, "use_interpolate");
const float thickness = BMO_slot_float_get(op->slots_in, "thickness");
const float depth = BMO_slot_float_get(op->slots_in, "depth");
@ -616,7 +617,10 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
* cross product between both face normals */
add_v3_v3v3(tvec, e_info_a->no, e_info_b->no);
if (f_a != f_b) {
if (use_edge_rail == false) {
/* pass */
}
else if (f_a != f_b) {
/* these lookups are very quick */
BMLoop *l_other_a = BM_loop_other_vert_loop(e_info_a->l, v_split);
BMLoop *l_other_b = BM_loop_other_vert_loop(e_info_b->l, v_split);

@ -196,6 +196,7 @@ static bool edbm_inset_calc(wmOperator *op)
const bool use_boundary = RNA_boolean_get(op->ptr, "use_boundary");
const bool use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset");
const bool use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset");
const bool use_edge_rail = RNA_boolean_get(op->ptr, "use_edge_rail");
const float thickness = RNA_float_get(op->ptr, "thickness");
const float depth = RNA_float_get(op->ptr, "depth");
const bool use_outset = RNA_boolean_get(op->ptr, "use_outset");
@ -220,9 +221,9 @@ static bool edbm_inset_calc(wmOperator *op)
else {
EDBM_op_init(em, &bmop, op,
"inset_region faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b"
" use_interpolate=%b thickness=%f depth=%f use_outset=%b",
" use_interpolate=%b thickness=%f depth=%f use_outset=%b use_edge_rail=%b",
BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, use_interpolate,
thickness, depth, use_outset);
thickness, depth, use_outset, use_edge_rail);
}
BMO_op_exec(em->bm, &bmop);
@ -502,6 +503,7 @@ void MESH_OT_inset(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "use_boundary", true, "Boundary", "Inset face boundaries");
RNA_def_boolean(ot->srna, "use_even_offset", true, "Offset Even", "Scale the offset to give more even thickness");
RNA_def_boolean(ot->srna, "use_relative_offset", false, "Offset Relative", "Scale the offset by surrounding geometry");
RNA_def_boolean(ot->srna, "use_edge_rail", true, "Edge Rail", "Inset the region along existing edges");
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 */