diff options
author | Bastien Montagne <bastien@blender.org> | 2021-09-27 19:07:01 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-09-27 19:09:20 +0300 |
commit | 6578db57cd878a94bdbdabe953c8819625c5a811 (patch) | |
tree | 888bc0478545610aa65833614aadd902433986ff /source/blender/editors/object | |
parent | 824733ea47d13030c18faa618c1dc31a08dfa43d (diff) |
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.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_add.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index beadbf2689e..236246924a9 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -2828,8 +2828,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) /* Remove unused materials. */ int actcol = ob_gpencil->actcol; for (int slot = 1; slot <= ob_gpencil->totcol; slot++) { - while (slot <= ob_gpencil->totcol && - !BKE_object_material_slot_used(ob_gpencil->data, slot)) { + while (slot <= ob_gpencil->totcol && !BKE_object_material_slot_used(ob_gpencil, slot)) { ob_gpencil->actcol = slot; BKE_object_material_slot_remove(CTX_data_main(C), ob_gpencil); |