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-15 00:46:15 +0300
committerClemens Barth <barth@root-1.de>2022-01-15 00:46:15 +0300
commit1b95d391dccbe52f9f1355748b71d89701f7ae69 (patch)
tree906da0e95c7021e3ddb86afa2d2322edce1c4b52
parent17844d2851f859079e48634cbb3c1eb4aba75d17 (diff)
The addon is updated for Eevee/Cycles - part 1: the atoms get now a useful color
by using nodes (material properties). The color used in the viewport shading ('solid mode') has been removed since it doesn't make sense anymore. Otherwise one always has to manually choose 'using nodes' in the material properties.
-rw-r--r--io_mesh_atomic/pdb_import.py13
-rw-r--r--io_mesh_atomic/xyz_import.py4
2 files changed, 15 insertions, 2 deletions
diff --git a/io_mesh_atomic/pdb_import.py b/io_mesh_atomic/pdb_import.py
index dc687c60..18d9c250 100644
--- a/io_mesh_atomic/pdb_import.py
+++ b/io_mesh_atomic/pdb_import.py
@@ -769,6 +769,9 @@ def draw_sticks_dupliverts(all_atoms,
if use_sticks_color == False:
stick_material = bpy.data.materials.new(ELEMENTS[-1].name)
+ stick_material.use_nodes = True
+ mat_P_BSDF = stick_material.node_tree.nodes['Principled BSDF']
+ mat_P_BSDF.inputs['Base Color'].default_value = ELEMENTS[-1].color
stick_material.diffuse_color = ELEMENTS[-1].color
# Sort the sticks and put them into a new list such that ...
@@ -1057,6 +1060,9 @@ def draw_sticks_skin(all_atoms,
new_stick_mesh.modifiers[1].render_levels = sticks_subdiv_render
stick_material = bpy.data.materials.new(ELEMENTS[-1].name)
+ stick_material.use_nodes = True
+ mat_P_BSDF = stick_material.node_tree.nodes['Principled BSDF']
+ mat_P_BSDF.inputs['Base Color'].default_value = ELEMENTS[-1].color
stick_material.diffuse_color = ELEMENTS[-1].color
new_stick_mesh.active_material = stick_material
@@ -1112,6 +1118,9 @@ def draw_sticks_normal(all_atoms,
coll_molecule):
stick_material = bpy.data.materials.new(ELEMENTS[-1].name)
+ stick_material.use_nodes = True
+ mat_P_BSDF = stick_material.node_tree.nodes['Principled BSDF']
+ mat_P_BSDF.inputs['Base Color'].default_value = ELEMENTS[-1].color
stick_material.diffuse_color = ELEMENTS[-1].color
up_axis = Vector([0.0, 0.0, 1.0])
@@ -1336,8 +1345,10 @@ def import_pdb(Ball_type,
# (e.g. hydrogen)
for atom_type in atom_all_types_list:
material = bpy.data.materials.new(atom_type[1])
+ material.use_nodes = True
+ mat_P_BSDF = material.node_tree.nodes['Principled BSDF']
+ mat_P_BSDF.inputs['Base Color'].default_value = atom_type[2]
material.name = atom_type[0]
- material.diffuse_color = atom_type[2]
atom_material_list.append(material)
# Now, we go through all atoms and give them a material. For all atoms ...
diff --git a/io_mesh_atomic/xyz_import.py b/io_mesh_atomic/xyz_import.py
index 270997f4..c54ef8ef 100644
--- a/io_mesh_atomic/xyz_import.py
+++ b/io_mesh_atomic/xyz_import.py
@@ -487,8 +487,10 @@ def import_xyz(Ball_type,
# Take the first atom
atom = atoms_of_one_type[0]
material = bpy.data.materials.new(atom.name)
+ material.use_nodes = True
+ mat_P_BSDF = material.node_tree.nodes['Principled BSDF']
+ mat_P_BSDF.inputs['Base Color'].default_value = atom.color
material.name = atom.name
- material.diffuse_color = atom.color
atom_material_list.append(material)
# Now, we go through all atoms and give them a material. For all atoms ...