Fix T91691: Selecting "Remove unused slots" in Materials panel removes slots that are assigned to particle systems/hair.
`BKE_object_material_slot_used` would only check obdata usages, but particle settings can also (weirdly enough) use objects' material slots. So now, as its name suggests, `BKE_object_material_slot_used` does take an object as parameter, and also checks for potential slot usage from psys in the object.
This commit is contained in:
@@ -690,7 +690,7 @@ static int material_slot_remove_unused_exec(bContext *C, wmOperator *op)
|
||||
Object *ob = objects[ob_index];
|
||||
int actcol = ob->actcol;
|
||||
for (int slot = 1; slot <= ob->totcol; slot++) {
|
||||
while (slot <= ob->totcol && !BKE_object_material_slot_used(ob->data, slot)) {
|
||||
while (slot <= ob->totcol && !BKE_object_material_slot_used(ob, slot)) {
|
||||
ob->actcol = slot;
|
||||
BKE_object_material_slot_remove(bmain, ob);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user