0

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:

  1. Locating the specific interp function that's getting called, because it's a very common word in the project, making grepping for it challenging.
  2. Understanding how it is handling discontinuities in the attributes.
5
  • Have you tried contacting the folks that work on Blender? Commented Nov 7, 2024 at 23:09
  • Yes, and that's how I got this function. But they are busy and this is as far as they got me. Commented Nov 7, 2024 at 23:10
  • The interp function isn't some random function in any part of the project. It's specifically a method of the LayerTypeInfo class. 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 for LayerTypeInfo::interp as a whole word. Commented Nov 8, 2024 at 3:31
  • It's a function pointer, and i cannot find the definition of layerType_getInfo so I have no idea how that pointer is initialized. Commented Nov 8, 2024 at 6:48
  • A quick search of GitHub finds the definition here, with the LAYERTYPEINFO table defined in the same file. Commented Nov 8, 2024 at 6:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.