diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index a1ba76c3c08..475ffd23617 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -932,7 +932,6 @@ static void sk_projectDrawPoint(bContext *C, float vec[3], SK_Stroke *stk, SK_Dr zfac = ED_view3d_calc_zfac(ar->regiondata, fp, NULL); - /* method taken from editview.c - mouse_cursor() */ if (ED_view3d_project_short_global(ar, fp, cval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) { VECSUB2D(mval_f, cval, dd->mval); ED_view3d_win_to_delta(ar, mval_f, dvec, zfac); diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 092951be3da..4c4926f5ae7 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -472,9 +472,6 @@ static void gp_strokepoint_convertcoords(bContext *C, bGPDstroke *gps, bGPDspoin } } - /* convert screen coordinate to 3d coordinates - * - method taken from editview.c - mouse_cursor() - */ ED_view3d_win_to_3d(ar, fp, mvalf, p3d); } } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 65f205c2f2f..6bbaca73eb5 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -275,9 +275,9 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3] */ } else { - int mval_prj[2]; + float mval_prj[2]; float rvec[3], dvec[3]; - float mval_f[2]; + float mval_f[2] = {UNPACK2(mval)}; float zfac; /* Current method just converts each point in screen-coordinates to @@ -291,11 +291,9 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3] gp_get_3d_reference(p, rvec); zfac = ED_view3d_calc_zfac(p->ar->regiondata, rvec, NULL); - - /* method taken from editview.c - mouse_cursor() */ - /* TODO, use ED_view3d_project_float_global */ - if (ED_view3d_project_int_global(p->ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) { - VECSUB2D(mval_f, mval_prj, mval); + + if (ED_view3d_project_float_global(p->ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) { + sub_v2_v2v2(mval_f, mval_prj, mval_f); ED_view3d_win_to_delta(p->ar, mval_f, dvec, zfac); sub_v3_v3v3(out, rvec, dvec); }