Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
| Show First 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | if (me && me->dvert && vc.v3d && vc.rv3d && (vc.obact->actdef != 0)) { | ||||
| const bool use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0; | const bool use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0; | ||||
| int v_idx_best = -1; | int v_idx_best = -1; | ||||
| uint index; | uint index; | ||||
| view3d_operator_needs_opengl(C); | view3d_operator_needs_opengl(C); | ||||
| ED_view3d_init_mats_rv3d(vc.obact, vc.rv3d); | ED_view3d_init_mats_rv3d(vc.obact, vc.rv3d); | ||||
| if (use_vert_sel) { | if (use_vert_sel) { | ||||
| if (ED_mesh_pick_vert(C, vc.obact, event->mval, &index, ED_MESH_PICK_DEFAULT_VERT_SIZE, true)) { | if (ED_mesh_pick_vert(C, vc.obact, event->mval, &index, ED_MESH_PICK_DEFAULT_VERT_DIST, true)) { | ||||
| v_idx_best = index; | v_idx_best = index; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| if (ED_mesh_pick_face_vert(C, vc.obact, event->mval, &index, ED_MESH_PICK_DEFAULT_FACE_SIZE)) { | if (ED_mesh_pick_face_vert(C, vc.obact, event->mval, &index, ED_MESH_PICK_DEFAULT_FACE_DIST)) { | ||||
| v_idx_best = index; | v_idx_best = index; | ||||
| } | } | ||||
| else if (ED_mesh_pick_face(C, vc.obact, event->mval, &index, ED_MESH_PICK_DEFAULT_FACE_SIZE)) { | else if (ED_mesh_pick_face(C, vc.obact, event->mval, &index, ED_MESH_PICK_DEFAULT_FACE_DIST)) { | ||||
| /* this relies on knowning the internal worksings of ED_mesh_pick_face_vert() */ | /* this relies on knowning the internal worksings of ED_mesh_pick_face_vert() */ | ||||
| BKE_report(op->reports, RPT_WARNING, "The modifier used does not support deformed locations"); | BKE_report(op->reports, RPT_WARNING, "The modifier used does not support deformed locations"); | ||||
| } | } | ||||
| } | } | ||||
| if (v_idx_best != -1) { /* should always be valid */ | if (v_idx_best != -1) { /* should always be valid */ | ||||
| ToolSettings *ts = vc.scene->toolsettings; | ToolSettings *ts = vc.scene->toolsettings; | ||||
| Brush *brush = BKE_paint_brush(&ts->wpaint->paint); | Brush *brush = BKE_paint_brush(&ts->wpaint->paint); | ||||
| ▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | if (win && win->eventstate) { | ||||
| win->eventstate->x - vc.ar->winrct.xmin, | win->eventstate->x - vc.ar->winrct.xmin, | ||||
| win->eventstate->y - vc.ar->winrct.ymin, | win->eventstate->y - vc.ar->winrct.ymin, | ||||
| }; | }; | ||||
| view3d_operator_needs_opengl(C); | view3d_operator_needs_opengl(C); | ||||
| ED_view3d_init_mats_rv3d(vc.obact, vc.rv3d); | ED_view3d_init_mats_rv3d(vc.obact, vc.rv3d); | ||||
| if (use_vert_sel) { | if (use_vert_sel) { | ||||
| if (ED_mesh_pick_vert(C, vc.obact, mval, &index, ED_MESH_PICK_DEFAULT_VERT_SIZE, true)) { | if (ED_mesh_pick_vert(C, vc.obact, mval, &index, ED_MESH_PICK_DEFAULT_VERT_DIST, true)) { | ||||
| MDeformVert *dvert = &me->dvert[index]; | MDeformVert *dvert = &me->dvert[index]; | ||||
| found |= weight_paint_sample_enum_itemf__helper(dvert, defbase_tot, groups); | found |= weight_paint_sample_enum_itemf__helper(dvert, defbase_tot, groups); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| if (ED_mesh_pick_face(C, vc.obact, mval, &index, ED_MESH_PICK_DEFAULT_FACE_SIZE)) { | if (ED_mesh_pick_face(C, vc.obact, mval, &index, ED_MESH_PICK_DEFAULT_FACE_DIST)) { | ||||
| const MPoly *mp = &me->mpoly[index]; | const MPoly *mp = &me->mpoly[index]; | ||||
| uint fidx = mp->totloop - 1; | uint fidx = mp->totloop - 1; | ||||
| do { | do { | ||||
| MDeformVert *dvert = &me->dvert[me->mloop[mp->loopstart + fidx].v]; | MDeformVert *dvert = &me->dvert[me->mloop[mp->loopstart + fidx].v]; | ||||
| found |= weight_paint_sample_enum_itemf__helper(dvert, defbase_tot, groups); | found |= weight_paint_sample_enum_itemf__helper(dvert, defbase_tot, groups); | ||||
| } while (fidx--); | } while (fidx--); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 543 Lines • Show Last 20 Lines | |||||