Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/mesh/editmesh_knife.c
| Show First 20 Lines • Show All 2,746 Lines • ▼ Show 20 Lines | if (only_select) { | ||||
| Object *obedit = CTX_data_edit_object(C); | Object *obedit = CTX_data_edit_object(C); | ||||
| BMEditMesh *em = BKE_editmesh_from_object(obedit); | BMEditMesh *em = BKE_editmesh_from_object(obedit); | ||||
| if (em->bm->totfacesel == 0) { | if (em->bm->totfacesel == 0) { | ||||
| BKE_report(op->reports, RPT_ERROR, "Selected faces required"); | BKE_report(op->reports, RPT_ERROR, "Selected faces required"); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| } | } | ||||
| view3d_operator_needs_opengl(C); | |||||
| /* alloc new customdata */ | /* alloc new customdata */ | ||||
| kcd = op->customdata = MEM_callocN(sizeof(KnifeTool_OpData), __func__); | kcd = op->customdata = MEM_callocN(sizeof(KnifeTool_OpData), __func__); | ||||
| knifetool_init(C, kcd, only_select, cut_through, true); | knifetool_init(C, kcd, only_select, cut_through, true); | ||||
| op->flag |= OP_IS_MODAL_CURSOR_REGION; | op->flag |= OP_IS_MODAL_CURSOR_REGION; | ||||
| /* add a modal handler for this operator - handles loop selection */ | /* add a modal handler for this operator - handles loop selection */ | ||||
| ▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | if (!obedit || obedit->type != OB_MESH || BKE_editmesh_from_object(obedit) != kcd->em) { | ||||
| knifetool_exit(C, op); | knifetool_exit(C, op); | ||||
| ED_workspace_status_text(C, NULL); | ED_workspace_status_text(C, NULL); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| em_setup_viewcontext(C, &kcd->vc); | em_setup_viewcontext(C, &kcd->vc); | ||||
| kcd->region = kcd->vc.region; | kcd->region = kcd->vc.region; | ||||
| view3d_operator_needs_opengl(C); | |||||
| ED_view3d_init_mats_rv3d(obedit, kcd->vc.rv3d); /* needed to initialize clipping */ | ED_view3d_init_mats_rv3d(obedit, kcd->vc.rv3d); /* needed to initialize clipping */ | ||||
| if (kcd->mode == MODE_PANNING) { | if (kcd->mode == MODE_PANNING) { | ||||
| kcd->mode = kcd->prevmode; | kcd->mode = kcd->prevmode; | ||||
| } | } | ||||
| /* handle modal keymap */ | /* handle modal keymap */ | ||||
| if (event->type == EVT_MODAL_MAP) { | if (event->type == EVT_MODAL_MAP) { | ||||
| ▲ Show 20 Lines • Show All 219 Lines • ▼ Show 20 Lines | |||||
| /** | /** | ||||
| * \param use_tag: When set, tag all faces inside the polylines. | * \param use_tag: When set, tag all faces inside the polylines. | ||||
| */ | */ | ||||
| void EDBM_mesh_knife(bContext *C, LinkNode *polys, bool use_tag, bool cut_through) | void EDBM_mesh_knife(bContext *C, LinkNode *polys, bool use_tag, bool cut_through) | ||||
| { | { | ||||
| KnifeTool_OpData *kcd; | KnifeTool_OpData *kcd; | ||||
| view3d_operator_needs_opengl(C); | |||||
| /* init */ | /* init */ | ||||
| { | { | ||||
| const bool only_select = false; | const bool only_select = false; | ||||
| const bool is_interactive = false; /* can enable for testing */ | const bool is_interactive = false; /* can enable for testing */ | ||||
| kcd = MEM_callocN(sizeof(KnifeTool_OpData), __func__); | kcd = MEM_callocN(sizeof(KnifeTool_OpData), __func__); | ||||
| knifetool_init(C, kcd, only_select, cut_through, is_interactive); | knifetool_init(C, kcd, only_select, cut_through, is_interactive); | ||||
| ▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines | |||||