Fix for UI_view2d_to_region_float (was ignoring x,y args)
use this for grease pencil stroke conversion to avoid float->int->float conversion.
This commit is contained in:
@@ -456,10 +456,8 @@ static void gp_strokepoint_convertcoords(bContext *C, bGPDstroke *gps, bGPDspoin
|
||||
|
||||
/* get screen coordinate */
|
||||
if (gps->flag & GP_STROKE_2DSPACE) {
|
||||
int mvali[2];
|
||||
View2D *v2d = &ar->v2d;
|
||||
UI_view2d_view_to_region(v2d, pt->x, pt->y, mvali, mvali + 1);
|
||||
VECCOPY2D(mvalf, mvali);
|
||||
UI_view2d_to_region_float(v2d, pt->x, pt->y, &mvalf[0], &mvalf[1]);
|
||||
}
|
||||
else {
|
||||
if (subrect) {
|
||||
|
||||
@@ -2045,8 +2045,8 @@ void UI_view2d_to_region_no_clip(View2D *v2d, float x, float y, int *regionx, in
|
||||
void UI_view2d_to_region_float(View2D *v2d, float x, float y, float *regionx, float *regiony)
|
||||
{
|
||||
/* express given coordinates as proportional values */
|
||||
x = -v2d->cur.xmin / BLI_rctf_size_x(&v2d->cur);
|
||||
y = -v2d->cur.ymin / BLI_rctf_size_y(&v2d->cur);
|
||||
x = (x - v2d->cur.xmin) / BLI_rctf_size_x(&v2d->cur);
|
||||
y = (y - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur);
|
||||
|
||||
/* convert proportional distances to screen coordinates */
|
||||
*regionx = v2d->mask.xmin + x * BLI_rcti_size_x(&v2d->mask);
|
||||
|
||||
Reference in New Issue
Block a user