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:
authorClemens Barth <barth@root-1.de>2022-01-13 21:06:10 +0300
committerClemens Barth <barth@root-1.de>2022-01-13 21:06:10 +0300
commit2829c040f4886e5eb281bd9ce1a2bb747755330f (patch)
treecafb9291de86a49bc5a18b5638000e452c573736 /io_mesh_atomic
parent8372ef96ade7a6ec64ef328c0c84c89f9352d493 (diff)
T94008, T94292
Check before, if the user is in the 'EDIT_MESH' mode. If so, change to 'OBJECT' mode.
Diffstat (limited to 'io_mesh_atomic')
-rw-r--r--io_mesh_atomic/pdb_gui.py5
-rw-r--r--io_mesh_atomic/xyz_gui.py5
2 files changed, 6 insertions, 4 deletions
diff --git a/io_mesh_atomic/pdb_gui.py b/io_mesh_atomic/pdb_gui.py
index f77e2ef4..711053d7 100644
--- a/io_mesh_atomic/pdb_gui.py
+++ b/io_mesh_atomic/pdb_gui.py
@@ -203,8 +203,9 @@ class IMPORT_OT_pdb(Operator, ImportHelper):
def execute(self, context):
- # To be on the safe side, we switch to the 'OBJECT' mode.
- bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+ # Switch to 'OBJECT' mode when in 'EDIT' mode.
+ if bpy.context.mode == 'EDIT_MESH':
+ bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
# This is in order to solve this strange 'relative path' thing.
filepath_pdb = bpy.path.abspath(self.filepath)
diff --git a/io_mesh_atomic/xyz_gui.py b/io_mesh_atomic/xyz_gui.py
index 18df0063..e465c4c2 100644
--- a/io_mesh_atomic/xyz_gui.py
+++ b/io_mesh_atomic/xyz_gui.py
@@ -153,8 +153,9 @@ class IMPORT_OT_xyz(Operator, ImportHelper):
col.prop(self, "images_per_key")
def execute(self, context):
- # To be on the safe side, we switch to the 'OBJECT' mode.
- bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+ # Switch to 'OBJECT' mode when in 'EDIT' mode.
+ if bpy.context.mode == 'EDIT_MESH':
+ bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
del ALL_FRAMES[:]
del ELEMENTS[:]