void bmo_triangulate_exec(BMesh *bm, BMOperator *op) { const int quad_method = BMO_slot_int_get(op->slots_in, "quad_method"); const int ngon_method = BMO_slot_int_get(op->slots_in, "ngon_method"); BMOpSlot *slot_facemap_out = BMO_slot_get(op->slots_out, "face_map.out"); BM_mesh_elem_hflag_disable_all(bm, BM_FACE | BM_EDGE, BM_ELEM_TAG, false); BMO_slot_buffer_hflag_enable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, false); BM_mesh_triangulate(bm, quad_method, ngon_method, true, op, slot_facemap_out); BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "edges.out", BM_EDGE, BM_ELEM_TAG); BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "faces.out", BM_FACE, BM_ELEM_TAG); }
/* keep this operator fast, its used in a modifier */ void bmo_split_edges_exec(BMesh *bm, BMOperator *op) { const int use_verts = BMO_slot_bool_get(op->slots_in, "use_verts"); BMO_slot_buffer_hflag_enable(bm, op->slots_in, "edges", BM_EDGE, BM_ELEM_TAG, FALSE); if (use_verts) { /* this slows down the operation but its ok because the modifier doesn't use */ BMO_slot_buffer_hflag_enable(bm, op->slots_in, "verts", BM_VERT, BM_ELEM_TAG, FALSE); } /* this is where everything happens */ BM_mesh_edgesplit(bm, use_verts, TRUE); BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "edges.out", BM_EDGE, BM_ELEM_INTERNAL_TAG); }
static bool edbm_inset_calc(wmOperator *op) { InsetData *opdata; BMEditMesh *em; BMOperator bmop; 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"); const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset"); /* not passed onto the BMO */ const bool use_individual = RNA_boolean_get(op->ptr, "use_individual"); const bool use_interpolate = RNA_boolean_get(op->ptr, "use_interpolate"); opdata = op->customdata; em = opdata->em; if (opdata->is_modal) { EDBM_redo_state_restore(opdata->mesh_backup, em, false); } if (use_individual) { EDBM_op_init(em, &bmop, op, "inset_individual faces=%hf use_even_offset=%b use_relative_offset=%b " "use_interpolate=%b thickness=%f depth=%f", BM_ELEM_SELECT, use_even_offset, use_relative_offset, use_interpolate, thickness, depth); } 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_edge_rail=%b", BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, use_interpolate, thickness, depth, use_outset, use_edge_rail); if (use_outset) { BMO_slot_buffer_from_enabled_hflag(em->bm, &bmop, bmop.slots_in, "faces_exclude", BM_FACE, BM_ELEM_HIDDEN); } } BMO_op_exec(em->bm, &bmop); if (use_select_inset) { /* deselect original faces/verts */ EDBM_flag_disable_all(em, BM_ELEM_SELECT); BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true); } else { EDBM_flag_disable_all(em, BM_ELEM_SELECT); BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_in, "faces", BM_FACE, BM_ELEM_SELECT, true); } if (!EDBM_op_finish(em, &bmop, op, true)) { return false; } else { EDBM_update_generic(em, true, true); return true; } }