[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2826] trunk/py/scripts/addons/ io_mesh_pdb:
Clemens Barth
barth at root-1.de
Fri Dec 30 21:30:14 CET 2011
Revision: 2826
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2826
Author: blendphys
Date: 2011-12-30 20:30:01 +0000 (Fri, 30 Dec 2011)
Log Message:
-----------
Dear all.
Here comes version 1.2 !
New
===
1. Double and tripple bonds can now be displayed. The option 'bonds' needs to be
checked. One can also choose the distance between the sticks.
2. If the bool 'smooth' is checked the shape of the sticks is more round.
Changes
=======
- Buttons, which depend on other buttons, are grayed out as soon as the
'master button' is deactivated.
- Other small bug fixes
With this version 1.2 I consider the PDB project as 'accomplished' so far.
Of course, I will keep an eye on any critics, changes, bug fixes and so on.
Please, let me know if you find any bugs. Thanks.
Happy New Year!
Blendphys
Modified Paths:
--------------
trunk/py/scripts/addons/io_mesh_pdb/__init__.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 2011-12-30 06:44:51 UTC (rev 2825)
+++ trunk/py/scripts/addons/io_mesh_pdb/__init__.py 2011-12-30 20:30:01 UTC (rev 2826)
@@ -20,7 +20,7 @@
"name": "PDB Atomic Blender",
"description": "Loading and manipulating atoms from PDB files",
"author": "Clemens Barth",
- "version": (1,1),
+ "version": (1,2),
"blender": (2,6),
"api": 31236,
"location": "File -> Import -> PDB (.pdb), Panel: View 3D - Tools",
@@ -58,24 +58,9 @@
#bl_context = "physics"
# This could be also an option ... :
bl_space_type = "VIEW_3D"
+ #bl_region_type = "TOOLS"
bl_region_type = "TOOL_PROPS"
- # This 'poll thing' has taken 3 hours of a hard search and understanding.
- # I explain it in the following from my point of view:
- #
- # Before this class is entirely treaten (here: drawing the panel) the
- # poll method is called first. Basically, some conditions are
- # checked before other things in the class are done afterwards. If a
- # condition is not valid, one returns 'False' such that nothing further
- # is done. 'True' means: 'Go on'
- #
- # In the case here, it is verified if the ATOM_PDB_FILEPATH variable contains
- # a name. If not - and this is the case directly after having started the
- # script - the panel does not appear because 'False' is returned. However,
- # as soon as a file has been chosen, the panel appears because
- # ATOM_PDB_FILEPATH contains a name.
- #
- # Please, correct me if I'm wrong.
@classmethod
def poll(self, context):
if import_pdb.ATOM_PDB_FILEPATH == "":
@@ -106,21 +91,36 @@
box = layout.box()
row = box.row()
- col = row.column(align=True)
+ col = row.column()
col.prop(scn, "use_atom_pdb_mesh")
+ col = row.column()
+ col.label(text="Scaling factors")
+ row = box.row()
+ col = row.column(align=True)
+ col.active = scn.use_atom_pdb_mesh
col.prop(scn, "atom_pdb_mesh_azimuth")
col.prop(scn, "atom_pdb_mesh_zenith")
col = row.column(align=True)
- col.label(text="Scaling factors")
col.prop(scn, "atom_pdb_scale_ballradius")
col.prop(scn, "atom_pdb_scale_distances")
row = box.row()
- col = row.column()
+ col = row.column()
col.prop(scn, "use_atom_pdb_sticks")
+ row = box.row()
+ row.active = scn.use_atom_pdb_sticks
col = row.column(align=True)
col.prop(scn, "atom_pdb_sticks_sectors")
col.prop(scn, "atom_pdb_sticks_radius")
+ col = row.column(align=True)
col.prop(scn, "use_atom_pdb_sticks_color")
+ col.prop(scn, "use_atom_pdb_sticks_smooth")
+ col.prop(scn, "use_atom_pdb_sticks_bonds")
+ row = box.row()
+ row.active = scn.use_atom_pdb_sticks
+ col = row.column(align=True)
+ col = row.column(align=True)
+ col.active = scn.use_atom_pdb_sticks and scn.use_atom_pdb_sticks_bonds
+ col.prop(scn, "atom_pdb_sticks_dist")
row = box.row()
row.prop(scn, "use_atom_pdb_center")
row = box.row()
@@ -129,7 +129,6 @@
col.prop(scn, "use_atom_pdb_lamp")
col = row.column()
col.operator("atom_pdb.button_reload")
- # TODO, use lanel() instead
col.prop(scn, "atom_pdb_number_atoms")
row = box.row()
row.operator("atom_pdb.button_distance")
@@ -137,6 +136,7 @@
row = layout.row()
row.label(text="Modify atom radii")
+
box = layout.box()
row = box.row()
row.label(text="All changes concern:")
@@ -219,7 +219,7 @@
name = "Object to origin", default=True,
description = "Put the object into the global origin")
scn.use_atom_pdb_sticks = BoolProperty(
- name="Use sticks", default=False,
+ name="Use sticks", default=True,
description="Do you want to display the sticks?")
scn.atom_pdb_sticks_sectors = IntProperty(
name = "Sector", default=20, min=0,
@@ -228,8 +228,17 @@
name = "Radius", default=0.1, min=0.0,
description ="Radius of a stick")
scn.use_atom_pdb_sticks_color = BoolProperty(
- name="Color", default=False,
+ name="Color", default=True,
description="The sticks appear in the color of the atoms")
+ scn.use_atom_pdb_sticks_smooth = BoolProperty(
+ name="Smooth", default=False,
+ description="The sticks are round (sectors are not visible)")
+ scn.use_atom_pdb_sticks_bonds = BoolProperty(
+ name="Bonds", default=False,
+ description="Show double and tripple bonds.")
+ scn.atom_pdb_sticks_dist = FloatProperty(
+ name="Distance", default = 1.1, min=1.0, max=3.0,
+ description="Distance between sticks measured in stick diameter")
scn.atom_pdb_atomradius = EnumProperty(
name="Type of radius",
description="Choose type of atom radius",
@@ -243,9 +252,8 @@
name = "", description="Path to your custom data file",
maxlen = 256, default = "", subtype='FILE_PATH')
scn.atom_pdb_PDB_file = StringProperty(
- name = "Path to file", default="",
+ name = "PDB file", default="",
description = "Path of the PDB file")
- # TODO, remove this property, its used for display only!
scn.atom_pdb_number_atoms = StringProperty(name="",
default="Number", description = "This output shows "
"the number of atoms which have been loaded")
@@ -435,8 +443,8 @@
return {'FINISHED'}
-# Button for showing the sticks only - the radii of the atoms have the radius
-# of the sticks
+# Button for showing the sticks only - the radii of the atoms downscaled onto
+# 90% of the stick radius
class CLASS_atom_pdb_radius_sticks_button(Operator):
bl_idname = "atom_pdb.radius_sticks"
bl_label = "Show sticks"
@@ -448,7 +456,7 @@
scn = bpy.context.scene
result = import_pdb.DEF_atom_pdb_radius_sticks(
- scn.atom_pdb_sticks_radius,
+ scn.atom_pdb_sticks_radius * 0.9,
scn.atom_pdb_radius_how,
)
@@ -476,19 +484,22 @@
center = scn.use_atom_pdb_center
sticks = scn.use_atom_pdb_sticks
sticks_col = scn.use_atom_pdb_sticks_color
+ sticks_sm = scn.use_atom_pdb_sticks_smooth
ssector = scn.atom_pdb_sticks_sectors
sradius = scn.atom_pdb_sticks_radius
+ stick_bond = scn.use_atom_pdb_sticks_bonds
+ stick_dist = scn.atom_pdb_sticks_dist
+
cam = scn.use_atom_pdb_cam
lamp = scn.use_atom_pdb_lamp
mesh = scn.use_atom_pdb_mesh
datafile = scn.atom_pdb_datafile
-
+
# Execute main routine an other time ... from the panel
atom_number = import_pdb.DEF_atom_pdb_main(
- mesh, azimuth, zenith, bradius,
- radiustype, bdistance, sticks, sticks_col,
- ssector, sradius, center, cam, lamp, datafile,
- )
+ mesh, azimuth, zenith, bradius, radiustype, bdistance,
+ sticks, sticks_col, sticks_sm, stick_bond,
+ stick_dist, ssector, sradius, center, cam, lamp, datafile)
scn.atom_pdb_number_atoms = str(atom_number) + " atoms"
return {'FINISHED'}
@@ -513,6 +524,7 @@
col = row.column()
col.prop(scn, "use_atom_pdb_mesh")
col = row.column(align=True)
+ col.active = scn.use_atom_pdb_mesh
col.prop(scn, "atom_pdb_mesh_azimuth")
col.prop(scn, "atom_pdb_mesh_zenith")
@@ -525,10 +537,21 @@
row = layout.row()
col = row.column()
col.prop(scn, "use_atom_pdb_sticks")
+ row = layout.row()
+ row.active = scn.use_atom_pdb_sticks
col = row.column(align=True)
col.prop(scn, "atom_pdb_sticks_sectors")
col.prop(scn, "atom_pdb_sticks_radius")
+ col = row.column(align=True)
col.prop(scn, "use_atom_pdb_sticks_color")
+ col.prop(scn, "use_atom_pdb_sticks_smooth")
+ col.prop(scn, "use_atom_pdb_sticks_bonds")
+ row = layout.row()
+ row.active = scn.use_atom_pdb_sticks
+ col = row.column(align=True)
+ col = row.column(align=True)
+ col.active = scn.use_atom_pdb_sticks and scn.use_atom_pdb_sticks_bonds
+ col.prop(scn, "atom_pdb_sticks_dist")
row = layout.row()
row.prop(scn, "use_atom_pdb_center")
@@ -552,18 +575,22 @@
center = scn.use_atom_pdb_center
sticks = scn.use_atom_pdb_sticks
sticks_col = scn.use_atom_pdb_sticks_color
+ sticks_sm = scn.use_atom_pdb_sticks_smooth
ssector = scn.atom_pdb_sticks_sectors
sradius = scn.atom_pdb_sticks_radius
+ stick_bond = scn.use_atom_pdb_sticks_bonds
+ stick_dist = scn.atom_pdb_sticks_dist
+
cam = scn.use_atom_pdb_cam
lamp = scn.use_atom_pdb_lamp
mesh = scn.use_atom_pdb_mesh
datafile = scn.atom_pdb_datafile
-
+
# Execute main routine
atom_number = import_pdb.DEF_atom_pdb_main(
- mesh, azimuth, zenith, bradius,
- radiustype, bdistance, sticks, sticks_col,
- ssector, sradius, center, cam, lamp, datafile)
+ mesh, azimuth, zenith, bradius, radiustype, bdistance,
+ sticks, sticks_col, sticks_sm, stick_bond,
+ stick_dist, ssector, sradius, center, cam, lamp, datafile)
scn.atom_pdb_number_atoms = str(atom_number) + " atoms"
Modified: trunk/py/scripts/addons/io_mesh_pdb/import_pdb.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_pdb/import_pdb.py 2011-12-30 06:44:51 UTC (rev 2825)
+++ trunk/py/scripts/addons/io_mesh_pdb/import_pdb.py 2011-12-30 20:30:01 UTC (rev 2826)
@@ -25,7 +25,7 @@
#
# Start of project : 2011-08-31 by Clemens Barth
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list