[Bf-blender-cvs] [79f5281d4fb] cycles_texture_cache: WM: disable idle event handling timer when simulating events

Campbell Barton noreply at git.blender.org
Thu May 6 11:25:38 CEST 2021


Commit: 79f5281d4fb1e8d221eb99a3c1fe3a28c4501ccb
Author: Campbell Barton
Date:   Tue May 4 00:29:59 2021 +1000
Branches: cycles_texture_cache
https://developer.blender.org/rB79f5281d4fb1e8d221eb99a3c1fe3a28c4501ccb

WM: disable idle event handling timer when simulating events

===================================================================

M	source/blender/windowmanager/intern/wm_window.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index b90352b9e62..cdd5ea12df8 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1563,8 +1563,11 @@ void wm_window_process_events(const bContext *C)
   has_event |= wm_xr_events_handle(CTX_wm_manager(C));
 #endif
 
-  /* no event, we sleep 5 milliseconds */
-  if (has_event == false) {
+  /* When there is no event, sleep 5 milliseconds not to use too much CPU when idle.
+   *
+   * Skip sleeping when simulating events so tests don't idle unnecessarily as simulated
+   * events are typically generated from a timer that runs in the main loop. */
+  if ((has_event == false) && !(G.f & G_FLAG_EVENT_SIMULATE)) {
     PIL_sleep_ms(5);
   }
 }



More information about the Bf-blender-cvs mailing list