[Bf-extensions-cvs] [1b95d391] master: 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.
Clemens Barth
noreply at git.blender.org
Fri Jan 14 23:01:13 CET 2022
Commit: 1b95d391dccbe52f9f1355748b71d89701f7ae69
Author: Clemens Barth
Date: Fri Jan 14 22:46:15 2022 +0100
Branches: master
https://developer.blender.org/rBA1b95d391dccbe52f9f1355748b71d89701f7ae69
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.
===================================================================
M io_mesh_atomic/pdb_import.py
M io_mesh_atomic/xyz_import.py
===================================================================
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 ...
More information about the Bf-extensions-cvs
mailing list