From ad4eaff3d1a416f99d92bb7ea166ece650666367 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 15 Mar 2023 11:16:23 -0400 Subject: [PATCH] Fix #105791: Alembic procedural ignores materials When creating the bounding box mesh for the viewport replacement, copy the material from the original mesh. I'm not sure if Cycles is meant to load materials from the original mesh or the Alembic file itself, but either way, this should be a harmless change and fixes the issue in the report. --- source/blender/modifiers/intern/MOD_meshsequencecache.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.cc b/source/blender/modifiers/intern/MOD_meshsequencecache.cc index 16b54bd49bd..c339d8ec6ac 100644 --- a/source/blender/modifiers/intern/MOD_meshsequencecache.cc +++ b/source/blender/modifiers/intern/MOD_meshsequencecache.cc @@ -156,6 +156,10 @@ static Mesh *generate_bounding_box_mesh(const Mesh *org_mesh) } Mesh *result = geometry::create_cuboid_mesh(max - min, 2, 2, 2); + if (org_mesh->mat) { + result->mat = static_cast(MEM_dupallocN(org_mesh->mat)); + result->totcol = org_mesh->totcol; + } BKE_mesh_translate(result, math::midpoint(min, max), false); return result; -- 2.30.2