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-23 12:55:38 +0300
committerClemens Barth <barth@root-1.de>2022-01-23 12:55:38 +0300
commit7f5d0ab6beb397051c55c737f601d33bbdbc239d (patch)
treefa87f8c405d03aa35c9a9523a2e2fcda4c7b3515 /io_mesh_atomic
parentb825c2d31ad39218fe39c99037d31bc2479211bd (diff)
io_mesh_atomic: atom objects had no 'diffuse_color'
Property 'material.diffuse_color' is now set such that one can see the color of the atoms in also the 'Solid mode' of the Viewport. Please enter the commit message for your changes. Lines starting
Diffstat (limited to 'io_mesh_atomic')
-rw-r--r--io_mesh_atomic/pdb_import.py1
-rw-r--r--io_mesh_atomic/xyz_import.py1
2 files changed, 2 insertions, 0 deletions
diff --git a/io_mesh_atomic/pdb_import.py b/io_mesh_atomic/pdb_import.py
index c3b0c150..33df4adc 100644
--- a/io_mesh_atomic/pdb_import.py
+++ b/io_mesh_atomic/pdb_import.py
@@ -1343,6 +1343,7 @@ 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.diffuse_color = atom_type[2]
material.use_nodes = True
mat_P_BSDF = material.node_tree.nodes['Principled BSDF']
mat_P_BSDF.inputs['Base Color'].default_value = atom_type[2]
diff --git a/io_mesh_atomic/xyz_import.py b/io_mesh_atomic/xyz_import.py
index 3cd7185c..940a2ff1 100644
--- a/io_mesh_atomic/xyz_import.py
+++ b/io_mesh_atomic/xyz_import.py
@@ -486,6 +486,7 @@ def import_xyz(Ball_type,
# Take the first atom
atom = atoms_of_one_type[0]
material = bpy.data.materials.new(atom.name)
+ material.diffuse_color = atom.color
material.use_nodes = True
mat_P_BSDF = material.node_tree.nodes['Principled BSDF']
mat_P_BSDF.inputs['Base Color'].default_value = atom.color