Fix render cancel on Windows
We can nto send SIGINT isgnal on windows, it does not exist.
This commit is contained in:
@@ -585,7 +585,7 @@ class BENCHMARK_OT_run(bpy.types.Operator):
|
||||
# Construct final stats string
|
||||
if global_cancel:
|
||||
global_result_dict = None
|
||||
self.init_sate()
|
||||
self.init_state()
|
||||
else:
|
||||
global_result_stats = ""
|
||||
for stat in global_result_dict["stats"]:
|
||||
@@ -602,7 +602,7 @@ class BENCHMARK_OT_run(bpy.types.Operator):
|
||||
global global_background_image_path
|
||||
global_background_image_path = ""
|
||||
# Tag for nice redraw
|
||||
global_progress_status = ""
|
||||
global_progress_status = None
|
||||
current_progress = 0.0
|
||||
context.area.tag_redraw()
|
||||
|
||||
@@ -663,7 +663,7 @@ class BENCHMARK_OT_run(bpy.types.Operator):
|
||||
context.window_manager.modal_handler_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
def init_sate(self):
|
||||
def init_state(self):
|
||||
global global_result_platform
|
||||
global global_progress_status
|
||||
global global_result_stats
|
||||
@@ -684,22 +684,23 @@ class BENCHMARK_OT_run(bpy.types.Operator):
|
||||
context.area.tag_redraw()
|
||||
progress_lock.release()
|
||||
if self.progress_provider.process:
|
||||
import signal
|
||||
# Corresponds to usual greeting of blender to hit Ctrl-C
|
||||
# again to abort rendering.
|
||||
self.progress_provider.process.send_signal(signal.SIGINT)
|
||||
self.progress_provider.process.send_signal(signal.SIGINT)
|
||||
if platform.system() == "Windows":
|
||||
self.progress_provider.process.kill()
|
||||
else:
|
||||
import signal
|
||||
# Corresponds to usual greeting of blender to hit Ctrl-C
|
||||
# again to abort rendering.
|
||||
self.progress_provider.process.send_signal(signal.SIGINT)
|
||||
self.progress_provider.process.send_signal(signal.SIGINT)
|
||||
|
||||
def cancel(self, context):
|
||||
global global_cancel
|
||||
print("CANCEL")
|
||||
self.cancel_request(context)
|
||||
if self.timer:
|
||||
wm = context.window_manager
|
||||
wm.event_timer_remove(self.timer)
|
||||
if self.thread:
|
||||
self.thread.join()
|
||||
print("CANCELLED")
|
||||
|
||||
|
||||
class BENCHMARK_OT_save(bpy.types.Operator):
|
||||
|
Reference in New Issue
Block a user