Hi Guys,
I’ve been trying to show different materials or texmaps within the viewport. The issue I have, is the code I’ve got seems to work on simple materials with texmaps (eg VRayMtl with a Checker texmap) But as soon as I try using it on a more complex object with multiple mtls/texmaps, it just shows the object as black untill I go into that specific texmap.
The code I’m using is below, if anyone has any ideas, let me know 
if (mat) {
for (int i = 0; i < mat->NumSubTexmaps(); i++) {
Texmap* tmap = mat->GetSubTexmap(i);
if (tmap) {
// tmap->LoadMapFiles(t);
// PStamp* ps = tmap->CreatePStamp(PS_TINY, TRUE);
BitmapTex* TMap = static_cast<BitmapTex*>(tmap);
if (TMap) {
TMap->SetMtlFlag(MTL_TEX_DISPLAY_ENABLED, TRUE);
TMap->ActivateTexDisplay(TRUE); //activate it
TMap->NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
mat->SetMtlFlag(MTL_TEX_DISPLAY_ENABLED, TRUE);
mat->NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
}
}
}
}
I know there is extra stuff like PStamp etc this was seeing if the texture needed renderering or loading (but for this, assume it is)
This is the closest I could get it where it atleast didn’t have strange colours showing in the viewport, but it doesn’t still want to show the texture.
For some context of why I need this, I do a lot Mtls clones/copys and once its clone or copied, it doesn’t want to show in the viewport. So I’m looking for a way to activate the textures.
Thanks !!