Fix T96494: Array modifier with caps crash on curve objects

Since 3b6ee8cee7, a list of vertex groups cannot be retrieved
from curve objects for merging because curve objects do not support
vertex groups. Previously the empty list on the object was returned.
Only mesh objects are supported for the caps.
This commit is contained in:
Hans Goudey 2022-03-21 14:44:39 -05:00
parent eb1755be35
commit 923b28aab8
Notes: blender-bot 2023-02-13 16:05:02 +01:00
Referenced by commit 2ba72d847b, Fix (unreported) Crash in Array modifier.
Referenced by issue #96688, Cycles: Hair Info Intercept and Length yield 0 on GPU
Referenced by issue #96494, Crash when a curve object got an array modifier with a mesh object containing a vertex group set as cap
Referenced by issue #96241, 3.1: Potential candidates for corrective releases
1 changed files with 8 additions and 4 deletions

View File

@ -397,8 +397,10 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
Object *start_cap_ob = amd->start_cap;
if (start_cap_ob && start_cap_ob != ctx->object) {
vgroup_start_cap_remap = BKE_object_defgroup_index_map_create(
start_cap_ob, ctx->object, &vgroup_start_cap_remap_len);
if (start_cap_ob->type == OB_MESH && ctx->object->type == OB_MESH) {
vgroup_start_cap_remap = BKE_object_defgroup_index_map_create(
start_cap_ob, ctx->object, &vgroup_start_cap_remap_len);
}
start_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(start_cap_ob, false);
if (start_cap_mesh) {
@ -410,8 +412,10 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
}
Object *end_cap_ob = amd->end_cap;
if (end_cap_ob && end_cap_ob != ctx->object) {
vgroup_end_cap_remap = BKE_object_defgroup_index_map_create(
end_cap_ob, ctx->object, &vgroup_end_cap_remap_len);
if (start_cap_ob->type == OB_MESH && ctx->object->type == OB_MESH) {
vgroup_end_cap_remap = BKE_object_defgroup_index_map_create(
end_cap_ob, ctx->object, &vgroup_end_cap_remap_len);
}
end_cap_mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(end_cap_ob, false);
if (end_cap_mesh) {