[Bf-extensions-cvs] [158b8587] master: T94008, T94292 When importing a PDB file, the user has to be in the 'OBJECT' mode. With the changes in the code, this mode is automatically set before the PDB import. No error message should appear when the 'EDIT' mode is still active.

Clemens Barth noreply at git.blender.org
Thu Jan 13 18:00:02 CET 2022


Commit: 158b85876a0e8410db2e009f4fc324bb049089aa
Author: Clemens Barth
Date:   Thu Jan 13 17:59:01 2022 +0100
Branches: master
https://developer.blender.org/rBA158b85876a0e8410db2e009f4fc324bb049089aa

T94008, T94292
When importing a PDB file, the user has to be in the 'OBJECT' mode. With the changes
in the code, this mode is automatically set before the PDB import. No error message
should appear when the 'EDIT' mode is still active.

===================================================================

M	io_mesh_atomic/pdb_gui.py

===================================================================

diff --git a/io_mesh_atomic/pdb_gui.py b/io_mesh_atomic/pdb_gui.py
index 00a4ca97..f77e2ef4 100644
--- a/io_mesh_atomic/pdb_gui.py
+++ b/io_mesh_atomic/pdb_gui.py
@@ -203,6 +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)
+
         # This is in order to solve this strange 'relative path' thing.
         filepath_pdb = bpy.path.abspath(self.filepath)



More information about the Bf-extensions-cvs mailing list