diff --git a/project/code/TMV/Context.cs b/project/code/TMV/Context.cs index 6cd980f..939bc49 100644 --- a/project/code/TMV/Context.cs +++ b/project/code/TMV/Context.cs @@ -14,7 +14,7 @@ public partial class Context : Node { var extractPath = ProjectSettings.GlobalizePath($"user://extracted/tmp"); PathManager = new ResourcePathManager(extractPath); - ModelLoader = new ModelLoader(PathManager); + ModelLoader = new ModelLoader(); Instance = this; } diff --git a/project/code/TMV/ModelLoader.cs b/project/code/TMV/ModelLoader.cs index 0b750a6..c42b727 100644 --- a/project/code/TMV/ModelLoader.cs +++ b/project/code/TMV/ModelLoader.cs @@ -7,14 +7,7 @@ namespace KeepersCompound.TMV; public class ModelLoader { - private readonly Dictionary<(string, string), MeshInstance3D> _cache; - private readonly ResourcePathManager _pathManager; - - public ModelLoader(ResourcePathManager pathManager) - { - _pathManager = pathManager; - _cache = new Dictionary<(string, string), MeshInstance3D>(); - } + private readonly Dictionary<(string, string), MeshInstance3D> _cache = new(); public MeshInstance3D Load(string campaignName, string modelName, bool forceLoad = false) { @@ -33,13 +26,14 @@ public class ModelLoader } // 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(ref campaignName, modelName); }); _cache[(campaignName, modelName)] = model; return model?.Duplicate() as MeshInstance3D; } - public static MeshInstance3D LoadModel(ResourcePathManager pathManager, ref string campaignName, string modelName) + public static MeshInstance3D LoadModel(ref string campaignName, string modelName) { + var pathManager = Context.Instance.PathManager; var (newCampaignName, modelPath) = pathManager.GetResourcePath(ResourceType.Object, campaignName, modelName); campaignName = newCampaignName; if (modelPath == null)