Simplification: Use generic `BKE_object_materials_test` in object liblink code.
Better avoid own specific logic here, when we already have a proper 'API' function for that.
This commit is contained in:
parent
a827864e6b
commit
d17128520d
|
@ -849,6 +849,7 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
|
|||
{
|
||||
Object *ob = (Object *)id;
|
||||
|
||||
Main *bmain = BLO_read_lib_get_main(reader);
|
||||
BlendFileReadReport *reports = BLO_read_lib_reports(reader);
|
||||
|
||||
/* XXX deprecated - old animation system <<< */
|
||||
|
@ -945,12 +946,7 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id)
|
|||
/* When the object is local and the data is library its possible
|
||||
* the material list size gets out of sync. T22663. */
|
||||
if (ob->data && ob->id.lib != ((ID *)ob->data)->lib) {
|
||||
const short *totcol_data = BKE_object_material_len_p(ob);
|
||||
/* Only expand so as not to lose any object materials that might be set. */
|
||||
if (totcol_data && (*totcol_data > ob->totcol)) {
|
||||
// printf("'%s' %d -> %d\n", ob->id.name, ob->totcol, *totcol_data);
|
||||
BKE_object_material_resize(BLO_read_lib_get_main(reader), ob, *totcol_data, false);
|
||||
}
|
||||
BKE_object_materials_test(bmain, ob, ob->data);
|
||||
}
|
||||
|
||||
BLO_read_id_address(reader, ob->id.lib, &ob->gpd);
|
||||
|
|
Loading…
Reference in New Issue