I am curious as to how blender merges attributes (normals, uvs...) through its decimation process.
So I tried looking at the source code. The function where they get blended seems to be:
CustomData_bmesh_interp_n, here.
void CustomData_bmesh_interp_n(CustomData *data,
const void **src_blocks_ofs,
const float *weights,
const float *sub_weights,
int count,
void *dst_block_ofs,
int n)
{
BLI_assert(weights != nullptr);
BLI_assert(count > 0);
CustomDataLayer *layer = &data->layers[n];
const LayerTypeInfo *typeInfo = layerType_getInfo(layer->type);
typeInfo->interp(src_blocks_ofs, weights, sub_weights, count, dst_block_ofs);
}
All this does is get some weights and defer to another call.
I am having issues:
- Locating the specific
interpfunction that's getting called, because it's a very common word in the project, making grepping for it challenging. - Understanding how it is handling discontinuities in the attributes.
interpfunction isn't some random function in any part of the project. It's specifically a method of theLayerTypeInfoclass. So you should begin by locating the definition of that class, and if you're lucky it'll be an actual member function instead of a lambda. If you're very lucky, that class won't be a superclass for some unknown derived class that provides the specific implementation you're looking for. I would begin by grepping forLayerTypeInfo::interpas a whole word.layerType_getInfoso I have no idea how that pointer is initialized.LAYERTYPEINFOtable defined in the same file.