diff --git a/io_mesh_atomic/pdb_import.py b/io_mesh_atomic/pdb_import.py index dc687c602cec8690f8796c9e5279901cd9a08c18..18d9c25012b0cb82801f82c3468a569f681c0666 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 270997f44504bc7cdebfdd2b23b7364cfe13ca31..c54ef8ef85f734c3f075176b03295ddff6618cfa 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 ...