Notifications
Clear all
[Closed] 3dsmax SDK – Get diffusemap from architectural material
Dec 09, 2015 5:05 pm
I’m stuck at fetching a reference to the texture in the diffuse slot in a architectural material.
My usual bag of tricks does not seem to work, can anyone of you point me in the right direction?
I have tried to scan the paramblock and get it by name:
for (int i = 0, count = mat->NumParamBlocks(); i < count; ++i)
{
IParamBlock2 *pBlock = mat->GetParamBlockByID(0);
for (int j = 0, count = pBlock->NumParams(); j < count; ++j)
{
if (pBlock->GetLocalName(j) != NULL)
{
mprintf(_T("
checking param %s
", lmutil->getstring(pBlock->GetLocalName(j))));
if (::_stricmp(pBlock->GetLocalName(j).ToCStr(), "diffuseMap") == 0)
{
BitmapTex *tmap = (BitmapTex *)pBlock->GetTexmap(j, GetCOREInterface()->GetTime());
OutputDebugStringW(_T("
Found diffusemap: %s
", tmap->GetFullName()));
}
}
}
}
but it never seems to find the param by name.
Also I tried to just ‘brute force’ it by fetching it form the param index (
(type: showproperties $.material in listener with a object with arch material applied, you will see it
litst the diffuseMap as param 26 in 0-based index).
for (int i = 0, count = mat->NumParamBlocks(); i < count; ++i)
{
IParamBlock2 *pBlock = mat->GetParamBlock(i);
//26 is diffuse map.
BitmapTex *tmap = (BitmapTex *)pBlock->GetTexmap(26, GetCOREInterface()->GetTime(),FOREVER,0);
if (tmap != NULL)
{
mprintf(_T("
Architectural Texturemap is defined %s
", tmap->GetName()));
}
}
Also this does not seem to fetch it…
BitmapTex *tmap = (BitmapTex *)mat->GetSubTexmap(ID_DI);
if (tmap)
{
mprintf(_T("
Architectural Texturemap is defined %s
", tmap->GetFullName()));
}
All I want is a reference to the bitmap in the diffuse slot, so that I then can get the texture map name\path, but as you see I’m stuck at getting it…