diff options
author | Bastien Montagne <bastien@blender.org> | 2021-11-03 20:16:16 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-11-03 20:16:16 +0300 |
commit | 7aaedc09c72ebeb6e6f753681264b7b723f87c2c (patch) | |
tree | 856bf3b899e2d35aeffa2f8fc9c46e543be1be37 /source/blender/blenkernel/intern/material.c | |
parent | e10caf6fe3c23def05d35c5a5bad58165cfa77fd (diff) | |
parent | c29f9e14e4180af0fbba83d66e08c9852da7fa9c (diff) |
Merge branch 'blender-v3.0-release'
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 5f726defb1a..3a4e39812ab 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -899,7 +899,17 @@ void BKE_object_materials_test(Main *bmain, Object *ob, ID *id) return; } - BKE_object_material_resize(bmain, ob, *totcol, false); + if ((ob->id.tag & LIB_TAG_MISSING) == 0 && (id->tag & LIB_TAG_MISSING) != 0) { + /* Exception: In case the object is a valid data, but its obdata is an empty place-holder, + * use object's material slots amount as reference. + * This avoids loosing materials in a local object when its linked obdata gets missing. + * See T92780. */ + BKE_id_material_resize(bmain, id, (short)ob->totcol, false); + } + else { + /* Normal case: the use the obdata amount of materials slots to update the object's one. */ + BKE_object_material_resize(bmain, ob, *totcol, false); + } } void BKE_objects_materials_test_all(Main *bmain, ID *id) |