Skip to content

Commit

Permalink
Add a mutex around the stop_render call.
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-hsieh committed Jul 11, 2021
1 parent 73d0055 commit ed51e6d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rman_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,10 @@ def draw_threading_func(db):
while db.rman_is_live_rendering:
if not __any_areas_shading():
# if there are no 3d viewports, stop IPR
rfb_log().debug("No 3d viewports set to RENDER. Stop IPR.")
db.rman_is_live_rendering = False
db.stop_render(stop_draw_thread=False)
break
if db.rman_is_viewport_rendering:
try:
db.bl_engine.tag_redraw()
Expand Down Expand Up @@ -269,6 +271,7 @@ def __init__(self):
self.viewport_buckets = list()
self._draw_viewport_buckets = False
self.stats_mgr = RfBStatsManager(self)
self.stop_render_mtx = threading.Lock()

self._start_prman_begin()

Expand Down Expand Up @@ -933,6 +936,8 @@ def stop_render(self, stop_draw_thread=True):
global __DRAW_THREAD__
global __RMAN_STATS_THREAD__

self.stop_render_mtx.acquire()

if not self.rman_interactive_running and not self.rman_running:
return

Expand Down Expand Up @@ -974,6 +979,7 @@ def stop_render(self, stop_draw_thread=True):
self.viewport_buckets.clear()
self._draw_viewport_buckets = False
__update_areas__()
self.stop_render_mtx.release()
rfb_log().debug("RenderMan has Stopped.")

def get_blender_dspy_plugin(self):
Expand Down

0 comments on commit ed51e6d

Please sign in to comment.