diff options
author | Clemens Barth <barth@root-1.de> | 2013-04-04 21:21:55 +0400 |
---|---|---|
committer | Clemens Barth <barth@root-1.de> | 2013-04-04 21:21:55 +0400 |
commit | 2e3a36f98d6e5990f822aaf4d44b2fb7f1b5d8d0 (patch) | |
tree | 326c65a1ed3a8373597f1a342d46004e9417a7c6 /io_mesh_pdb/__init__.py | |
parent | b62c8e57401445f9411e0da76f1f55f252ae4d1e (diff) |
1. After importing a structure, the sticks were not selected: fixed
2. Small cleanups of the code
3. New feature: The sticks can be represented as entire cylinders. One can
choose either single cylinders, which are parented to an empty, or one single
mesh object including all sticks.
This feature is quite suitable for structures, which count more than 1000
sticks. When the sticks are represented by one single mesh object the
handling in the 3D scene is much faster.
Note that the layout of the preferences in the file dialog had to be also
changed since there are more options for sticks now.
Blendphys.
Diffstat (limited to 'io_mesh_pdb/__init__.py')
-rw-r--r-- | io_mesh_pdb/__init__.py | 107 |
1 files changed, 67 insertions, 40 deletions
diff --git a/io_mesh_pdb/__init__.py b/io_mesh_pdb/__init__.py index 19c7c4a4..1d2a7cec 100644 --- a/io_mesh_pdb/__init__.py +++ b/io_mesh_pdb/__init__.py @@ -24,21 +24,23 @@ # # Start of project : 2011-08-31 by Clemens Barth # First publication in Blender : 2011-11-11 -# Last modified : 2013-03-22 +# Last modified : 2013-04-04 # # Acknowledgements # ================ -# # Blender: ideasman, meta_androcto, truman, kilon, CoDEmanX, dairin0d, PKHG, # Valter, ... -# Other: Frank Palmino +# Other : Frank Palmino +# +# +# To do: 1. Sticks in normal representation: options bonds and colors # bl_info = { "name": "Atomic Blender - PDB", "description": "Loading and manipulating atoms from PDB files", "author": "Clemens Barth", - "version": (1, 6), + "version": (1, 7), "blender": (2, 60, 0), "location": "File -> Import -> PDB (.pdb)", "warning": "", @@ -73,6 +75,9 @@ class ImportPDB(Operator, ImportHelper): filename_ext = ".pdb" filter_glob = StringProperty(default="*.pdb", options={'HIDDEN'},) + use_center = BoolProperty( + name = "Object to origin", default=True, + description = "Put the object into the global origin") use_camera = BoolProperty( name="Camera", default=False, description="Do you need a camera?") @@ -99,7 +104,7 @@ class ImportPDB(Operator, ImportHelper): name = "Distances", default=1.0, min=0.0001, description = "Scale factor for all distances") atomradius = EnumProperty( - name="Type of radius", + name="Type", description="Choose type of atom radius", items=(('0', "Pre-defined", "Use pre-defined radius"), ('1', "Atomic", "Use atomic radius"), @@ -107,10 +112,14 @@ class ImportPDB(Operator, ImportHelper): default='0',) use_sticks = BoolProperty( name="Use sticks", default=True, - description="Do you want to display the sticks?") - use_sticks_skin = BoolProperty( - name="Use skin modifier", default=False, - description="Do you want to display the sticks with the skin modifier?") + description="Do you want to display the sticks?") + use_sticks_type = EnumProperty( + name="Type", + description="Choose type of stick", + items=(('0', "Dupliverts", "Use dupliverts structures"), + ('1', "Skin", "Use skin and subdivision modifier"), + ('2', "Normal", "Use simple cylinders")), + default='0',) sticks_subdiv_view = IntProperty( name = "SubDivV", default=2, min=1, description="Number of subdivisions (view)") @@ -136,11 +145,14 @@ class ImportPDB(Operator, ImportHelper): name="Bonds", default=False, description="Show double and tripple bonds.") sticks_dist = FloatProperty( - name="Distance", default = 1.1, min=1.0, max=3.0, - description="Distance between sticks measured in stick diameter") - use_center = BoolProperty( - name = "Object to origin", default=True, - description = "Put the object into the global origin") + name="", default = 1.1, min=1.0, max=3.0, + description="Distance between sticks measured in stick diameter") + use_sticks_one_object = BoolProperty( + name="One object", default=True, + description="All sticks are one object.") + use_sticks_one_object_nr = IntProperty( + name = "No.", default=200, min=10, + description="Number of sticks to be grouped at once") datafile = StringProperty( name = "", description="Path to your custom data file", maxlen = 256, default = "", subtype='FILE_PATH') @@ -151,58 +163,71 @@ class ImportPDB(Operator, ImportHelper): row.prop(self, "use_camera") row.prop(self, "use_lamp") row = layout.row() - row.prop(self, "use_center") - row = layout.row() + row.prop(self, "use_center") + # Balls + box = layout.box() + row = box.row() + row.label(text="Balls / atoms") + row = box.row() col = row.column() col.prop(self, "ball") - row = layout.row() + row = box.row() row.active = (self.ball == "1") col = row.column(align=True) col.prop(self, "mesh_azimuth") col.prop(self, "mesh_zenith") - row = layout.row() + row = box.row() col = row.column() col.label(text="Scaling factors") col = row.column(align=True) col.prop(self, "scale_ballradius") col.prop(self, "scale_distances") - row = layout.row() + row = box.row() row.prop(self, "atomradius") - row = layout.row() - # Sticks + # Sticks + box = layout.box() + row = box.row() + row.label(text="Sticks / bonds") + row = box.row() row.prop(self, "use_sticks") - row = layout.row() + row = box.row() row.active = self.use_sticks - row.prop(self, "use_sticks_skin") - row = layout.row() + row.prop(self, "use_sticks_type") + row = box.row() row.active = self.use_sticks col = row.column() - if not self.use_sticks_skin: + if self.use_sticks_type == '0' or self.use_sticks_type == '2': col.prop(self, "sticks_sectors") col.prop(self, "sticks_radius") - if self.use_sticks_skin: - row = layout.row() + if self.use_sticks_type == '1': + row = box.row() row.active = self.use_sticks row.prop(self, "sticks_subdiv_view") row.prop(self, "sticks_subdiv_render") - row = layout.row() + row = box.row() row.active = self.use_sticks - if not self.use_sticks_skin: + if self.use_sticks_type == '0': col.prop(self, "sticks_unit_length") col = row.column(align=True) - if not self.use_sticks_skin: + if self.use_sticks_type == '0': col.prop(self, "use_sticks_color") col.prop(self, "use_sticks_smooth") - if not self.use_sticks_skin: + if self.use_sticks_type == '0' or self.use_sticks_type == '2': col.prop(self, "use_sticks_bonds") - row = layout.row() - row.active = self.use_sticks - col = row.column(align=True) - col = row.column(align=True) - col.active = self.use_sticks - if not self.use_sticks_skin: - col.prop(self, "sticks_dist") - + row = box.row() + if self.use_sticks_type == '0': + row.active = self.use_sticks and self.use_sticks_bonds + row.label(text="Distance") + row.prop(self, "sticks_dist") + if self.use_sticks_type == '2': + row.active = self.use_sticks + col = row.column() + col.prop(self, "use_sticks_one_object") + col = row.column() + col.active = self.use_sticks_one_object + col.prop(self, "use_sticks_one_object_nr") + + def execute(self, context): # This is in order to solve this strange 'relative path' thing. filepath_pdb = bpy.path.abspath(self.filepath) @@ -216,12 +241,14 @@ class ImportPDB(Operator, ImportHelper): self.atomradius, self.scale_distances, self.use_sticks, - self.use_sticks_skin, + self.use_sticks_type, self.sticks_subdiv_view, self.sticks_subdiv_render, self.use_sticks_color, self.use_sticks_smooth, self.use_sticks_bonds, + self.use_sticks_one_object, + self.use_sticks_one_object_nr, self.sticks_unit_length, self.sticks_dist, self.sticks_sectors, |