I’m trying to derive some data from lightmap UV’s in an OnAssetReimport callback. The callback itself fires and everything is valid, except when the mesh has a generated UV - which doesnt display.
The relevant code is below:
auto ObjectClass = InObject->GetClass();
if (ObjectClass == UStaticMesh::StaticClass())
{
UStaticMesh* StaticMesh = Cast<UStaticMesh>(InObject);
const float DesiredTexelDensity = 1.0f;
auto NormalizedTexelDensity = 0.0f;
if (StaticMesh->SourceModels.Num() > 0)
{
FStaticMeshSourceModel& SourceModel = StaticMesh->SourceModels[0];
auto LightmapIndex = StaticMesh->LightMapCoordinateIndex;
FRawMesh RawMesh;
SourceModel.RawMeshBulkData->LoadRawMesh(RawMesh);
auto TriangleIndices = RawMesh.WedgeIndices;
auto LightmapTexcoords = RawMesh.WedgeTexCoords[LightmapIndex];
auto Vertices = RawMesh.VertexPositions;
if (LightmapTexcoords.Num() > 0)
{
If the asset has generated lightmap UV’s, the condition above is false, which is odd!