[Bf-blender-cvs] [728451f01ad] master: Fix T101871: Realize instances node can skip material indices

Hans Goudey noreply at git.blender.org
Mon Oct 17 19:31:30 CEST 2022


Commit: 728451f01ad5eec6abdc4f54364fe82490b151c5
Author: Hans Goudey
Date:   Mon Oct 17 12:21:30 2022 -0500
Branches: master
https://developer.blender.org/rB728451f01ad5eec6abdc4f54364fe82490b151c5

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.

===================================================================

M	source/blender/geometry/intern/realize_instances.cc

===================================================================

diff --git a/source/blender/geometry/intern/realize_instances.cc b/source/blender/geometry/intern/realize_instances.cc
index daafe0e4aa7..c649bde06ca 100644
--- a/source/blender/geometry/intern/realize_instances.cc
+++ b/source/blender/geometry/intern/realize_instances.cc
@@ -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];



More information about the Bf-blender-cvs mailing list