From 96d5e05e4809f0a7526d9c8f2fc179ff8b3a777c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Feb 2014 13:51:54 +1100 Subject: [PATCH] Mesh Inset: following existing edges is now optional --- source/blender/bmesh/intern/bmesh_opdefines.c | 1 + source/blender/bmesh/operators/bmo_inset.c | 6 +++++- source/blender/editors/mesh/editmesh_inset.c | 6 ++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index b4697935da5..0c75597282e 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -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}, diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c index c79480d47dd..a255c534736 100644 --- a/source/blender/bmesh/operators/bmo_inset.c +++ b/source/blender/bmesh/operators/bmo_inset.c @@ -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); diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c index 5f23a5deb97..2ca5301c89c 100644 --- a/source/blender/editors/mesh/editmesh_inset.c +++ b/source/blender/editors/mesh/editmesh_inset.c @@ -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 */