[Bf-extensions-cvs] [2829c040] master: T94008, T94292 Check before, if the user is in the 'EDIT_MESH' mode. If so, change to 'OBJECT' mode.
Clemens Barth
noreply at git.blender.org
Thu Jan 13 19:07:37 CET 2022
Commit: 2829c040f4886e5eb281bd9ce1a2bb747755330f
Author: Clemens Barth
Date: Thu Jan 13 19:06:10 2022 +0100
Branches: master
https://developer.blender.org/rBA2829c040f4886e5eb281bd9ce1a2bb747755330f
T94008, T94292
Check before, if the user is in the 'EDIT_MESH' mode. If so, change to 'OBJECT' mode.
===================================================================
M io_mesh_atomic/pdb_gui.py
M io_mesh_atomic/xyz_gui.py
===================================================================
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[:]
More information about the Bf-extensions-cvs
mailing list