diff options
author | Jacques Lucke <jacques@blender.org> | 2022-05-31 20:24:56 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-05-31 20:24:56 +0300 |
commit | 484ea573af376a483ae7ecd0c1cba95ac5b122c7 (patch) | |
tree | 387362a29af1d1573b539be19263efded5eda8b6 | |
parent | a1830859fa98d529a2eae709b2557a91f1bbe9e7 (diff) | |
parent | dc389a61529d335ebdcc28882c8961f78c7c3d0c (diff) |
Merge branch 'blender-v3.2-release'
-rw-r--r-- | source/blender/blenkernel/intern/customdata.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc index da5c8389be2..058230745e7 100644 --- a/source/blender/blenkernel/intern/customdata.cc +++ b/source/blender/blenkernel/intern/customdata.cc @@ -55,6 +55,7 @@ /* only for customdata_data_transfer_interp_normal_normals */ #include "data_transfer_intern.h" +using blender::IndexRange; using blender::Span; using blender::Vector; @@ -521,6 +522,22 @@ static void layerCopy_propInt(const void *source, void *dest, int count) memcpy(dest, source, sizeof(MIntProperty) * count); } +static void layerInterp_propInt(const void **sources, + const float *weights, + const float *UNUSED(sub_weights), + int count, + void *dest) +{ + float result = 0.0f; + for (const int i : IndexRange(count)) { + const float weight = weights[i]; + const float src = *static_cast<const int *>(sources[i]); + result += src * weight; + } + const int rounded_result = static_cast<int>(round(result)); + *static_cast<int *>(dest) = rounded_result; +} + /** \} */ /* -------------------------------------------------------------------- */ @@ -1683,7 +1700,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { N_("Int"), layerCopy_propInt, nullptr, - nullptr, + layerInterp_propInt, nullptr}, /* 12: CD_PROP_STRING */ {sizeof(MStringProperty), |