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 /rigify/legacy
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 'rigify/legacy')
-rw-r--r--rigify/legacy/rig_ui_pitchipoy_template.py28
-rw-r--r--rigify/legacy/rig_ui_template.py28
-rw-r--r--rigify/legacy/ui.py7
3 files changed, 8 insertions, 55 deletions
diff --git a/rigify/legacy/rig_ui_pitchipoy_template.py b/rigify/legacy/rig_ui_pitchipoy_template.py
index 2e64b743..2b4ef36c 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 5f384006..6cdd1c63 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 157b451c..1cc0c0eb 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'}