forked from bartvdbraak/blender
Code cleanup: project gpencil in float coords & delete outdated comments
This commit is contained in:
parent
2527d0ce8f
commit
e51841cbca
@ -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);
|
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) {
|
if (ED_view3d_project_short_global(ar, fp, cval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
|
||||||
VECSUB2D(mval_f, cval, dd->mval);
|
VECSUB2D(mval_f, cval, dd->mval);
|
||||||
ED_view3d_win_to_delta(ar, mval_f, dvec, zfac);
|
ED_view3d_win_to_delta(ar, mval_f, dvec, zfac);
|
||||||
|
@ -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);
|
ED_view3d_win_to_3d(ar, fp, mvalf, p3d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -275,9 +275,9 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3]
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int mval_prj[2];
|
float mval_prj[2];
|
||||||
float rvec[3], dvec[3];
|
float rvec[3], dvec[3];
|
||||||
float mval_f[2];
|
float mval_f[2] = {UNPACK2(mval)};
|
||||||
float zfac;
|
float zfac;
|
||||||
|
|
||||||
/* Current method just converts each point in screen-coordinates to
|
/* Current method just converts each point in screen-coordinates to
|
||||||
@ -292,10 +292,8 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3]
|
|||||||
gp_get_3d_reference(p, rvec);
|
gp_get_3d_reference(p, rvec);
|
||||||
zfac = ED_view3d_calc_zfac(p->ar->regiondata, rvec, NULL);
|
zfac = ED_view3d_calc_zfac(p->ar->regiondata, rvec, NULL);
|
||||||
|
|
||||||
/* method taken from editview.c - mouse_cursor() */
|
if (ED_view3d_project_float_global(p->ar, rvec, mval_prj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
|
||||||
/* TODO, use ED_view3d_project_float_global */
|
sub_v2_v2v2(mval_f, mval_prj, mval_f);
|
||||||
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);
|
|
||||||
ED_view3d_win_to_delta(p->ar, mval_f, dvec, zfac);
|
ED_view3d_win_to_delta(p->ar, mval_f, dvec, zfac);
|
||||||
sub_v3_v3v3(out, rvec, dvec);
|
sub_v3_v3v3(out, rvec, dvec);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user