diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2019-10-22 18:49:17 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2019-10-22 18:51:17 +0300 |
commit | 72d99082bb6cfc0b03afe73382f5562935d87a43 (patch) | |
tree | eab8540c581fc0b8e6fe4842ba60438e1081b647 | |
parent | f9693237686b7b4aa6c7041bf66df5f1caa963fc (diff) |
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.
-rw-r--r-- | rigify/ui.py | 9 |
1 files changed, 8 insertions, 1 deletions
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'} |