diff --git a/add_curve_extra_objects/add_curve_aceous_galore.py b/add_curve_extra_objects/add_curve_aceous_galore.py index 62ac823c0d977f780e06eea928f8ccc4298bc4d4..5b67dcad7f91d264b4862aa85b74627724e2ca33 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 5c35d2bc0f54b17d918fecf4d7bdda7a09479a88..8d4179ba2e24b5388562b86f3ed01e702e97a5e4 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 8352ecfaf19562dfff566247909c9a51cc2447f4..3b2b362c873f37550c70e244b266021a262a1b70 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() diff --git a/add_mesh_extra_objects/add_mesh_solid.py b/add_mesh_extra_objects/add_mesh_solid.py index 98172d37312a22c19fdee5f303371f87baf193ec..59e070df1638560a025ece20eafd1390461f67e7 100644 --- a/add_mesh_extra_objects/add_mesh_solid.py +++ b/add_mesh_extra_objects/add_mesh_solid.py @@ -449,10 +449,6 @@ class Solids(bpy.types.Operator): previousSetting = "" def execute(self, context): - # turn off undo for better performance (3-5x faster), also makes sure - # that mesh ops are undoable and entire script acts as one operator - bpy.context.preferences.edit.use_global_undo = False - # piece of code to make presets remain until parameters are changed if self.preset != "0": # if preset, set preset @@ -512,7 +508,4 @@ class Solids(bpy.types.Operator): object_data_add(context, mesh, operator=None) # object generation done - # turn undo back on - bpy.context.preferences.edit.use_global_undo = True - return {'FINISHED'} diff --git a/ant_landscape/add_mesh_ant_landscape.py b/ant_landscape/add_mesh_ant_landscape.py index bb2173d0e24d49396daebe1ba860153173a68fa6..c80256d5f60fd4821de1732d1fdbf47e42ee24bb 100644 --- a/ant_landscape/add_mesh_ant_landscape.py +++ b/ant_landscape/add_mesh_ant_landscape.py @@ -593,10 +593,6 @@ class AntAddLandscape(bpy.types.Operator): if not self.refresh: return {'PASS_THROUGH'} - # turn off undo - undo = bpy.context.preferences.edit.use_global_undo - bpy.context.preferences.edit.use_global_undo = False - # turn off 'Enter Edit Mode' use_enter_edit_mode = bpy.context.preferences.edit.use_enter_edit_mode bpy.context.preferences.edit.use_enter_edit_mode = False @@ -783,7 +779,6 @@ class AntAddLandscape(bpy.types.Operator): self.refresh = False # restore pre operator state - context.preferences.edit.use_global_undo = undo bpy.context.preferences.edit.use_enter_edit_mode = use_enter_edit_mode return {'FINISHED'} diff --git a/ant_landscape/ant_functions.py b/ant_landscape/ant_functions.py index 62fe4916bf97f0187e5e92e4659844a5ef42d0a2..075c33b0f632fcc663fbb6687e75a36e5299c5e9 100644 --- a/ant_landscape/ant_functions.py +++ b/ant_landscape/ant_functions.py @@ -141,10 +141,6 @@ class AntLandscapeRefresh(bpy.types.Operator): def execute(self, context): - # turn off undo - undo = bpy.context.preferences.edit.use_global_undo - bpy.context.preferences.edit.use_global_undo = False - # ant object items obj = bpy.context.active_object @@ -177,9 +173,6 @@ class AntLandscapeRefresh(bpy.types.Operator): else: pass - # restore pre operator undo state - context.preferences.edit.use_global_undo = undo - return {'FINISHED'} # ------------------------------------------------------------ @@ -201,10 +194,6 @@ class AntLandscapeRegenerate(bpy.types.Operator): def execute(self, context): - # turn off undo - undo = bpy.context.preferences.edit.use_global_undo - bpy.context.preferences.edit.use_global_undo = False - view_layer = bpy.context.view_layer # ant object items obj = bpy.context.active_object @@ -328,9 +317,6 @@ class AntLandscapeRegenerate(bpy.types.Operator): new_ob.select_set(True) view_layer.objects.active = new_ob - # restore pre operator undo state - context.preferences.edit.use_global_undo = undo - return {'FINISHED'} diff --git a/ant_landscape/mesh_ant_displace.py b/ant_landscape/mesh_ant_displace.py index 3442711f02ff79ce1913810e46c3cca17f6d586d..917cc34b6d10bd682c8c6d1f1b1cc8cf5d1afd10 100644 --- a/ant_landscape/mesh_ant_displace.py +++ b/ant_landscape/mesh_ant_displace.py @@ -596,10 +596,6 @@ class AntMeshDisplace(bpy.types.Operator): if not self.refresh: return {'PASS_THROUGH'} - # turn off undo - undo = bpy.context.preferences.edit.use_global_undo - bpy.context.preferences.edit.use_global_undo = False - ob = context.object # Properties: @@ -725,7 +721,4 @@ class AntMeshDisplace(bpy.types.Operator): if self.auto_refresh is False: self.refresh = False - # restore pre operator undo state - context.preferences.edit.use_global_undo = undo - return {'FINISHED'} diff --git a/curve_simplify.py b/curve_simplify.py index 1518ed5fb2468ef3e85fbbf5affa88062cc6982d..ff42c878f0e8864b5a4310d00e4385495dbd35d0 100644 --- a/curve_simplify.py +++ b/curve_simplify.py @@ -574,20 +574,13 @@ class CURVE_OT_simplify(Operator): self.keepShort # 7 ] try: - global_undo = bpy.context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False - bpy.ops.object.mode_set(mode='OBJECT') obj = context.active_object curve_dimension = obj.data.dimensions main(context, obj, options, curve_dimension) - - context.preferences.edit.use_global_undo = global_undo except Exception as e: error_handlers(self, "curve.simplify", e, "Simplify Curves") - - context.preferences.edit.use_global_undo = global_undo return {'CANCELLED'} return {'FINISHED'} diff --git a/io_scene_ms3d/ms3d_export.py b/io_scene_ms3d/ms3d_export.py index 4fe31c00bb7ac76d34b1e82a65bdce90ae672eab..bd5d2f2f2eea7487626e4231bcca57fec68bf1d6 100644 --- a/io_scene_ms3d/ms3d_export.py +++ b/io_scene_ms3d/ms3d_export.py @@ -164,9 +164,6 @@ class Ms3dExporter(): blender_context.view_layer.objects.active \ = blender_context.selected_objects[0] - # restore pre operator undo state - blender_context.preferences.edit.use_global_undo = self.undo - is_valid, statistics = ms3d_model.is_valid() if self.options_verbose in Ms3dUi.VERBOSE_NORMAL: print() diff --git a/io_scene_ms3d/ms3d_utils.py b/io_scene_ms3d/ms3d_utils.py index 330c53bba22f220fdaaee94ecdaa63e59ab733e4..943d8708498f1a6d824962036c436d066ecb31ab 100644 --- a/io_scene_ms3d/ms3d_utils.py +++ b/io_scene_ms3d/ms3d_utils.py @@ -97,11 +97,6 @@ def select_all(select): ############################################################################### def pre_setup_environment(porter, blender_context): - # inject undo to porter - # and turn off undo - porter.undo = blender_context.preferences.edit.use_global_undo - blender_context.preferences.edit.use_global_undo = False - # inject active_object to self porter.active_object = blender_context.view_layer.objects.active @@ -125,9 +120,6 @@ def post_setup_environment(porter, blender_context): blender_context.view_layer.objects.active \ = blender_context.selected_objects[0] - # restore pre operator undo state - blender_context.preferences.edit.use_global_undo = porter.undo - ############################################################################### def get_edge_split_modifier_add_if(blender_mesh_object): diff --git a/mesh_bsurfaces.py b/mesh_bsurfaces.py index 78ccfe4dc952d46facb74b3283a6f92c85a8bfea..04139c25600cdce8a8fa7d4ba3422c5f105e657e 100644 --- a/mesh_bsurfaces.py +++ b/mesh_bsurfaces.py @@ -3086,8 +3086,6 @@ class GPENCIL_OT_SURFSK_add_surface(Operator): self.main_object = bsurfaces_props.SURFSK_object_with_retopology self.main_object.select_set(True) bpy.context.view_layer.objects.active = self.main_object - - #bpy.context.preferences.edit.use_global_undo = False if not self.is_fill_faces: bpy.ops.wm.context_set_value(data_path='tool_settings.mesh_select_mode', @@ -3172,13 +3170,9 @@ class GPENCIL_OT_SURFSK_add_surface(Operator): bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN') - #bpy.context.preferences.edit.use_global_undo = self.initial_global_undo_state - return{'FINISHED'} def invoke(self, context, event): - #self.initial_global_undo_state = bpy.context.preferences.edit.use_global_undo - if bpy.ops.object.mode_set.poll(): bpy.ops.object.mode_set(mode='OBJECT') @@ -3199,7 +3193,6 @@ class GPENCIL_OT_SURFSK_add_surface(Operator): self.main_object_selected_verts_count = int(self.main_object.data.total_vert_sel) - #bpy.context.preferences.edit.use_global_undo = False bpy.ops.wm.context_set_value(data_path='tool_settings.mesh_select_mode', value='True, False, False') @@ -3401,8 +3394,6 @@ class GPENCIL_OT_SURFSK_add_surface(Operator): # Delete temporary strokes curve object bpy.ops.object.delete({"selected_objects": [self.temporary_curve]}) - #bpy.context.preferences.edit.use_global_undo = False - # If "Keep strokes" option is not active, delete original strokes curve object if (not self.stopping_errors and not self.keep_strokes) or self.is_crosshatch: bpy.ops.object.delete({"selected_objects": [self.original_curve]}) @@ -3423,8 +3414,6 @@ class GPENCIL_OT_SURFSK_add_surface(Operator): #bpy.ops.gpencil.surfsk_add_surface() self.execute(context) - #bpy.context.preferences.edit.use_global_undo = self.initial_global_undo_state - if not self.stopping_errors: return {"FINISHED"} else: @@ -3435,7 +3424,6 @@ class GPENCIL_OT_SURFSK_add_surface(Operator): created_faces_count = self.fill_with_faces(self.main_object) bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN') - #bpy.context.preferences.edit.use_global_undo = self.initial_global_undo_state if created_faces_count == 0: self.report({'WARNING'}, "There aren't any strokes attached to the object") @@ -3443,8 +3431,6 @@ class GPENCIL_OT_SURFSK_add_surface(Operator): else: return {"FINISHED"} - #bpy.context.preferences.edit.use_global_undo = self.initial_global_undo_state - if self.strokes_type == "EXTERNAL_NO_CURVE": self.report({'WARNING'}, "The secondary object is not a Curve.") return{"CANCELLED"} diff --git a/mesh_looptools.py b/mesh_looptools.py index 2b11465f2b4350aa9b43df4344d504a3dbd8ee40..87c23383bf9ab1712c6a52102e9e6376c1f6f539 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'} diff --git a/rigify/legacy/rig_ui_pitchipoy_template.py b/rigify/legacy/rig_ui_pitchipoy_template.py index 2e64b7434d1e198441e4a1c9f59d451caf7d23e1..2b4ef36c943d08945675fd564cc2c6787b54cb07 100644 --- a/rigify/legacy/rig_ui_pitchipoy_template.py +++ b/rigify/legacy/rig_ui_pitchipoy_template.py @@ -541,12 +541,7 @@ class Rigify_Arm_FK2IK(bpy.types.Operator): return (context.active_object != None and context.mode == 'POSE') def execute(self, context): - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False - try: - fk2ik_arm(context.active_object, fk=[self.uarm_fk, self.farm_fk, self.hand_fk], ik=[self.uarm_ik, self.farm_ik, self.hand_ik]) - finally: - context.preferences.edit.use_global_undo = use_global_undo + fk2ik_arm(context.active_object, fk=[self.uarm_fk, self.farm_fk, self.hand_fk], ik=[self.uarm_ik, self.farm_ik, self.hand_ik]) return {'FINISHED'} @@ -571,12 +566,7 @@ class Rigify_Arm_IK2FK(bpy.types.Operator): return (context.active_object != None and context.mode == 'POSE') def execute(self, context): - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False - try: - ik2fk_arm(context.active_object, fk=[self.uarm_fk, self.farm_fk, self.hand_fk], ik=[self.uarm_ik, self.farm_ik, self.hand_ik, self.pole]) - finally: - context.preferences.edit.use_global_undo = use_global_undo + ik2fk_arm(context.active_object, fk=[self.uarm_fk, self.farm_fk, self.hand_fk], ik=[self.uarm_ik, self.farm_ik, self.hand_ik, self.pole]) return {'FINISHED'} @@ -602,12 +592,7 @@ class Rigify_Leg_FK2IK(bpy.types.Operator): return (context.active_object != None and context.mode == 'POSE') def execute(self, context): - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False - try: - fk2ik_leg(context.active_object, fk=[self.thigh_fk, self.shin_fk, self.foot_fk, self.mfoot_fk], ik=[self.thigh_ik, self.shin_ik, self.foot_ik, self.mfoot_ik]) - finally: - context.preferences.edit.use_global_undo = use_global_undo + fk2ik_leg(context.active_object, fk=[self.thigh_fk, self.shin_fk, self.foot_fk, self.mfoot_fk], ik=[self.thigh_ik, self.shin_ik, self.foot_ik, self.mfoot_ik]) return {'FINISHED'} @@ -635,12 +620,7 @@ class Rigify_Leg_IK2FK(bpy.types.Operator): return (context.active_object != None and context.mode == 'POSE') def execute(self, context): - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False - try: - ik2fk_leg(context.active_object, fk=[self.thigh_fk, self.shin_fk, self.mfoot_fk, self.foot_fk], ik=[self.thigh_ik, self.shin_ik, self.foot_ik, self.footroll, self.pole, self.mfoot_ik]) - finally: - context.preferences.edit.use_global_undo = use_global_undo + ik2fk_leg(context.active_object, fk=[self.thigh_fk, self.shin_fk, self.mfoot_fk, self.foot_fk], ik=[self.thigh_ik, self.shin_ik, self.foot_ik, self.footroll, self.pole, self.mfoot_ik]) return {'FINISHED'} diff --git a/rigify/legacy/rig_ui_template.py b/rigify/legacy/rig_ui_template.py index 5f38400695020525ce34c3f15802fadf1f886ad7..6cdd1c635524f35366bdb981028e3cfede308df0 100644 --- a/rigify/legacy/rig_ui_template.py +++ b/rigify/legacy/rig_ui_template.py @@ -389,12 +389,7 @@ class Rigify_Arm_FK2IK(bpy.types.Operator): return (context.active_object is not None and context.mode == 'POSE') def execute(self, context): - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False - try: - fk2ik_arm(context.active_object, fk=[self.uarm_fk, self.farm_fk, self.hand_fk], ik=[self.uarm_ik, self.farm_ik, self.hand_ik]) - finally: - context.preferences.edit.use_global_undo = use_global_undo + fk2ik_arm(context.active_object, fk=[self.uarm_fk, self.farm_fk, self.hand_fk], ik=[self.uarm_ik, self.farm_ik, self.hand_ik]) return {'FINISHED'} @@ -419,12 +414,7 @@ class Rigify_Arm_IK2FK(bpy.types.Operator): return (context.active_object is not None and context.mode == 'POSE') def execute(self, context): - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False - try: - ik2fk_arm(context.active_object, fk=[self.uarm_fk, self.farm_fk, self.hand_fk], ik=[self.uarm_ik, self.farm_ik, self.hand_ik, self.pole]) - finally: - context.preferences.edit.use_global_undo = use_global_undo + ik2fk_arm(context.active_object, fk=[self.uarm_fk, self.farm_fk, self.hand_fk], ik=[self.uarm_ik, self.farm_ik, self.hand_ik, self.pole]) return {'FINISHED'} @@ -450,12 +440,7 @@ class Rigify_Leg_FK2IK(bpy.types.Operator): return (context.active_object is not None and context.mode == 'POSE') def execute(self, context): - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False - try: - fk2ik_leg(context.active_object, fk=[self.thigh_fk, self.shin_fk, self.foot_fk, self.mfoot_fk], ik=[self.thigh_ik, self.shin_ik, self.foot_ik, self.mfoot_ik]) - finally: - context.preferences.edit.use_global_undo = use_global_undo + fk2ik_leg(context.active_object, fk=[self.thigh_fk, self.shin_fk, self.foot_fk, self.mfoot_fk], ik=[self.thigh_ik, self.shin_ik, self.foot_ik, self.mfoot_ik]) return {'FINISHED'} @@ -482,12 +467,7 @@ class Rigify_Leg_IK2FK(bpy.types.Operator): return (context.active_object is not None and context.mode == 'POSE') def execute(self, context): - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False - try: - ik2fk_leg(context.active_object, fk=[self.thigh_fk, self.shin_fk, self.mfoot_fk], ik=[self.thigh_ik, self.shin_ik, self.foot_ik, self.footroll, self.pole, self.mfoot_ik]) - finally: - context.preferences.edit.use_global_undo = use_global_undo + ik2fk_leg(context.active_object, fk=[self.thigh_fk, self.shin_fk, self.mfoot_fk], ik=[self.thigh_ik, self.shin_ik, self.foot_ik, self.footroll, self.pole, self.mfoot_ik]) return {'FINISHED'} diff --git a/rigify/legacy/ui.py b/rigify/legacy/ui.py index 157b451c8d4212d948d7cf989ac1ae9fc6054d3c..1cc0c0eb6ce1f1bab23347eba4237dcd8ad51ef1 100644 --- a/rigify/legacy/ui.py +++ b/rigify/legacy/ui.py @@ -284,14 +284,10 @@ class Generate(bpy.types.Operator): import importlib importlib.reload(generate) - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False try: generate.generate_rig(context, context.object) except MetarigError as rig_exception: rigify_report_exception(self, rig_exception) - finally: - context.preferences.edit.use_global_undo = use_global_undo return {'FINISHED'} @@ -312,8 +308,6 @@ class Sample(bpy.types.Operator): def execute(self, context): if context.mode == 'EDIT_ARMATURE' and self.metarig_type != "": - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False try: rig = get_rig_type(self.metarig_type) create_sample = rig.create_sample @@ -322,7 +316,6 @@ class Sample(bpy.types.Operator): else: create_sample(context.active_object) finally: - context.preferences.edit.use_global_undo = use_global_undo bpy.ops.object.mode_set(mode='EDIT') return {'FINISHED'} diff --git a/rigify/rig_ui_template.py b/rigify/rig_ui_template.py index 6cd46f6a6a46aaece12dbb514e1a43f9cec628eb..cebed827c532eae8d3debe29e96fc463de1c4fc2 100644 --- a/rigify/rig_ui_template.py +++ b/rigify/rig_ui_template.py @@ -638,12 +638,7 @@ class Rigify_Arm_FK2IK(bpy.types.Operator): return (context.active_object != None and context.mode == 'POSE') def execute(self, context): - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False - try: - fk2ik_arm(context.active_object, fk=[self.uarm_fk, self.farm_fk, self.hand_fk], ik=[self.uarm_ik, self.farm_ik, self.hand_ik]) - finally: - context.preferences.edit.use_global_undo = use_global_undo + fk2ik_arm(context.active_object, fk=[self.uarm_fk, self.farm_fk, self.hand_fk], ik=[self.uarm_ik, self.farm_ik, self.hand_ik]) return {'FINISHED'} @@ -670,12 +665,7 @@ class Rigify_Arm_IK2FK(bpy.types.Operator): return (context.active_object != None and context.mode == 'POSE') def execute(self, context): - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False - try: - ik2fk_arm(context.active_object, fk=[self.uarm_fk, self.farm_fk, self.hand_fk], ik=[self.uarm_ik, self.farm_ik, self.hand_ik, self.pole, self.main_parent]) - finally: - context.preferences.edit.use_global_undo = use_global_undo + ik2fk_arm(context.active_object, fk=[self.uarm_fk, self.farm_fk, self.hand_fk], ik=[self.uarm_ik, self.farm_ik, self.hand_ik, self.pole, self.main_parent]) return {'FINISHED'} '''] @@ -708,12 +698,7 @@ class Rigify_Leg_FK2IK(bpy.types.Operator): return (context.active_object != None and context.mode == 'POSE') def execute(self, context): - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False - try: - fk2ik_leg(context.active_object, fk=[self.thigh_fk, self.shin_fk, self.foot_fk, self.mfoot_fk], ik=[self.thigh_ik, self.shin_ik, self.foot_ik, self.mfoot_ik]) - finally: - context.preferences.edit.use_global_undo = use_global_undo + fk2ik_leg(context.active_object, fk=[self.thigh_fk, self.shin_fk, self.foot_fk, self.mfoot_fk], ik=[self.thigh_ik, self.shin_ik, self.foot_ik, self.mfoot_ik]) return {'FINISHED'} @@ -742,12 +727,7 @@ class Rigify_Leg_IK2FK(bpy.types.Operator): return (context.active_object != None and context.mode == 'POSE') def execute(self, context): - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False - try: - ik2fk_leg(context.active_object, fk=[self.thigh_fk, self.shin_fk, self.mfoot_fk, self.foot_fk], ik=[self.thigh_ik, self.shin_ik, self.foot_ik, self.footroll, self.pole, self.mfoot_ik, self.main_parent]) - finally: - context.preferences.edit.use_global_undo = use_global_undo + ik2fk_leg(context.active_object, fk=[self.thigh_fk, self.shin_fk, self.mfoot_fk, self.foot_fk], ik=[self.thigh_ik, self.shin_ik, self.foot_ik, self.footroll, self.pole, self.mfoot_ik, self.main_parent]) return {'FINISHED'} '''] diff --git a/rigify/ui.py b/rigify/ui.py index c3c9f07d381bc75e6f95e6c8372674a009a8a779..0ec387917a36f8a8c01f59fb369a0cc096fe1896 100644 --- a/rigify/ui.py +++ b/rigify/ui.py @@ -755,14 +755,10 @@ class Generate(bpy.types.Operator): import importlib importlib.reload(generate) - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False try: generate.generate_rig(context, context.object) except MetarigError as rig_exception: rigify_report_exception(self, rig_exception) - finally: - context.preferences.edit.use_global_undo = use_global_undo return {'FINISHED'} @@ -813,8 +809,6 @@ class Sample(bpy.types.Operator): def execute(self, context): if context.mode == 'EDIT_ARMATURE' and self.metarig_type != "": - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False try: rig = rig_lists.rigs[self.metarig_type]["module"] create_sample = rig.create_sample @@ -823,7 +817,6 @@ class Sample(bpy.types.Operator): else: create_sample(context.active_object) finally: - context.preferences.edit.use_global_undo = use_global_undo bpy.ops.object.mode_set(mode='EDIT') return {'FINISHED'} @@ -1280,8 +1273,6 @@ class OBJECT_OT_ClearAnimation(bpy.types.Operator): def execute(self, context): - use_global_undo = context.preferences.edit.use_global_undo - context.preferences.edit.use_global_undo = False try: rig = context.object scn = context.scene @@ -1292,8 +1283,6 @@ class OBJECT_OT_ClearAnimation(bpy.types.Operator): return {'FINISHED'} clearAnimation(act, self.anim_type, names=get_limb_generated_names(rig)) - finally: - context.preferences.edit.use_global_undo = use_global_undo return {'FINISHED'}