Data Transfer: Avoid unnecessarily computing existing normals

If the mix factor means the old values won't be used at all,
the existing corner normals from before the modifier don't
matter and we can skip computing them.
This commit is contained in:
Hans Goudey 2024-01-23 12:42:25 -05:00
parent da6405fee7
commit 91b4f9f1f6

@ -1060,7 +1060,9 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
dst_data = static_cast<float3 *>(CustomData_add_layer(
&me_dst->corner_data, CD_NORMAL, CD_SET_DEFAULT, me_dst->corners_num));
}
MutableSpan(dst_data, me_dst->corners_num).copy_from(me_dst->corner_normals());
if (mix_factor != 1.0f) {
MutableSpan(dst_data, me_dst->corners_num).copy_from(me_dst->corner_normals());
}
/* Post-process will convert it back to CD_CUSTOMLOOPNORMAL. */
data_transfer_layersmapping_add_item_cd(r_map,
CD_NORMAL,