Here is my code for getting the texture file names associated with a UV set:
fnMesh.getUVSetNames(uvSetNames);
pShape->m\_nNumUVSets = 0;
for ( UINT i=0; i<fnMesh.numUVSets(); i++)
{
char temp[256];
strcpy(temp, uvSetNames[i].asChar());
fnMesh.setCurrentUVSetName(uvSetNames[i]);
if (fnMesh.numUVs() > 0)
{
MObjectArray uvTxtNames;
fnMesh.getAssociatedUVSetTextures(uvSetNames[i], uvTxtNames);
for (UINT n=0; n<uvTxtNames.length(); n++)
{
MFnDependencyNode* pTextureNode = NULL;
MString msTextureFile;
if (uvTxtNames[n].hasFn(MFn::kFileTexture))
{
pTextureNode = new MFnDependencyNode(uvTxtNames[n]);
pTextureNode->findPlug("fileTextureName").getValue(msTextureFile);
MFileObject mFile;
mFile.setFullName(msTextureFile);
UINT name = pShape->m\_nNumUVSetTextureNames[pShape->m\_nNumUVSets];
pShape->m\_UVTextureFileNames[pShape->m\_nNumUVSets].m\_szTextureFile[name] = GetNameArray()->AddName(mFile.name().asChar());
pShape->m\_nNumUVSetTextureNames[pShape->m\_nNumUVSets]++;
pShape->m\_UVSetNumber[pShape->m\_nNumUVSets] = i;
}
}
assert(pShape->m\_nNumUVSetTextureNames[pShape->m\_nNumUVSets] < MAX\_NUM\_TEXTURES\_PER\_UV\_SET);
if (pShape->m\_nNumUVSetTextureNames[pShape->m\_nNumUVSets] > 0)
{
pShape->m\_nUVs[pShape->m\_nNumUVSets] = (UINT)fnMesh.numUVs(); // uv count (not the same for all sets)
pShape->m\_aUVs[pShape->m\_nNumUVSets] = new DtVec2f[fnMesh.numUVs()];
if (!pShape->m\_aUVs[pShape->m\_nNumUVSets])
{
hr = E\_OUTOFMEMORY;
OUTPUT\_MSG("LoadPolyMesh(): Could not allocate memory for tex-coords.");
goto e\_Exit;
}
pShape->m\_nNumUVSets++;
}
}
}
if (pShape->m\_nNumUVSets == 0)
{
OUTPUT\_MSG2("*** ERROR *** NO UVs for polyshape: ", fnMesh.name().asChar());
}
It returns that there are three UV sets, but the texture file names are not with the right UV set. Is this a bug in their code? I think is has to be.
Is there a way to get a look at their source? Or get an update to it? We do not pay for support anymore because it became too expensive.