Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenkernel/intern/material.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index d3b34639d8a..d82559a27cb 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -900,7 +900,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)