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>2022-01-25 15:14:31 +0300
committerClemens Barth <barth@root-1.de>2022-01-25 15:14:31 +0300
commit98003acc981d34661b387cb06541d0a55c8a5288 (patch)
tree717fac3c13e4b456f1d04f64de2d086fcb5f4169
parente641ac2d8a2baa146478d902a4222a3243a4f764 (diff)
Fix io_mesh_atomic: decreasing the stick diameter revealed the stick mesh
Reason: the planes used for the instancing vertice structure were visible at once because their size was as large as the stick diameter. I decreased the size of those planes by a factor of 100, everything is fine now
-rw-r--r--io_mesh_atomic/pdb_import.py37
1 files changed, 20 insertions, 17 deletions
diff --git a/io_mesh_atomic/pdb_import.py b/io_mesh_atomic/pdb_import.py
index 635c3c09..11bdb972 100644
--- a/io_mesh_atomic/pdb_import.py
+++ b/io_mesh_atomic/pdb_import.py
@@ -542,7 +542,7 @@ def build_stick(radius, length, sectors, element_name):
# Attention: the linking will be done a few moments later, after this
# is done definition.
- return (new_cylinder, new_cups)
+ return new_cylinder, new_cups
# Rotate an object.
@@ -864,7 +864,8 @@ def draw_sticks_dupliverts(all_atoms,
faces = []
i = 0
- # What follows is school mathematics! :-)
+ # What follows is school mathematics! :-) We construct equidistant
+ # planes, on which the stcik sections (cylinders) are perpendicular on.
for stick in stick_list:
dv = stick[2]
@@ -881,11 +882,15 @@ def draw_sticks_dupliverts(all_atoms,
for j in range(loops):
+ # The plane, which is normal to the length of the cylinder,
+ # will have a 1/100 of the stick diameter. => When decreasing
+ # the size of the stick diameter, the plane will not be visible.
+ f = 0.01
g = v1 - n * dl / 2.0 - n * dl * j
- p1 = g + n_b * Stick_diameter
- p2 = g - n_b * Stick_diameter
- p3 = g - n_b.cross(n) * Stick_diameter
- p4 = g + n_b.cross(n) * Stick_diameter
+ p1 = g + n_b * Stick_diameter * f
+ p2 = g - n_b * Stick_diameter * f
+ p3 = g - n_b.cross(n) * Stick_diameter * f
+ p4 = g + n_b.cross(n) * Stick_diameter * f
vertices.append(p1)
vertices.append(p2)
@@ -914,19 +919,17 @@ def draw_sticks_dupliverts(all_atoms,
# Link active object to the new collection
coll.objects.link(new_mesh)
- # Build the object.
- # Get the cylinder from the 'build_stick' function.
- object_stick = build_stick(Stick_diameter,
- dl,
- Stick_sectors,
- stick[0][1:])
- # Link active object to the new collection
- coll.objects.link(object_stick[0])
- coll.objects.link(object_stick[1])
+ # Build the object. Get the cylinder from the 'build_stick' function.
+ stick_cylinder, stick_cups = build_stick(Stick_diameter,
+ dl,
+ Stick_sectors,
+ stick[0][1:])
+ # Link active object to the new collection.
+ coll.objects.link(stick_cylinder)
+ coll.objects.link(stick_cups)
- stick_cylinder = object_stick[0]
+ # Assign the material.
stick_cylinder.active_material = stick[3]
- stick_cups = object_stick[1]
stick_cups.active_material = stick[3]
# Smooth the cylinders.