Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-10-04 21:52:12 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-04 21:52:12 +0400
commite77004157e483c610a6478b733a42554ab21c365 (patch)
tree49658faa8166b7176d8b3202308f97561db22bb0 /source/blender/editors/gpencil
parent709903c6bba4dca12a6f367000f99a83da2af034 (diff)
make ED_view3d_project_int equivalent to ED_view3d_project_short functions.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c48
1 files changed, 33 insertions, 15 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 5909c4fc270..0595f4e18bd 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -278,11 +278,15 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3]
gp_get_3d_reference(p, rvec);
/* method taken from editview.c - mouse_cursor() */
- ED_view3d_project_int_noclip(p->ar, rvec, mval_prj);
-
- VECSUB2D(mval_f, mval_prj, mval);
- ED_view3d_win_to_delta(p->ar, mval_f, dvec);
- sub_v3_v3v3(out, rvec, dvec);
+ /* 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_SUCCESS) {
+ VECSUB2D(mval_f, mval_prj, mval);
+ ED_view3d_win_to_delta(p->ar, mval_f, dvec);
+ sub_v3_v3v3(out, rvec, dvec);
+ }
+ else {
+ zero_v3(out);
+ }
}
}
@@ -808,9 +812,14 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
else if (gps->totpoints == 1) {
/* get coordinates */
if (gps->flag & GP_STROKE_3DSPACE) {
- ED_view3d_project_int(p->ar, &gps->points->x, xyval);
- x0 = xyval[0];
- y0 = xyval[1];
+ if (ED_view3d_project_int_global(p->ar, &gps->points->x, xyval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_SUCCESS) {
+ x0 = xyval[0];
+ y0 = xyval[1];
+ }
+ else {
+ x0 = V2D_IS_CLIPPED;
+ y0 = V2D_IS_CLIPPED;
+ }
}
else if (gps->flag & GP_STROKE_2DSPACE) {
UI_view2d_view_to_region(p->v2d, gps->points->x, gps->points->y, &x0, &y0);
@@ -847,13 +856,22 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p,
/* get coordinates */
if (gps->flag & GP_STROKE_3DSPACE) {
- ED_view3d_project_int(p->ar, &pt1->x, xyval);
- x0 = xyval[0];
- y0 = xyval[1];
-
- ED_view3d_project_int(p->ar, &pt2->x, xyval);
- x1 = xyval[0];
- y1 = xyval[1];
+ if (ED_view3d_project_int_global(p->ar, &pt1->x, xyval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_SUCCESS) {
+ x0 = xyval[0];
+ y0 = xyval[1];
+ }
+ else {
+ x0 = V2D_IS_CLIPPED;
+ y0 = V2D_IS_CLIPPED;
+ }
+ if (ED_view3d_project_int_global(p->ar, &pt2->x, xyval, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_SUCCESS) {
+ x1 = xyval[0];
+ y1 = xyval[1];
+ }
+ else {
+ x1 = V2D_IS_CLIPPED;
+ y1 = V2D_IS_CLIPPED;
+ }
}
else if (gps->flag & GP_STROKE_2DSPACE) {
UI_view2d_view_to_region(p->v2d, pt1->x, pt1->y, &x0, &y0);