Skip to content
This repository was archived by the owner on May 9, 2025. It is now read-only.

Commit cbbe37b

Browse files
MysteryemMysteryem
authored and
Mysteryem
committed
Fix #105096: Material Utilities: Clean Material Slots fails to remove unused slots
The code was removing material slots while iterating through them which is generally a bad idea, and it stopped working as the addon expected in Blender 3.0+. The slots are now removed by counting how many slots there are and then removing that number of slots. Pull Request: https://projects.blender.org/blender/blender-addons/pulls/105098
1 parent f0a0966 commit cbbe37b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

materials_utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
bl_info = {
2121
"name": "Material Utilities",
2222
"author": "MichaleW, ChrisHinde",
23-
"version": (2, 2, 1),
23+
"version": (2, 2, 2),
2424
"blender": (3, 0, 0),
2525
"location": "View3D > Shift + Q key",
2626
"description": "Menu of material tools (assign, select..) in the 3D View",

materials_utils/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def mu_assign_material_slots(object, material_list):
1616
active_object = bpy.context.active_object
1717
bpy.context.view_layer.objects.active = object
1818

19-
for s in object.material_slots:
19+
for _ in range(len(object.material_slots)):
2020
bpy.ops.object.material_slot_remove()
2121

2222
# re-add them and assign material

0 commit comments

Comments
 (0)