Cleaner model return

This commit is contained in:
Jarrod Doyle 2024-08-30 17:56:28 +01:00
parent 89cc70345e
commit eca63077b8
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 3 additions and 3 deletions

View File

@ -23,18 +23,18 @@ public class ModelLoader
{
if (_cache.TryGetValue((campaignName, modelName), out var fmModel))
{
return fmModel == null ? fmModel : fmModel.Duplicate() as MeshInstance3D;
return fmModel?.Duplicate() as MeshInstance3D;
}
else if (_cache.TryGetValue(("", modelName), out var omModel))
{
return omModel == null ? omModel : omModel.Duplicate() as MeshInstance3D;
return omModel?.Duplicate() as MeshInstance3D;
}
}
// We don't care if this is null actually, we'll still cache that it's null lol
var model = Timing.TimeStage("Load Models", () => { return LoadModel(_pathManager, ref campaignName, modelName); });
_cache[(campaignName, modelName)] = model;
return model == null ? model : model.Duplicate() as MeshInstance3D;
return model;
}
public static MeshInstance3D LoadModel(ResourcePathManager pathManager, ref string campaignName, string modelName)