[Bf-extensions-cvs] [72d99082] blender-v2.81-release: Rigify: fix undo after a failed generation attempt.

Alexander Gavrilov noreply at git.blender.org
Tue Oct 22 18:25:31 CEST 2019


Commit: 72d99082bb6cfc0b03afe73382f5562935d87a43
Author: Alexander Gavrilov
Date:   Tue Oct 22 18:49:17 2019 +0300
Branches: blender-v2.81-release
https://developer.blender.org/rBA72d99082bb6cfc0b03afe73382f5562935d87a43

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.

===================================================================

M	rigify/ui.py

===================================================================

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'}



More information about the Bf-extensions-cvs mailing list