Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClemens Barth <barth@root-1.de>2012-02-29 03:31:19 +0400
committerClemens Barth <barth@root-1.de>2012-02-29 03:31:19 +0400
commitbcb9be4475e42f850e0971c4b916f0d1046b8df3 (patch)
treef7223def09d23072e52245a09205a993aad41f20 /io_mesh_pdb
parent7708b9f7e0c6adfc8c2184dc9ae8bab0ef93784b (diff)
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
Diffstat (limited to 'io_mesh_pdb')
-rw-r--r--io_mesh_pdb/__init__.py15
-rw-r--r--io_mesh_pdb/export_pdb.py44
-rw-r--r--io_mesh_pdb/import_pdb.py4
3 files changed, 42 insertions, 21 deletions
diff --git a/io_mesh_pdb/__init__.py b/io_mesh_pdb/__init__.py
index a7552352..bed41f99 100644
--- a/io_mesh_pdb/__init__.py
+++ b/io_mesh_pdb/__init__.py
@@ -194,7 +194,7 @@ class CLASS_atom_pdb_IO(bpy.types.PropertyGroup):
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 @@ class CLASS_atom_pdb_IO(bpy.types.PropertyGroup):
('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 @@ class ExportPDB(Operator, ExportHelper):
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'}
diff --git a/io_mesh_pdb/export_pdb.py b/io_mesh_pdb/export_pdb.py
index 22d1f015..a23d0fd9 100644
--- a/io_mesh_pdb/export_pdb.py
+++ b/io_mesh_pdb/export_pdb.py
@@ -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 @@ class CLASS_atom_pdb_atoms_export(object):
-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 @@ def DEF_atom_pdb_export():
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
-
- if len(obj.children) != 0:
- for vertex in obj.data.vertices:
- list_atoms.append(CLASS_atom_pdb_atoms_export(
+ 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(
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)
diff --git a/io_mesh_pdb/import_pdb.py b/io_mesh_pdb/import_pdb.py
index 2491d4fc..1c2abe05 100644
--- a/io_mesh_pdb/import_pdb.py
+++ b/io_mesh_pdb/import_pdb.py
@@ -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 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
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'