Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-02-16 16:25:35 +0300
committerJacques Lucke <jacques@blender.org>2021-02-16 16:25:55 +0300
commit500bc99da5dbcdf7c728833326fc29babaf529e0 (patch)
tree01126e1e9bc6a2eb78353d00682208c3e7b7cbf1
parent82ade44299083e86acbaafbcb21ac350d861881d (diff)
Fix T85697: implement interpolation for float custom data type
This just hasn't been implemented before.
-rw-r--r--source/blender/blenkernel/intern/customdata.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 782b4fc200e..9188d8c1afd 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -473,6 +473,21 @@ static void layerCopy_propFloat(const void *source, void *dest, int count)
memcpy(dest, source, sizeof(MFloatProperty) * count);
}
+static void layerInterp_propFloat(const void **sources,
+ const float *weights,
+ const float *UNUSED(sub_weights),
+ int count,
+ void *dest)
+{
+ float result = 0.0f;
+ for (int i = 0; i < count; i++) {
+ const float interp_weight = weights[i];
+ const float src = *(const float *)sources[i];
+ result += src * interp_weight;
+ }
+ *(float *)dest = result;
+}
+
static bool layerValidate_propFloat(void *data, const uint totitems, const bool do_fixes)
{
MFloatProperty *fp = data;
@@ -1553,7 +1568,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
N_("Float"),
layerCopy_propFloat,
NULL,
- NULL,
+ layerInterp_propFloat,
NULL,
NULL,
layerValidate_propFloat},