Fix for model viewer not showing textures on YPT drawables

This commit is contained in:
dexyfex 2018-02-26 02:51:16 +11:00
parent 45294193a6
commit b5358be9ba

View File

@ -2419,6 +2419,8 @@ namespace CodeWalker.Rendering
} }
var yptTexDict = (drawable.Owner as YptFile)?.PtfxList?.TextureDictionary;
bool alltexsloaded = true; bool alltexsloaded = true;
int missingtexcount = 0; int missingtexcount = 0;
for (int mi = 0; mi < rndbl.HDModels.Length; mi++) for (int mi = 0; mi < rndbl.HDModels.Length; mi++)
@ -2443,7 +2445,12 @@ namespace CodeWalker.Rendering
if ((ttex == null) && (tex != null)) if ((ttex == null) && (tex != null))
{ {
//TextureRef means this RenderableTexture needs to be loaded from texture dict... //TextureRef means this RenderableTexture needs to be loaded from texture dict...
if (texDict != 0) if (yptTexDict != null) //for ypt files, first try the embedded tex dict..
{
var dtex = yptTexDict.Lookup(tex.NameHash);
rdtex = renderableCache.GetRenderableTexture(dtex);
}
else if (texDict != 0)
{ {
YtdFile ytd = gameFileCache.GetYtd(texDict); YtdFile ytd = gameFileCache.GetYtd(texDict);
if ((ytd != null) && (ytd.Loaded) && (ytd.TextureDict != null)) if ((ytd != null) && (ytd.Loaded) && (ytd.TextureDict != null))