From bad7b08046c9de70b721789aea36d07587cae3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Fri, 29 Sep 2023 18:56:37 +0200 Subject: [PATCH] EditorContentManager: Fixed asset reloading (thats why unit tests exist... or at least types...) --- GlitchyEditor/src/EditorContentManager.bf | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/GlitchyEditor/src/EditorContentManager.bf b/GlitchyEditor/src/EditorContentManager.bf index 75c12eb..aa6bff8 100644 --- a/GlitchyEditor/src/EditorContentManager.bf +++ b/GlitchyEditor/src/EditorContentManager.bf @@ -267,14 +267,11 @@ class EditorContentManager : IContentManager GetResourceAndSubassetName(oldIdentifier, let resourceName, let subassetName); - String filePath = scope .(); - GetResourceFilePath(resourceName, filePath); - - Result> resultNode = AssetHierarchy.GetNodeFromPath(filePath); + Result> resultNode = AssetHierarchy.GetNodeFromAssetHandle(handle); if (resultNode case .Err) { - Log.EngineLogger.Error($"Could not find asset \"{filePath}\"."); + Log.EngineLogger.Error($"Could not find asset node for asset \"{oldIdentifier}\"."); return; } @@ -282,7 +279,7 @@ class EditorContentManager : IContentManager IAssetLoader assetLoader = GetAssetLoader(file); - Stream stream = GetStream(filePath, true); + Stream stream = OpenStream(file.FilePath, true); // TODO: Add async loading! Asset loadedAsset = assetLoader.LoadAsset(stream, file.AssetConfig.Config, resourceName, subassetName, this); @@ -709,6 +706,7 @@ class EditorContentManager : IContentManager return .Ok; } + // Returns a filestream for the given asset file path private Stream OpenStream(StringView fileName, bool readOnly) { FileStream fs = new FileStream();