Skip to content

Commit

Permalink
Support search object's materials.
Browse files Browse the repository at this point in the history
  • Loading branch information
One-sixth authored and UuuNyaa committed Aug 29, 2022
1 parent 9f91226 commit 96d1239
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mmd_tools/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,11 @@ def materials(self):
"""
material_list = []
for mesh in self.meshes():
# Support search object's materials.
for mat_slot in mesh.material_slots:
if mat_slot.material is not None and mat_slot.material not in material_list:
# control the case of a material shared among different meshes
material_list.append(mat_slot.material)
for mat in mesh.data.materials:
if mat not in material_list:
# control the case of a material shared among different meshes
Expand Down

0 comments on commit 96d1239

Please sign in to comment.