Skip to content

Commit 36ec2b4

Browse files
committed
Don't attempt to create textures for materials that don't actually have any texture data.
1 parent 4fca246 commit 36ec2b4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

xivModdingFramework/Models/ModelTextures/ModelTexture.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,23 @@ public static async Task<ModelTextureData> GetModelMaps(Tex tex, XivMtrl mtrl, C
166166
specularPixels = texMapData.Specular.Data;
167167
}
168168

169+
if(normalPixels == null && diffusePixels == null)
170+
{
171+
// This material doesn't actually have any readable data.
172+
173+
var empty = new ModelTextureData
174+
{
175+
Width = 0,
176+
Height = 0,
177+
Normal = new byte[0],
178+
Diffuse = new byte[0],
179+
Specular = new byte[0],
180+
Emissive = new byte[0],
181+
Alpha = new byte[0]
182+
};
183+
return empty;
184+
}
185+
169186
var dataLength = normalPixels != null ? normalPixels.Length : diffusePixels.Length;
170187

171188
await Task.Run(() =>

0 commit comments

Comments
 (0)