diff options
Diffstat (limited to 'source/blender/editors/mesh/editmesh_inset.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_inset.c | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c index f7cf32a074f..a9093824a9d 100644 --- a/source/blender/editors/mesh/editmesh_inset.c +++ b/source/blender/editors/mesh/editmesh_inset.c @@ -80,7 +80,7 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C) InsetData *opdata = op->customdata; const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RClick), Thickness: %s, " - "Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s)"); + "Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s), Individual (I): (%s)"); char msg[HEADER_LENGTH]; ScrArea *sa = CTX_wm_area(C); @@ -98,7 +98,8 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C) flts_str + NUM_STR_REP_LEN, opdata->modify_depth ? IFACE_("On") : IFACE_("Off"), RNA_boolean_get(op->ptr, "use_outset") ? IFACE_("On") : IFACE_("Off"), - RNA_boolean_get(op->ptr, "use_boundary") ? IFACE_("On") : IFACE_("Off") + RNA_boolean_get(op->ptr, "use_boundary") ? IFACE_("On") : IFACE_("Off"), + RNA_boolean_get(op->ptr, "individual") ? IFACE_("On") : IFACE_("Off") ); ED_area_headerprint(sa, msg); @@ -191,6 +192,7 @@ static int edbm_inset_calc(wmOperator *op) const float depth = RNA_float_get(op->ptr, "depth"); const bool use_outset = RNA_boolean_get(op->ptr, "use_outset"); const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset"); /* not passed onto the BMO */ + const bool individual = RNA_boolean_get(op->ptr, "individual"); opdata = op->customdata; em = opdata->em; @@ -199,12 +201,18 @@ static int edbm_inset_calc(wmOperator *op) EDBM_redo_state_restore(opdata->mesh_backup, em, false); } - EDBM_op_init(em, &bmop, op, - "inset faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b " - "thickness=%f depth=%f use_outset=%b", - BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, - thickness, depth, use_outset); - + if (individual) { + EDBM_op_init(em, &bmop, op, + "inset_individual faces=%hf thickness=%f depth=%f use_even_offset=%b", + BM_ELEM_SELECT, thickness, depth, use_even_offset); + } + else { + EDBM_op_init(em, &bmop, op, + "inset_region faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b " + "thickness=%f depth=%f use_outset=%b", + BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, + thickness, depth, use_outset); + } BMO_op_exec(em->bm, &bmop); if (use_select_inset) { @@ -410,6 +418,20 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event) } } break; + case IKEY: + if (event->val == KM_PRESS) { + int individual = RNA_boolean_get(op->ptr, "individual"); + RNA_boolean_set(op->ptr, "individual", !individual); + if (edbm_inset_calc(op)) { + edbm_inset_update_header(op, C); + } + else { + edbm_inset_cancel(C, op); + return OPERATOR_CANCELLED; + } + } + break; + } return OPERATOR_RUNNING_MODAL; @@ -448,4 +470,5 @@ void MESH_OT_inset(wmOperatorType *ot) RNA_def_boolean(ot->srna, "use_outset", false, "Outset", "Outset rather than inset"); RNA_def_boolean(ot->srna, "use_select_inset", true, "Select Outer", "Select the new inset faces"); + RNA_def_boolean(ot->srna, "individual", false, "Individual", "Individual Face Inset"); } |