From 5f92932c40110ca5c38d4e0c2675135278ee253a Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Sat, 12 Apr 2025 02:32:10 +0300 Subject: [PATCH] Fix saving virtual JsonAssets to path --- Source/Engine/Content/JsonAsset.cpp | 8 +++++++- Source/Engine/Content/JsonAsset.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Content/JsonAsset.cpp b/Source/Engine/Content/JsonAsset.cpp index abdca7c4b..60f05d38e 100644 --- a/Source/Engine/Content/JsonAsset.cpp +++ b/Source/Engine/Content/JsonAsset.cpp @@ -172,7 +172,7 @@ bool JsonAssetBase::Save(const StringView& path) rapidjson_flax::StringBuffer buffer; PrettyJsonWriter writerObj(buffer); _isResaving = true; - Save(writerObj); + saveInternal(writerObj); _isResaving = false; // Save json to file @@ -189,6 +189,12 @@ bool JsonAssetBase::Save(JsonWriter& writer) const { if (OnCheckSave()) return true; + + return saveInternal(writer); +} + +bool JsonAssetBase::saveInternal(JsonWriter& writer) const +{ ScopeLock lock(Locker); writer.StartObject(); diff --git a/Source/Engine/Content/JsonAsset.h b/Source/Engine/Content/JsonAsset.h index 74f122331..11c13ce80 100644 --- a/Source/Engine/Content/JsonAsset.h +++ b/Source/Engine/Content/JsonAsset.h @@ -101,6 +101,7 @@ protected: void unload(bool isReloading) override; #if USE_EDITOR void onRename(const StringView& newPath) override; + bool saveInternal(JsonWriter& writer) const; #endif };