Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-21 12:07:17 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-22 12:29:56 +0300
commit25f1c2b04e0d98587c88c5ea26b59650e5c2e3f7 (patch)
treec4e038cae798ff9c15fcee4fb54ffbb18295ed63 /mesh_looptools.py
parentf24ca278e8f67e8cf3f3635b138089d8e53681af (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 'mesh_looptools.py')
-rw-r--r--mesh_looptools.py36
1 files changed, 16 insertions, 20 deletions
diff --git a/mesh_looptools.py b/mesh_looptools.py
index 2b11465f..87c23383 100644
--- a/mesh_looptools.py
+++ b/mesh_looptools.py
@@ -747,8 +747,6 @@ def get_parallel_loops(bm_mod, loops):
# gather initial data
def initialise():
- global_undo = bpy.context.preferences.edit.use_global_undo
- bpy.context.preferences.edit.use_global_undo = False
object = bpy.context.active_object
if 'MIRROR' in [mod.type for mod in object.modifiers if mod.show_viewport]:
# ensure that selection is synced for the derived mesh
@@ -760,7 +758,7 @@ def initialise():
bm.edges.ensure_lookup_table()
bm.faces.ensure_lookup_table()
- return(global_undo, object, bm)
+ return(object, bm)
# move the vertices to their new locations
@@ -830,14 +828,12 @@ def settings_write(self):
# clean up and set settings back to original state
-def terminate(global_undo):
+def terminate():
# update editmesh cached data
obj = bpy.context.active_object
if obj.mode == 'EDIT':
bmesh.update_edit_mesh(obj.data, loop_triangles=True, destructive=True)
- bpy.context.preferences.edit.use_global_undo = global_undo
-
# ########################################
# ##### Bridge functions #################
@@ -3301,7 +3297,7 @@ class Bridge(Operator):
def execute(self, context):
# initialise
- global_undo, object, bm = initialise()
+ object, bm = initialise()
edge_faces, edgekey_to_edge, old_selected_faces, smooth = \
bridge_initialise(bm, self.interpolation)
settings_write(self)
@@ -3375,7 +3371,7 @@ class Bridge(Operator):
bpy.ops.mesh.normals_make_consistent()
# cleaning up
- terminate(global_undo)
+ terminate()
return{'FINISHED'}
@@ -3484,7 +3480,7 @@ class Circle(Operator):
def execute(self, context):
# initialise
- global_undo, object, bm = initialise()
+ object, bm = initialise()
settings_write(self)
# check cache to see if we can save time
cached, single_loops, loops, derived, mapping = cache_read("Circle",
@@ -3548,7 +3544,7 @@ class Circle(Operator):
# cleaning up
if derived:
bm_mod.free()
- terminate(global_undo)
+ terminate()
return{'FINISHED'}
@@ -3648,7 +3644,7 @@ class Curve(Operator):
def execute(self, context):
# initialise
- global_undo, object, bm = initialise()
+ object, bm = initialise()
settings_write(self)
# check cache to see if we can save time
cached, single_loops, loops, derived, mapping = cache_read("Curve",
@@ -3692,7 +3688,7 @@ class Curve(Operator):
# cleaning up
if derived:
bm_mod.free()
- terminate(global_undo)
+ terminate()
return{'FINISHED'}
@@ -3780,7 +3776,7 @@ class Flatten(Operator):
def execute(self, context):
# initialise
- global_undo, object, bm = initialise()
+ object, bm = initialise()
settings_write(self)
# check cache to see if we can save time
cached, single_loops, loops, derived, mapping = cache_read("Flatten",
@@ -3814,7 +3810,7 @@ class Flatten(Operator):
move_verts(object, bm, False, move, lock, self.influence)
# cleaning up
- terminate(global_undo)
+ terminate()
return{'FINISHED'}
@@ -3989,7 +3985,7 @@ class GStretch(Operator):
def execute(self, context):
# initialise
- global_undo, object, bm = initialise()
+ object, bm = initialise()
settings_write(self)
# check cache to see if we can save time
@@ -4093,7 +4089,7 @@ class GStretch(Operator):
# cleaning up
if derived:
bm_mod.free()
- terminate(global_undo)
+ terminate()
return{'FINISHED'}
@@ -4157,7 +4153,7 @@ class Relax(Operator):
def execute(self, context):
# initialise
- global_undo, object, bm = initialise()
+ object, bm = initialise()
settings_write(self)
# check cache to see if we can save time
cached, single_loops, loops, derived, mapping = cache_read("Relax",
@@ -4191,7 +4187,7 @@ class Relax(Operator):
# cleaning up
if derived:
bm_mod.free()
- terminate(global_undo)
+ terminate()
return{'FINISHED'}
@@ -4279,7 +4275,7 @@ class Space(Operator):
def execute(self, context):
# initialise
- global_undo, object, bm = initialise()
+ object, bm = initialise()
settings_write(self)
# check cache to see if we can save time
cached, single_loops, loops, derived, mapping = cache_read("Space",
@@ -4317,7 +4313,7 @@ class Space(Operator):
# cleaning up
if derived:
bm_mod.free()
- terminate(global_undo)
+ terminate()
return{'FINISHED'}