Slightly handle unfound models

This commit is contained in:
Jarrod Doyle 2024-09-29 11:27:36 +01:00
parent 47d95307b5
commit 7ec7f71239
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 13 additions and 8 deletions

View File

@ -1,4 +1,4 @@
using System.Diagnostics; using System.Diagnostics;
using System.Numerics; using System.Numerics;
using KeepersCompound.LGS; using KeepersCompound.LGS;
using KeepersCompound.LGS.Database; using KeepersCompound.LGS.Database;
@ -151,6 +151,9 @@ class Program
{ {
var resName = $"{propModelname.value.ToLower()}.bin"; var resName = $"{propModelname.value.ToLower()}.bin";
var modelPath = campaign.GetResourcePath(ResourceType.Object, resName); var modelPath = campaign.GetResourcePath(ResourceType.Object, resName);
if (modelPath != null)
{
// TODO: Handle failing to find model more gracefully
var model = new ModelFile(modelPath); var model = new ModelFile(modelPath);
if (model.TryGetVhot(ModelFile.VhotId.LightPosition, out var vhot)) if (model.TryGetVhot(ModelFile.VhotId.LightPosition, out var vhot))
{ {
@ -162,6 +165,8 @@ class Program
} }
} }
}
if (propSpotlight != null) if (propSpotlight != null)
{ {
var rot = Matrix4x4.Identity; var rot = Matrix4x4.Identity;