[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2638] contrib/py/scripts/addons/ io_import_pdb_atomic_blender.py: Only a few but important changes:

Clemens Barth barth at root-1.de
Sun Nov 20 22:50:03 CET 2011


Revision: 2638
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2638
Author:   blendphys
Date:     2011-11-20 21:50:02 +0000 (Sun, 20 Nov 2011)
Log Message:
-----------
Only a few but important changes:
When changing the radii of the atoms, 'bpy.data.objects' has been used
to find the atoms via name comparison. I replaced this by 
'bpy.context.scene.objects'. Now, the radii of only those atoms are changed, 
which are in the considered scene. The atoms in all the other scenes remain
unchanged.

I plan now to use dupligroups (dublication by vertices) which is much
faster and, to some extend, more convinient. Let's see.

Nevertheless, the actual manuscript is completely sufficient to load any PDB file, it
should be okay. (tested with some 20-30 PDB files of different origin).

Cheers,

Blendphys.

Modified Paths:
--------------
    contrib/py/scripts/addons/io_import_pdb_atomic_blender.py

Modified: contrib/py/scripts/addons/io_import_pdb_atomic_blender.py
===================================================================
--- contrib/py/scripts/addons/io_import_pdb_atomic_blender.py	2011-11-20 18:27:22 UTC (rev 2637)
+++ contrib/py/scripts/addons/io_import_pdb_atomic_blender.py	2011-11-20 21:50:02 UTC (rev 2638)
@@ -1,5 +1,5 @@
+# 
 #
-#
 #  Authors           : Clemens Barth (Blendphys at root-1.de), ...
 #
 #  Homepage(Wiki)    : http://development.root-1.de/Atomic_Blender.php
@@ -7,7 +7,7 @@
 #
 #  Start of project              : 2011-08-31 by Clemens Barth
 #  First publication in Blender  : 2011-11-11
-#  Last modified                 : 2011-11-20
+#  Last modified                 : 2011-11-21
 #
 #
 # ##### BEGIN GPL LICENSE BLOCK #####
@@ -581,28 +581,28 @@
 # Routine to modify the radii of a specific type of atom
 def Modify_atom_radii_type_pm(atomname, radius_pm):
 
-    for obj in bpy.data.objects:
+    for obj in bpy.context.scene.objects:
 
         if atomname in obj.name:
 
-            bpy.data.objects[obj.name].scale = (radius_pm/100,radius_pm/100,radius_pm/100)
+            obj.scale = (radius_pm/100,radius_pm/100,radius_pm/100)
                 
 
 # Routine to modify the radii of a specific type of atom
 def Modify_atom_radii_type_scale(atomname, radius_rel):
 
-    for obj in bpy.data.objects:
+    for obj in bpy.context.scene.objects:
 
         if atomname in obj.name:
 
             value = obj.scale[0]
-            bpy.data.objects[obj.name].scale = (radius_rel * value,radius_rel * value,radius_rel * value)
+            obj.scale = (radius_rel * value,radius_rel * value,radius_rel * value)
 
 
 # Routine to scale the radii of all atoms
 def Modify_all_atom_radii(scale):
 
-    for obj in bpy.data.objects:
+    for obj in bpy.context.scene.objects:
 
         if obj.type == "SURFACE" or obj.type == "MESH":
 



More information about the Bf-extensions-cvs mailing list