Fix wmTimer.ntime becoming NAN with a zero time-step
While this didn't cause any user visible bugs, this wouldn't have behaved as intended since the timer would never run again once wmTimer.ntime was set to NAN.
This commit is contained in:
parent
97dbe235a2
commit
ed80c887b7
|
@ -1483,7 +1483,11 @@ static bool wm_window_timer(const bContext *C)
|
|||
wt->delta = time - wt->ltime;
|
||||
wt->duration += wt->delta;
|
||||
wt->ltime = time;
|
||||
wt->ntime = wt->stime + wt->timestep * ceil(wt->duration / wt->timestep);
|
||||
|
||||
wt->ntime = wt->stime;
|
||||
if (wt->timestep != 0.0f) {
|
||||
wt->ntime += wt->timestep * ceil(wt->duration / wt->timestep);
|
||||
}
|
||||
|
||||
if (wt->event_type == TIMERJOBS) {
|
||||
wm_jobs_timer(wm, wt);
|
||||
|
@ -1596,6 +1600,7 @@ void WM_event_timer_sleep(wmWindowManager *wm,
|
|||
wmTimer *WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)
|
||||
{
|
||||
wmTimer *wt = MEM_callocN(sizeof(wmTimer), "window timer");
|
||||
BLI_assert(timestep >= 0.0f);
|
||||
|
||||
wt->event_type = event_type;
|
||||
wt->ltime = PIL_check_seconds_timer();
|
||||
|
@ -1615,6 +1620,7 @@ wmTimer *WM_event_add_timer_notifier(wmWindowManager *wm,
|
|||
double timestep)
|
||||
{
|
||||
wmTimer *wt = MEM_callocN(sizeof(wmTimer), "window timer");
|
||||
BLI_assert(timestep >= 0.0f);
|
||||
|
||||
wt->event_type = TIMERNOTIFIER;
|
||||
wt->ltime = PIL_check_seconds_timer();
|
||||
|
|
Loading…
Reference in New Issue