diff --git a/source/blender/geometry/intern/realize_instances.cc b/source/blender/geometry/intern/realize_instances.cc index d77ed7fe69a..c6636ed55ea 100644 --- a/source/blender/geometry/intern/realize_instances.cc +++ b/source/blender/geometry/intern/realize_instances.cc @@ -1680,7 +1680,12 @@ static void copy_vertex_group_names(Mesh &dst_mesh, for (const Mesh *mesh : src_meshes) { LISTBASE_FOREACH (const bDeformGroup *, src, &mesh->vertex_group_names) { const StringRef src_name = src->name; - const int attribute_index = ordered_attributes.ids.index_of(src_name); + const int attribute_index = ordered_attributes.ids.index_of_try(src_name); + if (attribute_index == -1) { + /* The attribute is not propagated to the result (possibly because the mesh isn't included + * in the realized output because of the #VariedDepthOptions input). */ + continue; + } const bke::AttributeDomainAndType kind = ordered_attributes.kinds[attribute_index]; if (kind.domain != bke::AttrDomain::Point || kind.data_type != CD_PROP_FLOAT) { /* Prefer using the highest priority domain and type from all input meshes. */ diff --git a/tests/files/modeling/geometry_nodes/instance/realize_instances_depth.blend b/tests/files/modeling/geometry_nodes/instance/realize_instances_depth.blend new file mode 100644 index 00000000000..cc810f96a30 --- /dev/null +++ b/tests/files/modeling/geometry_nodes/instance/realize_instances_depth.blend @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba603a4fbc465d190ebd3d65a0fb319f3709b104b946eb817f78fad8c6ff9d0d +size 104290