Do not start Timer upon manual switching of internal process

Prevents `Timer` to prematurely start and timeout immediately if internal
processing is enabled manually with `Timer.set_process_internal(true)` or
`Timer.set_physics_process_internal(true)`.

Even if the internal processing is enabled manually, the user still has to
actually start the timer with `start()` method explicitly.
This commit is contained in:
Andrii Doroshenko (Xrayez) 2020-11-20 01:28:40 +02:00
parent 9a3d3df0e2
commit afcb6f38db

View file

@ -46,7 +46,7 @@ void Timer::_notification(int p_what) {
} }
} break; } break;
case NOTIFICATION_INTERNAL_PROCESS: { case NOTIFICATION_INTERNAL_PROCESS: {
if (timer_process_mode == TIMER_PROCESS_PHYSICS || !is_processing_internal()) { if (!processing || timer_process_mode == TIMER_PROCESS_PHYSICS || !is_processing_internal()) {
return; return;
} }
time_left -= get_process_delta_time(); time_left -= get_process_delta_time();
@ -63,7 +63,7 @@ void Timer::_notification(int p_what) {
} break; } break;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
if (timer_process_mode == TIMER_PROCESS_IDLE || !is_physics_processing_internal()) { if (!processing || timer_process_mode == TIMER_PROCESS_IDLE || !is_physics_processing_internal()) {
return; return;
} }
time_left -= get_physics_process_delta_time(); time_left -= get_physics_process_delta_time();