Skip to content

Commit

Permalink
Fix material morph to work for object materials
Browse files Browse the repository at this point in the history
  • Loading branch information
UuuNyaa committed Aug 29, 2022
1 parent 96d1239 commit e52086c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion mmd_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
bl_info = {
"name": "mmd_tools",
"author": "sugiany",
"version": (2, 5, 0),
"version": (2, 5, 1),
"blender": (2, 83, 0),
"location": "View3D > Sidebar > MMD Tools Panel",
"description": "Utility tools for MMD model editing. (UuuNyaa's forked version)",
Expand Down
15 changes: 4 additions & 11 deletions mmd_tools/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,18 +775,11 @@ def materials(self):
"""
Helper method to list all materials in all meshes
"""
material_list = []
materials = set()
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
material_list.append(mat)
return material_list
materials.update(slot.material for slot in mesh.material_slots if slot.material is not None)
materials.update(mesh.data.materials)
return list(materials)

def renameBone(self, old_bone_name, new_bone_name):
if old_bone_name == new_bone_name:
Expand Down

0 comments on commit e52086c

Please sign in to comment.