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:
authorVladimir Spivak(cwolf3d) <cwolf3d@gmail.com>2020-05-03 19:55:52 +0300
committerVladimir Spivak(cwolf3d) <cwolf3d@gmail.com>2020-05-03 19:55:52 +0300
commit2d8edd6dedc8dae2f5ac9afa2cbb867373c476ed (patch)
tree2a4b13f36e3e279c459c56ab4695b44864662200 /add_mesh_extra_objects/add_mesh_gemstones.py
parentba2aed9efbdbbd1d6b06124fefa914cc588a6eec (diff)
Fix T76049: Errors after adding a Gear or Worm (extra objects)
Diffstat (limited to 'add_mesh_extra_objects/add_mesh_gemstones.py')
-rw-r--r--add_mesh_extra_objects/add_mesh_gemstones.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/add_mesh_extra_objects/add_mesh_gemstones.py b/add_mesh_extra_objects/add_mesh_gemstones.py
index 5829794b..c47e4131 100644
--- a/add_mesh_extra_objects/add_mesh_gemstones.py
+++ b/add_mesh_extra_objects/add_mesh_gemstones.py
@@ -278,6 +278,9 @@ class AddDiamond(Operator, object_utils.AddObjectHelper):
box.prop(self, 'rotation', expand=True)
def execute(self, context):
+ # 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
if bpy.context.mode == "OBJECT":
if context.selected_objects != [] and context.active_object and \
@@ -333,6 +336,12 @@ class AddDiamond(Operator, object_utils.AddObjectHelper):
context.active_object.name = name_active_object
bpy.ops.object.mode_set(mode='EDIT')
+ if use_enter_edit_mode:
+ bpy.ops.object.mode_set(mode = 'EDIT')
+
+ # restore pre operator state
+ bpy.context.preferences.edit.use_enter_edit_mode = use_enter_edit_mode
+
return {'FINISHED'}
def DiamondParameters():
@@ -417,6 +426,9 @@ class AddGem(Operator, object_utils.AddObjectHelper):
box.prop(self, 'rotation', expand=True)
def execute(self, context):
+ # 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
if bpy.context.mode == "OBJECT":
if context.selected_objects != [] and context.active_object and \
@@ -472,6 +484,12 @@ class AddGem(Operator, object_utils.AddObjectHelper):
context.active_object.name = name_active_object
bpy.ops.object.mode_set(mode='EDIT')
+ if use_enter_edit_mode:
+ bpy.ops.object.mode_set(mode = 'EDIT')
+
+ # restore pre operator state
+ bpy.context.preferences.edit.use_enter_edit_mode = use_enter_edit_mode
+
return {'FINISHED'}
def GemParameters():