From 08c946b80c30766fc658c1da3116c435e6cab978 Mon Sep 17 00:00:00 2001
From: Clemens Barth <barth@root-1.de>
Date: Sun, 14 Oct 2012 07:56:01 +0000
Subject: [PATCH] When exporting structures from Blender into a PDB file it
 happened sometimes that the xyz positions of the atoms weren't correctly
 stored. Bug fixed.

---
 io_mesh_pdb/__init__.py   | 2 +-
 io_mesh_pdb/export_pdb.py | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/io_mesh_pdb/__init__.py b/io_mesh_pdb/__init__.py
index 206dd2187..580fffa08 100644
--- a/io_mesh_pdb/__init__.py
+++ b/io_mesh_pdb/__init__.py
@@ -25,7 +25,7 @@
 #
 #  Start of project              : 2011-08-31 by Clemens Barth
 #  First publication in Blender  : 2011-11-11
-#  Last modified                 : 2012-10-13
+#  Last modified                 : 2012-10-14
 #
 #  Acknowledgements: Thanks to ideasman, meta_androcto, truman, kilon,
 #  dairin0d, PKHG, Valter, etc
diff --git a/io_mesh_pdb/export_pdb.py b/io_mesh_pdb/export_pdb.py
index a7a67bf64..e211f19a5 100644
--- a/io_mesh_pdb/export_pdb.py
+++ b/io_mesh_pdb/export_pdb.py
@@ -74,14 +74,16 @@ def DEF_atom_pdb_export(obj_type):
 
         if len(obj.children) != 0:
             for vertex in obj.data.vertices:
+                location = obj.matrix_world*vertex.co
                 list_atoms.append(CLASS_atom_pdb_atoms_export(
                                                        name,
-                                                       obj.location+vertex.co))
+                                                       location))
         else:
             if not obj.parent:
+                location = obj.location
                 list_atoms.append(CLASS_atom_pdb_atoms_export(
                                                        name,
-                                                       obj.location))
+                                                       location))
 
     pdb_file_p = open(ATOM_PDB_FILEPATH, "w")
     pdb_file_p.write(ATOM_PDB_PDBTEXT)
-- 
GitLab