Fix T49228: Separate by material, materials dissappear after reload.

Yet another mismatch where code would decrease usercount (of Material here) but never increase it again
when re-assigning the datablock...
This commit is contained in:
Bastien Montagne 2016-09-03 12:51:50 +02:00
parent 27c64e3f46
commit 6c0307f888
Notes: blender-bot 2023-02-14 07:38:34 +01:00
Referenced by issue #49228, Separate by material, materials dissappear after reload
1 changed files with 2 additions and 0 deletions

View File

@ -3121,8 +3121,10 @@ static void mesh_separate_material_assign_mat_nr(Main *bmain, Object *ob, const
BKE_material_resize_id(bmain, obdata, 1, true);
ob->mat[0] = ma_ob;
id_us_plus((ID *)ma_ob);
ob->matbits[0] = matbit;
(*matarar)[0] = ma_obdata;
id_us_plus((ID *)ma_obdata);
}
else {
BKE_material_clear_id(bmain, obdata, true);