Add content deprecation system that auto-saves assets in Editor that use old data format
This commit is contained in:
@@ -127,7 +127,7 @@ bool AnimationGraph::InitAsAnimation(SkinnedModel* baseModel, Animation* anim, b
|
||||
return Graph.Load(&readStream, USE_EDITOR);
|
||||
}
|
||||
|
||||
BytesContainer AnimationGraph::LoadSurface()
|
||||
BytesContainer AnimationGraph::LoadSurface() const
|
||||
{
|
||||
if (!IsVirtual() && WaitForLoaded())
|
||||
return BytesContainer();
|
||||
@@ -160,19 +160,10 @@ BytesContainer AnimationGraph::LoadSurface()
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
bool AnimationGraph::SaveSurface(BytesContainer& data)
|
||||
bool AnimationGraph::SaveSurface(const BytesContainer& data)
|
||||
{
|
||||
// Wait for asset to be loaded or don't if last load failed
|
||||
if (LastLoadFailed())
|
||||
{
|
||||
LOG(Warning, "Saving asset that failed to load.");
|
||||
}
|
||||
else if (WaitForLoaded())
|
||||
{
|
||||
LOG(Error, "Asset loading failed. Cannot save it.");
|
||||
if (OnCheckSave())
|
||||
return true;
|
||||
}
|
||||
|
||||
ScopeLock lock(Locker);
|
||||
|
||||
if (IsVirtual())
|
||||
@@ -228,4 +219,17 @@ void AnimationGraph::GetReferences(Array<Guid>& assets, Array<String>& files) co
|
||||
Graph.GetReferences(assets);
|
||||
}
|
||||
|
||||
bool AnimationGraph::Save(const StringView& path)
|
||||
{
|
||||
if (OnCheckSave(path))
|
||||
return true;
|
||||
ScopeLock lock(Locker);
|
||||
MemoryWriteStream writeStream;
|
||||
if (Graph.Save(&writeStream, true))
|
||||
return true;
|
||||
BytesContainer data;
|
||||
data.Link(ToSpan(writeStream));
|
||||
return SaveSurface(data);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user