Commit: dc389a61529d335ebdcc28882c8961f78c7c3d0c Author: Jacques Lucke Date: Tue May 31 19:23:52 2022 +0200 Branches: blender-v3.2-release https://developer.blender.org/rBdc389a61529d335ebdcc28882c8961f78c7c3d0c
Fix T98454: subdivision doesn't propagate int attributes Differential Revision: https://developer.blender.org/D15083 =================================================================== M source/blender/blenkernel/intern/customdata.cc =================================================================== diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc index 62351a31042..1d9f377abec 100644 --- a/source/blender/blenkernel/intern/customdata.cc +++ b/source/blender/blenkernel/intern/customdata.cc @@ -54,6 +54,8 @@ /* only for customdata_data_transfer_interp_normal_normals */ #include "data_transfer_intern.h" +using blender::IndexRange; + /* number of layers to add when growing a CustomData object */ #define CUSTOMDATA_GROW 5 @@ -517,6 +519,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; +} + /** \} */ /* -------------------------------------------------------------------- */ @@ -1679,7 +1697,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { N_("Int"), layerCopy_propInt, nullptr, - nullptr, + layerInterp_propInt, nullptr}, /* 12: CD_PROP_STRING */ {sizeof(MStringProperty), _______________________________________________ Bf-blender-cvs mailing list [email protected] List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
