How to map vertex index to material slot?

I am trying to programatically paint vertices on a mesh based on their material slot. However, I have not found a method to map a vertice to its associated material slot.

I have found FStaticMeshSection:

struct FStaticMeshSection
{
	/** The index of the material with which to render this section. */
	int32 MaterialIndex;

	/** Range of vertices and indices used when rendering this section. */
	uint32 FirstIndex;
	uint32 NumTriangles;
	uint32 MinVertexIndex;
	uint32 MaxVertexIndex;

However, MinVertexIndex and MaxVertexIndex don’t seem to work. Is this the method (and I have a bug elsewhere in my code)? Or is there another method to map a vertex to material slot?

For context, this is how I am currently painting the vertices:

uint32 TotalVertices = LODModel.GetNumVertices();
			check(InstanceMeshLODInfo->OverrideVertexColors);
			check(TotalVertices <= InstanceMeshLODInfo->OverrideVertexColors->GetNumVertices());

			for (uint32 VerticeIdx = 0; VerticeIdx < TotalVertices; VerticeIdx++)
			{
                FColor ColorToSet = DefaultColor;
			    // uint32 NumOverrideVertexColors = InstanceMeshLODInfo->OverrideVertexColors->GetNumVertices();
				// uint32 NumPaintedVertices = InstanceMeshLODInfo->PaintedVertices.Num();
                if (VertexIdxToMaterialIdx.Contains(VerticeIdx) && MaterialIndexToColor.Contains(VertexIdxToMaterialIdx[VerticeIdx]))
                {
                    int MaterialIndex = VertexIdxToMaterialIdx[VerticeIdx];
                    ColorToSet = MaterialIndexToColor[MaterialIndex];
                }
				InstanceMeshLODInfo->OverrideVertexColors->VertexColor(VerticeIdx) = ColorToSet;
			}

Were you able to find the answer?

Ooops, no I havent solved this. I moved off it after getting stuck.

Hi! Not sure but you can take a look at FMeshDescription class