Cleaner model return
This commit is contained in:
parent
89cc70345e
commit
eca63077b8
|
@ -23,18 +23,18 @@ public class ModelLoader
|
||||||
{
|
{
|
||||||
if (_cache.TryGetValue((campaignName, modelName), out var fmModel))
|
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))
|
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
|
// 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); });
|
var model = Timing.TimeStage("Load Models", () => { return LoadModel(_pathManager, ref campaignName, modelName); });
|
||||||
_cache[(campaignName, modelName)] = model;
|
_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)
|
public static MeshInstance3D LoadModel(ResourcePathManager pathManager, ref string campaignName, string modelName)
|
||||||
|
|
Loading…
Reference in New Issue