Bugfix, own collection

Graph editor: sliding Nkey Properties to left, closing curves view
entirely, was hanging in eternal loop. Caused by division by zero.
This commit is contained in:
Ton Roosendaal
2011-01-03 18:57:13 +00:00
parent 6b82aa8d01
commit 5eaad696e8

View File

@@ -1133,9 +1133,11 @@ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short x
space= v2d->cur.xmax - v2d->cur.xmin;
pixels= (float)(v2d->mask.xmax - v2d->mask.xmin);
grid->dx= (U.v2d_min_gridsize * space) / (seconddiv * pixels);
step_to_grid(&grid->dx, &grid->powerx, xunits);
grid->dx *= seconddiv;
if(pixels!=0.0f) {
grid->dx= (U.v2d_min_gridsize * space) / (seconddiv * pixels);
step_to_grid(&grid->dx, &grid->powerx, xunits);
grid->dx *= seconddiv;
}
if (xclamp == V2D_GRID_CLAMP) {
if (grid->dx < 0.1f) grid->dx= 0.1f;