void Timer::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { if (autostart) { #ifdef TOOLS_ENABLED if (Engine::get_singleton()->is_editor_hint() && get_tree()->get_edited_scene_root() && (get_tree()->get_edited_scene_root() == this || get_tree()->get_edited_scene_root()->is_a_parent_of(this))) break; #endif start(); autostart = false; } } break; case NOTIFICATION_INTERNAL_PROCESS: { if (timer_process_mode == TIMER_PROCESS_PHYSICS || !is_processing_internal()) return; time_left -= get_process_delta_time(); if (time_left < 0) { if (!one_shot) time_left += wait_time; else stop(); emit_signal("timeout"); } } break; case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: { if (timer_process_mode == TIMER_PROCESS_IDLE || !is_physics_processing_internal()) return; time_left -= get_physics_process_delta_time(); if (time_left < 0) { if (!one_shot) time_left += wait_time; else stop(); emit_signal("timeout"); } } break; } }
void CPUParticles2D::set_emitting(bool p_emitting) { emitting = p_emitting; if (!is_processing_internal()) { set_process_internal(true); if (is_inside_tree()) { #ifndef NO_THREADS update_mutex->lock(); #endif VS::get_singleton()->connect("frame_pre_draw", this, "_update_render_thread"); VS::get_singleton()->canvas_item_set_update_when_visible(get_canvas_item(), true); #ifndef NO_THREADS update_mutex->unlock(); #endif } } }
void CPUParticles::set_emitting(bool p_emitting) { emitting = p_emitting; if (!is_processing_internal()) { set_process_internal(true); if (is_inside_tree()) { #ifndef NO_THREADS update_mutex->lock(); #endif VS::get_singleton()->connect("frame_pre_draw", this, "_update_render_thread"); VS::get_singleton()->instance_geometry_set_flag(get_instance(), VS::INSTANCE_FLAG_REDRAW_FRAME_IF_VISIBLE, true); #ifndef NO_THREADS update_mutex->unlock(); #endif } } }
void Timer::set_timer_process_mode(TimerProcessMode p_mode) { if (timer_process_mode == p_mode) return; switch (timer_process_mode) { case TIMER_PROCESS_PHYSICS: if (is_physics_processing_internal()) { set_physics_process_internal(false); set_process_internal(true); } break; case TIMER_PROCESS_IDLE: if (is_processing_internal()) { set_process_internal(false); set_physics_process_internal(true); } break; } timer_process_mode = p_mode; }