From c92927bf999df6bca3e52ebdf014b961dc85eca8 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Fri, 26 Jan 2024 11:21:42 +0100 Subject: [PATCH 1/2] Fix #117520: Data Transfer modifier not working with Vertex Groups This was the case for custom normals. There was an optimization in 91b4f9f1f6 that was skipping computation of existing normals if the Mix Factor in the UI was at 1.0 (under the assumption that in this case no old normals would be needed. Problem is that the resulting mix factor is the product of the Mix Factor in the UI and the weights, so just doing the check as in the culprit commit is not enough. Need to consider if weights are used. --- source/blender/blenkernel/intern/data_transfer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/data_transfer.cc b/source/blender/blenkernel/intern/data_transfer.cc index 4bf8d305e6b..8a8a31b1303 100644 --- a/source/blender/blenkernel/intern/data_transfer.cc +++ b/source/blender/blenkernel/intern/data_transfer.cc @@ -1060,7 +1060,7 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map, dst_data = static_cast(CustomData_add_layer( &me_dst->corner_data, CD_NORMAL, CD_SET_DEFAULT, me_dst->corners_num)); } - if (mix_factor != 1.0f) { + if ((mix_factor != 1.0f) || mix_weights) { MutableSpan(dst_data, me_dst->corners_num).copy_from(me_dst->corner_normals()); } /* Post-process will convert it back to CD_CUSTOMLOOPNORMAL. */ -- 2.30.2 From 7160bf819597178a80dfd287190d81e6b6d80104 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Fri, 26 Jan 2024 16:31:42 +0100 Subject: [PATCH 2/2] remove unnecesary parentheses --- source/blender/blenkernel/intern/data_transfer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/data_transfer.cc b/source/blender/blenkernel/intern/data_transfer.cc index 8a8a31b1303..585afd4cacd 100644 --- a/source/blender/blenkernel/intern/data_transfer.cc +++ b/source/blender/blenkernel/intern/data_transfer.cc @@ -1060,7 +1060,7 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map, dst_data = static_cast(CustomData_add_layer( &me_dst->corner_data, CD_NORMAL, CD_SET_DEFAULT, me_dst->corners_num)); } - if ((mix_factor != 1.0f) || mix_weights) { + if (mix_factor != 1.0f || mix_weights) { MutableSpan(dst_data, me_dst->corners_num).copy_from(me_dst->corner_normals()); } /* Post-process will convert it back to CD_CUSTOMLOOPNORMAL. */ -- 2.30.2