[Bf-blender-cvs] [e51841c] master: Code cleanup: project gpencil in float coords & delete outdated comments
Campbell Barton
noreply at git.blender.org
Mon Apr 7 07:22:33 CEST 2014
Commit: e51841cbca2ab4be47fc5dcfa36857505bb114da
Author: Campbell Barton
Date: Mon Apr 7 15:21:01 2014 +1000
https://developer.blender.org/rBe51841cbca2ab4be47fc5dcfa36857505bb114da
Code cleanup: project gpencil in float coords & delete outdated comments
===================================================================
M source/blender/editors/armature/editarmature_sketch.c
M source/blender/editors/gpencil/gpencil_edit.c
M source/blender/editors/gpencil/gpencil_paint.c
===================================================================
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index a1ba76c..475ffd2 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 092951b..4c4926f 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 65f205c..6bbaca7 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);
}
More information about the Bf-blender-cvs
mailing list