[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3041] trunk/py/scripts/addons/ io_mesh_pdb:
Clemens Barth
barth at root-1.de
Wed Feb 29 00:31:25 CET 2012
Revision: 3041
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3041
Author: blendphys
Date: 2012-02-28 23:31:19 +0000 (Tue, 28 Feb 2012)
Log Message:
-----------
Exporter
- Either active objects with a proper element name or all active objects are
exported depending on EnumProperty in File dialog: all <-> element
- Removed a bug in the exporter: 'import_pdb.ATOM_PDB_ELEMENTS_DEFAULT' is
used instead of 'import_pdb.ATOM_PDB_ELEMENTS' <= is sometimes empty list
Importer
- The name of the representive ball of a dupliverts technique is now shorter:
from 'Ball (NURBS)_<element>' to 'Ball_<element>'; The name of the element
is not cut in the outliner.
Blendphys
Modified Paths:
--------------
trunk/py/scripts/addons/io_mesh_pdb/__init__.py
trunk/py/scripts/addons/io_mesh_pdb/export_pdb.py
trunk/py/scripts/addons/io_mesh_pdb/import_pdb.py
Modified: trunk/py/scripts/addons/io_mesh_pdb/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_pdb/__init__.py 2012-02-28 22:52:25 UTC (rev 3040)
+++ trunk/py/scripts/addons/io_mesh_pdb/__init__.py 2012-02-28 23:31:19 UTC (rev 3041)
@@ -194,7 +194,7 @@
scnn.atom_pdb_radius_how,
)
- # In the file dialog window
+ # In the file dialog window - Import
scn = bpy.types.Scene
scn.use_atom_pdb_cam = BoolProperty(
name="Camera", default=False,
@@ -249,6 +249,14 @@
('2', "van der Waals", "Use van der Waals radius")),
default='0',)
+ # In the file dialog window - Export
+ scn.atom_pdb_export_type = EnumProperty(
+ name="Type of Objects",
+ description="Choose type of objects",
+ items=(('0', "All", "Export all active objects"),
+ ('1', "Elements", "Export only those active objects which have a proper element name")),
+ default='1',)
+
# In the panel
scn.atom_pdb_datafile = StringProperty(
name = "", description="Path to your custom data file",
@@ -612,12 +620,15 @@
layout = self.layout
scn = bpy.context.scene
+ row = layout.row()
+ row.prop(scn, "atom_pdb_export_type")
+
def execute(self, context):
scn = bpy.context.scene
# This is in order to solve this strange 'relative path' thing.
export_pdb.ATOM_PDB_FILEPATH = bpy.path.abspath(self.filepath)
- export_pdb.DEF_atom_pdb_export()
+ export_pdb.DEF_atom_pdb_export(scn.atom_pdb_export_type)
return {'FINISHED'}
Modified: trunk/py/scripts/addons/io_mesh_pdb/export_pdb.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_pdb/export_pdb.py 2012-02-28 22:52:25 UTC (rev 3040)
+++ trunk/py/scripts/addons/io_mesh_pdb/export_pdb.py 2012-02-28 23:31:19 UTC (rev 3041)
@@ -25,7 +25,7 @@
#
# Start of project : 2011-08-31 by Clemens Barth
# First publication in Blender : 2011-11-11
-# Last modified : 2012-02-27
+# Last modified : 2012-02-29
#
# Acknowledgements: Thanks to ideasman, meta_androcto, truman, kilon,
# dairin0d, PKHG, Valter, etc
@@ -61,7 +61,7 @@
-def DEF_atom_pdb_export():
+def DEF_atom_pdb_export(obj_type):
list_atoms = []
for obj in bpy.context.selected_objects:
@@ -71,27 +71,37 @@
if obj.type != "SURFACE" and obj.type != "MESH":
continue
-
- for element in import_pdb.ATOM_PDB_ELEMENTS:
- if element.name in obj.name:
- if element.short_name == "Vac":
+
+ name = ""
+ for element in import_pdb.ATOM_PDB_ELEMENTS_DEFAULT:
+ if element[1] in obj.name:
+ if element[2] == "Vac":
name = "X"
else:
- name = element.short_name
+ name = element[2]
+ elif element[1][:3] in obj.name:
+ if element[2] == "Vac":
+ name = "X"
+ else:
+ name = element[2]
+
+ if name == "":
+ if obj_type == "0":
+ name = "?"
+ else:
+ continue
- if len(obj.children) != 0:
- for vertex in obj.data.vertices:
- list_atoms.append(CLASS_atom_pdb_atoms_export(
+ if len(obj.children) != 0:
+ for vertex in obj.data.vertices:
+ list_atoms.append(CLASS_atom_pdb_atoms_export(
name,
obj.location+vertex.co))
-
- else:
- if not obj.parent:
- list_atoms.append(CLASS_atom_pdb_atoms_export(
+ else:
+ if not obj.parent:
+ list_atoms.append(CLASS_atom_pdb_atoms_export(
name,
obj.location))
-
-
+
pdb_file_p = open(ATOM_PDB_FILEPATH, "w")
pdb_file_p.write(ATOM_PDB_PDBTEXT)
Modified: trunk/py/scripts/addons/io_mesh_pdb/import_pdb.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_pdb/import_pdb.py 2012-02-28 22:52:25 UTC (rev 3040)
+++ trunk/py/scripts/addons/io_mesh_pdb/import_pdb.py 2012-02-28 23:31:19 UTC (rev 3041)
@@ -25,7 +25,7 @@
#
# Start of project : 2011-08-31 by Clemens Barth
# First publication in Blender : 2011-11-11
-# Last modified : 2012-02-27
+# Last modified : 2012-02-29
#
# Acknowledgements: Thanks to ideasman, meta_androcto, truman, kilon,
# dairin0d, PKHG, Valter, etc
@@ -1170,7 +1170,7 @@
if atom[0] == "Vacancy":
ball.name = "Cube_"+atom[0]
else:
- ball.name = "Ball (NURBS)_"+atom[0]
+ ball.name = "Ball_"+atom[0]
ball.active_material = atom[1]
ball.parent = new_atom_mesh
new_atom_mesh.dupli_type = 'VERTS'
More information about the Bf-extensions-cvs
mailing list