diff options
author | Vladimir Spivak(cwolf3d) <cwolf3d@gmail.com> | 2020-05-03 19:55:52 +0300 |
---|---|---|
committer | Vladimir Spivak(cwolf3d) <cwolf3d@gmail.com> | 2020-05-03 19:55:52 +0300 |
commit | 2d8edd6dedc8dae2f5ac9afa2cbb867373c476ed (patch) | |
tree | 2a4b13f36e3e279c459c56ab4695b44864662200 /add_mesh_extra_objects/add_mesh_round_cube.py | |
parent | ba2aed9efbdbbd1d6b06124fefa914cc588a6eec (diff) |
Fix T76049: Errors after adding a Gear or Worm (extra objects)
Diffstat (limited to 'add_mesh_extra_objects/add_mesh_round_cube.py')
-rw-r--r-- | add_mesh_extra_objects/add_mesh_round_cube.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/add_mesh_extra_objects/add_mesh_round_cube.py b/add_mesh_extra_objects/add_mesh_round_cube.py index 3be67b5b..3c261908 100644 --- a/add_mesh_extra_objects/add_mesh_round_cube.py +++ b/add_mesh_extra_objects/add_mesh_round_cube.py @@ -388,6 +388,10 @@ class AddRoundCube(Operator, object_utils.AddObjectHelper): ) 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 self.arc_div <= 0 and self.lin_div <= 0: self.report({'ERROR'}, "Either Arc Divisions or Linear Divisions must be greater than zero") @@ -441,6 +445,12 @@ class AddRoundCube(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 check(self, context): |