diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-19 11:55:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-19 11:55:48 +0400 |
commit | 1dad9bf0bcf0ed94d6542088f1e217f29540ec8c (patch) | |
tree | c35a4772defd8d16c645473be5d28546cfa4c980 /source/blender/editors/gpencil/gpencil_edit.c | |
parent | 31d3e8d2142ad19e0d43cfcce3f1aece55c5d86c (diff) |
change window_to_3d to take screen coords as floats.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_edit.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 68577cf4f0f..e5f39614c03 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -377,24 +377,27 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi } else { float *fp= give_cursor(scene, v3d); - int mx, my; + float mx, my; /* get screen coordinate */ if (gps->flag & GP_STROKE_2DSPACE) { + int mxi, myi; View2D *v2d= &ar->v2d; - UI_view2d_view_to_region(v2d, pt->x, pt->y, &mx, &my); + UI_view2d_view_to_region(v2d, pt->x, pt->y, &mxi, &myi); + mx= mxi; + my= myi; } else { if(subrect) { - mx= (int)((pt->x/100.0f) * (subrect->xmax - subrect->xmin)) + subrect->xmin; - my= (int)((pt->y/100.0f) * (subrect->ymax - subrect->ymin)) + subrect->ymin; + mx= (((float)pt->x/100.0f) * (subrect->xmax - subrect->xmin)) + subrect->xmin; + my= (((float)pt->y/100.0f) * (subrect->ymax - subrect->ymin)) + subrect->ymin; } else { - mx= (int)(pt->x / 100 * ar->winx); - my= (int)(pt->y / 100 * ar->winy); + mx= (float)pt->x / 100.0f * ar->winx; + my= (float)pt->y / 100.0f * ar->winy; } } - + /* convert screen coordinate to 3d coordinates * - method taken from editview.c - mouse_cursor() */ |