Fix #138279: Realize instances node with depth input can crash

When not all the meshes referenced by the instances recursively
are realized because of the limit of the depth input, and those
meshes have vertex groups, a crash is possible because of an
un-checked VectorSet lookup. `all_meshes_info.order` includes
all meshes regardless of the depth and mask arguments.

Pull Request: https://projects.blender.org/blender/blender/pulls/138519
This commit is contained in:
Hans Goudey
2025-05-07 02:15:04 +02:00
committed by Hans Goudey
parent d73950790c
commit 92de7a4cbf
2 changed files with 9 additions and 1 deletions

View File

@@ -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. */

Binary file not shown.