Fix: Customdata merging does not check layer limit on destination
`LayerTypeInfo` can define a `layers_max()` function which determines the maximum allowed number of layers. Upon merging, this limit was respected from the source, but not on the destination, so it was possible to exceed the max (if there were layers on the destination already). NOTE: `layers_max()` is currently only defined for legacy CD_MTFACE, but we might want to enforce this for UVs / CD_PROP_FLOAT2 again. This came up in #111608. Pull Request: https://projects.blender.org/blender/blender/pulls/111609
This commit is contained in:
committed by
Philipp Oeser
parent
3f0eba32d4
commit
a3c045d49d
@@ -2230,7 +2230,9 @@ static bool customdata_merge_internal(const CustomData *source,
|
||||
const int src_layer_flag = src_layer.flag;
|
||||
|
||||
if (type != last_type) {
|
||||
current_type_layer_count = 0;
|
||||
/* Dont exceed layer count on destination. */
|
||||
const int layernum_dst = CustomData_number_of_layers(dest, type);
|
||||
current_type_layer_count = layernum_dst;
|
||||
max_current_type_layer_count = CustomData_layertype_layers_max(type);
|
||||
last_active = src_layer.active;
|
||||
last_render = src_layer.active_rnd;
|
||||
|
||||
Reference in New Issue
Block a user