[Bf-extensions-cvs] [43d8e3b0] master: Fix: (a) assign a default material if element name is not correctly written, (b) 'Platinium' to 'Platinum'

Clemens Barth noreply at git.blender.org
Tue Mar 19 10:48:55 CET 2019


Commit: 43d8e3b038e6daf5c8b37a860ce0b870fd1ba055
Author: Clemens Barth
Date:   Tue Mar 19 10:47:56 2019 +0100
Branches: master
https://developer.blender.org/rBAC43d8e3b038e6daf5c8b37a860ce0b870fd1ba055

Fix: (a) assign a default material if element name is not correctly written, (b) 'Platinium' to 'Platinum'

===================================================================

M	add_mesh_clusters/__init__.py
M	add_mesh_clusters/add_mesh_cluster.py

===================================================================

diff --git a/add_mesh_clusters/__init__.py b/add_mesh_clusters/__init__.py
index e22df0ba..e3e4e95c 100644
--- a/add_mesh_clusters/__init__.py
+++ b/add_mesh_clusters/__init__.py
@@ -282,14 +282,25 @@ def DEF_atom_draw_atoms(prop_element,
                         prop_scale_distances,
                         coll_name):
 
+    FLAG = False
+    # Get the details about the atom (Name, radius, color, etc.).
     for element in add_mesh_cluster.ATOM_CLUSTER_ELEMENTS:
         if prop_element in element.name:
             number = element.number
             name = element.name
             color = element.color
             radii = element.radii
+            FLAG = True
             break
 
+    # If no element could be found, use gold. This may happen if the user does
+    # not correctly wrote the name of the atom.
+    if not FLAG:
+        number = 79
+        name = "Gold"
+        color = (1.0,  0.81,  0.13, 1.0)
+        radii = [1.34]
+
     # First, we create a collection for the atoms, which includes the 
     # representative ball and the mesh.
     coll_atom_name = "Cluster (" + coll_name + ")_" + name.lower()
diff --git a/add_mesh_clusters/add_mesh_cluster.py b/add_mesh_clusters/add_mesh_cluster.py
index 46b36526..c5515b7e 100644
--- a/add_mesh_clusters/add_mesh_cluster.py
+++ b/add_mesh_clusters/add_mesh_cluster.py
@@ -118,7 +118,7 @@ ATOM_CLUSTER_ELEMENTS_DEFAULT = (
 (75,       "Rhenium",       "Re", ( 0.14,  0.49,  0.67, 1.0), 1.28, 1.28, 1.97 ,  4 , 0.72 ,  7 , 0.56 ),
 (76,        "Osmium",       "Os", ( 0.14,   0.4,  0.58, 1.0), 1.26, 1.26, 1.92 ,  4 , 0.88 ,  6 , 0.69 ),
 (77,       "Iridium",       "Ir", ( 0.09,  0.32,  0.52, 1.0), 1.27, 1.27, 1.87 ,  4 , 0.68 ),
-(78,     "Platinium",       "Pt", ( 0.81,  0.81,  0.87, 1.0), 1.30, 1.30, 1.83 ,  2 , 0.80 ,  4 , 0.65 ),
+(78,      "Platinum",       "Pt", ( 0.81,  0.81,  0.87, 1.0), 1.30, 1.30, 1.83 ,  2 , 0.80 ,  4 , 0.65 ),
 (79,          "Gold",       "Au", (  1.0,  0.81,  0.13, 1.0), 1.34, 1.34, 1.79 ,  1 , 1.37 ,  3 , 0.85 ),
 (80,       "Mercury",       "Hg", ( 0.72,  0.72,  0.81, 1.0), 1.49, 1.49, 1.76 ,  1 , 1.27 ,  2 , 1.10 ),
 (81,      "Thallium",       "Tl", ( 0.65,  0.32,  0.30, 1.0), 1.48, 1.48, 2.08 ,  1 , 1.47 ,  3 , 0.95 ),



More information about the Bf-extensions-cvs mailing list