diff --git a/bindings/blender_init.py b/bindings/blender_init.py index 22696fa6..82ed21db 100644 --- a/bindings/blender_init.py +++ b/bindings/blender_init.py @@ -170,9 +170,9 @@ def draw_direct(bitmap): draw_texture_2d(texture, (0, 0), texture.width, texture.height) def status_update_interactive(cb_info, args): - tag_redraw, update_stats, self = args + tag_redraw, update_stats, total_samples = args; tag_redraw() - if cb_info.finished_passes == self.cr_renderer.prefs.samples: + if cb_info.finished_passes == total_samples: update_stats("Rendering done", "") else: update_stats("Sample {}".format(cb_info.finished_passes), "") @@ -193,8 +193,6 @@ def __init__(self): c_ray.log_level_set(c_ray.log_level.Debug) def __del__(self): - # FIXME: This never gets called when leaving rendered viewport shading mode - # which ends up leaving zombie instances of c-ray running in the background if self.cr_renderer: if self.cr_renderer.interactive: self.cr_renderer.stop() @@ -481,7 +479,7 @@ def view_update(self, context, depsgraph): sync_end = time.time() print("Sync took {}s".format(sync_end - sync_start)) print("Kicking off background renderer") - self.cr_renderer.callbacks.on_interactive_pass_finished = (status_update_interactive, (self.tag_redraw, self.update_stats, self)) + self.cr_renderer.callbacks.on_interactive_pass_finished = (status_update_interactive, (self.tag_redraw, self.update_stats, self.cr_renderer.prefs.samples)) self.cr_renderer.start_interactive() def display_bitmap(self, bm):