Fix T101871: Realize instances node can skip material indices

The node only created a material index attribute on the result mesh
if it existed on any of the input meshes. But the input meshes might
not have the attribute if they had a single material or no materials.
As a fix, also create the attribute if the result has more than one
material.
This commit is contained in:
Hans Goudey 2022-10-17 12:21:30 -05:00
parent d3b47fa842
commit 728451f01a
Notes: blender-bot 2023-02-14 08:08:54 +01:00
Referenced by issue #101871, Regression: Realize instances losing materials
1 changed files with 1 additions and 0 deletions

View File

@ -859,6 +859,7 @@ static AllMeshesInfo preprocess_meshes(const GeometrySet &geometry_set,
}
}
}
info.create_material_index_attribute |= info.materials.size() > 1;
info.realize_info.reinitialize(info.order.size());
for (const int mesh_index : info.realize_info.index_range()) {
MeshRealizeInfo &mesh_info = info.realize_info[mesh_index];