Merge branch 'loceditor_fix' of https://github.com/GoaLitiuM/FlaxEngine into GoaLitiuM-loceditor_fix

This commit is contained in:
Wojtek Figat
2025-04-12 22:36:53 +02:00
3 changed files with 10 additions and 3 deletions

View File

@@ -137,7 +137,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
table.Entries = entries; table.Entries = entries;
if (!table.Save(path)) if (!table.Save(path))
{ {
Object.Destroy(table); Object.DestroyNow(table);
newTables.Add(FlaxEngine.Content.LoadAsync<LocalizedStringTable>(path)); newTables.Add(FlaxEngine.Content.LoadAsync<LocalizedStringTable>(path));
} }
} }
@@ -153,7 +153,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
table.Locale = culture.Name; table.Locale = culture.Name;
if (!table.Save(path)) if (!table.Save(path))
{ {
Object.Destroy(table); Object.DestroyNow(table);
newTables.Add(FlaxEngine.Content.LoadAsync<LocalizedStringTable>(path)); newTables.Add(FlaxEngine.Content.LoadAsync<LocalizedStringTable>(path));
} }
} }

View File

@@ -172,7 +172,7 @@ bool JsonAssetBase::Save(const StringView& path)
rapidjson_flax::StringBuffer buffer; rapidjson_flax::StringBuffer buffer;
PrettyJsonWriter writerObj(buffer); PrettyJsonWriter writerObj(buffer);
_isResaving = true; _isResaving = true;
Save(writerObj); saveInternal(writerObj);
_isResaving = false; _isResaving = false;
// Save json to file // Save json to file
@@ -189,6 +189,12 @@ bool JsonAssetBase::Save(JsonWriter& writer) const
{ {
if (OnCheckSave()) if (OnCheckSave())
return true; return true;
return saveInternal(writer);
}
bool JsonAssetBase::saveInternal(JsonWriter& writer) const
{
ScopeLock lock(Locker); ScopeLock lock(Locker);
writer.StartObject(); writer.StartObject();

View File

@@ -101,6 +101,7 @@ protected:
void unload(bool isReloading) override; void unload(bool isReloading) override;
#if USE_EDITOR #if USE_EDITOR
void onRename(const StringView& newPath) override; void onRename(const StringView& newPath) override;
bool saveInternal(JsonWriter& writer) const;
#endif #endif
}; };