Add content deprecation system that auto-saves assets in Editor that use old data format
This commit is contained in:
@@ -189,7 +189,7 @@ bool BinaryAsset::HasDependenciesModified() const
|
||||
|
||||
#endif
|
||||
|
||||
FlaxChunk* BinaryAsset::GetOrCreateChunk(int32 index)
|
||||
FlaxChunk* BinaryAsset::GetOrCreateChunk(int32 index) const
|
||||
{
|
||||
if (IsVirtual()) // Virtual assets don't own storage container
|
||||
return nullptr;
|
||||
@@ -205,7 +205,7 @@ FlaxChunk* BinaryAsset::GetOrCreateChunk(int32 index)
|
||||
|
||||
// Allocate
|
||||
ASSERT(Storage);
|
||||
_header.Chunks[index] = chunk = Storage->AllocateChunk();
|
||||
const_cast<BinaryAsset*>(this)->_header.Chunks[index] = chunk = Storage->AllocateChunk();
|
||||
if (chunk)
|
||||
chunk->RegisterUsage();
|
||||
|
||||
@@ -263,10 +263,9 @@ void BinaryAsset::GetChunkData(int32 index, BytesContainer& data) const
|
||||
data.Link(chunk->Data);
|
||||
}
|
||||
|
||||
bool BinaryAsset::LoadChunk(int32 chunkIndex)
|
||||
bool BinaryAsset::LoadChunk(int32 chunkIndex) const
|
||||
{
|
||||
ASSERT(Storage);
|
||||
|
||||
const auto chunk = _header.Chunks[chunkIndex];
|
||||
if (chunk != nullptr
|
||||
&& chunk->IsMissing()
|
||||
@@ -275,19 +274,14 @@ bool BinaryAsset::LoadChunk(int32 chunkIndex)
|
||||
if (Storage->LoadAssetChunk(chunk))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BinaryAsset::LoadChunks(AssetChunksFlag chunks)
|
||||
bool BinaryAsset::LoadChunks(AssetChunksFlag chunks) const
|
||||
{
|
||||
ASSERT(Storage);
|
||||
|
||||
// Check if skip loading
|
||||
if (chunks == 0)
|
||||
return false;
|
||||
|
||||
// Load all missing marked chunks
|
||||
ASSERT(Storage);
|
||||
for (int32 i = 0; i < ASSET_FILE_DATA_CHUNKS; i++)
|
||||
{
|
||||
auto chunk = _header.Chunks[i];
|
||||
@@ -300,7 +294,6 @@ bool BinaryAsset::LoadChunks(AssetChunksFlag chunks)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user