diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-21 12:07:17 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-22 12:29:56 +0300 |
commit | 25f1c2b04e0d98587c88c5ea26b59650e5c2e3f7 (patch) | |
tree | c4e038cae798ff9c15fcee4fb54ffbb18295ed63 /add_curve_extra_objects | |
parent | f24ca278e8f67e8cf3f3635b138089d8e53681af (diff) |
Add-ons: remove temporary disabling of use_global_undo
This can cause bugs where if the operator throws an exception, undo is not
properly enabled again. There have been maybe a dozen Blender bug reports
related to this. This could get worse now that we are autosaving preferences.
Some add-ons guard against this, but turning off undo should not be needed in
the first place. If the operator is set to do an undo push, any operators it
calls will automatically not do any undo pushes.
If this fail in some cases, it should be reported as a bug in Blender. I could
not find issues or a performance impact testing a few add-ons though.
Differential Revision: https://developer.blender.org/D4908
Diffstat (limited to 'add_curve_extra_objects')
-rw-r--r-- | add_curve_extra_objects/add_curve_aceous_galore.py | 9 | ||||
-rw-r--r-- | add_curve_extra_objects/add_curve_spirofit_bouncespline.py | 12 | ||||
-rw-r--r-- | add_curve_extra_objects/add_curve_torus_knots.py | 9 |
3 files changed, 2 insertions, 28 deletions
diff --git a/add_curve_extra_objects/add_curve_aceous_galore.py b/add_curve_extra_objects/add_curve_aceous_galore.py index 62ac823c..5b67dcad 100644 --- a/add_curve_extra_objects/add_curve_aceous_galore.py +++ b/add_curve_extra_objects/add_curve_aceous_galore.py @@ -1433,10 +1433,6 @@ class Curveaceous_galore(Operator, object_utils.AddObjectHelper): return context.scene is not None def execute(self, context): - # turn off undo - undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False - # deal with 2D - 3D curve differences if self.ProfileType in ['Helix', 'Cycloid', 'Noise']: self.shape = '3D' @@ -1460,9 +1456,6 @@ class Curveaceous_galore(Operator, object_utils.AddObjectHelper): self.align_matrix = align_matrix(context, self.startlocation) main(context, self, self.align_matrix or Matrix()) - # restore pre operator undo state - context.preferences.edit.use_global_undo = undo - return {'FINISHED'} # Register @@ -1481,4 +1474,4 @@ def unregister(): unregister_class(cls) if __name__ == "__main__": - register()
\ No newline at end of file + register() diff --git a/add_curve_extra_objects/add_curve_spirofit_bouncespline.py b/add_curve_extra_objects/add_curve_spirofit_bouncespline.py index 5c35d2bc..8d4179ba 100644 --- a/add_curve_extra_objects/add_curve_spirofit_bouncespline.py +++ b/add_curve_extra_objects/add_curve_spirofit_bouncespline.py @@ -317,9 +317,6 @@ class SpiroFitSpline(Operator): "Active Object is not a Mesh. Operation Cancelled") return {'CANCELLED'} - #undo = context.preferences.edit.use_global_undo - #context.preferences.edit.use_global_undo = False - bpy.ops.object.select_all(action='DESELECT') r.seed(self.random_seed) @@ -357,7 +354,6 @@ class SpiroFitSpline(Operator): if self.auto_refresh is False: self.refresh = False - #context.preferences.edit.use_global_undo = undo return {'FINISHED'} @@ -585,9 +581,6 @@ class BounceSpline(Operator): if obj.type != 'MESH': return {'CANCELLED'} - #undo = context.preferences.edit.use_global_undo - #context.preferences.edit.use_global_undo = False - bpy.ops.object.select_all(action='DESELECT') r.seed(self.random_seed) @@ -622,7 +615,6 @@ class BounceSpline(Operator): if self.auto_refresh is False: self.refresh = False - #context.preferences.edit.use_global_undo = undo return {'FINISHED'} @@ -823,9 +815,6 @@ class CatenaryCurve(Operator): bpy.ops.object.select_all(action='DESELECT') - #undo = context.preferences.edit.use_global_undo - #context.preferences.edit.use_global_undo = False - r.seed(self.random_seed) points = catenary_curve( @@ -857,7 +846,6 @@ class CatenaryCurve(Operator): if self.auto_refresh is False: self.refresh = False - #context.preferences.edit.use_global_undo = undo return {'FINISHED'} diff --git a/add_curve_extra_objects/add_curve_torus_knots.py b/add_curve_extra_objects/add_curve_torus_knots.py index 8352ecfa..3b2b362c 100644 --- a/add_curve_extra_objects/add_curve_torus_knots.py +++ b/add_curve_extra_objects/add_curve_torus_knots.py @@ -711,16 +711,9 @@ class torus_knot_plus(Operator, AddObjectHelper): # update align matrix self.align_matrix = align_matrix(self, context) - # turn off undo - #undo = bpy.context.preferences.edit.use_global_undo - #bpy.context.preferences.edit.use_global_undo = False - # create the curve create_torus_knot(self, context) - # restore pre operator undo state - #bpy.context.preferences.edit.use_global_undo = undo - return {'FINISHED'} def invoke(self, context, event): @@ -744,4 +737,4 @@ def unregister(): unregister_class(cls) if __name__ == "__main__": - register()
\ No newline at end of file + register() |