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
This commit is contained in:
Clemens Barth 2022-01-25 13:14:31 +01:00
parent e641ac2d8a
commit 98003acc98
1 changed files with 20 additions and 17 deletions

View File

@ -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.