From 72d99082bb6cfc0b03afe73382f5562935d87a43 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Tue, 22 Oct 2019 18:49:17 +0300 Subject: Rigify: fix undo after a failed generation attempt. Throwing an exception out of an operator seems to mess up the undo stack entry created by it, so catch and report all exceptions. --- rigify/ui.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rigify/ui.py b/rigify/ui.py index dacbd0a2..caac09ab 100644 --- a/rigify/ui.py +++ b/rigify/ui.py @@ -740,7 +740,7 @@ def rigify_report_exception(operator, exception): message.reverse() # XXX - stupid! menu's are upside down! - operator.report({'INFO'}, '\n'.join(message)) + operator.report({'ERROR'}, '\n'.join(message)) class LayerInit(bpy.types.Operator): @@ -776,6 +776,13 @@ class Generate(bpy.types.Operator): traceback.print_exc() rigify_report_exception(self, rig_exception) + except Exception as rig_exception: + import traceback + traceback.print_exc() + + self.report({'ERROR'}, 'Generation has thrown an exception: ' + str(rig_exception)) + finally: + bpy.ops.object.mode_set(mode='OBJECT') return {'FINISHED'} -- cgit v1.2.3