Optimization and tweaks
This commit is contained in:
@@ -15,19 +15,13 @@
|
||||
bool BinaryAssetFactoryBase::Init(BinaryAsset* asset)
|
||||
{
|
||||
ASSERT(asset && asset->Storage);
|
||||
|
||||
// Prepare
|
||||
auto storage = asset->Storage;
|
||||
AssetInfo info;
|
||||
info.ID = asset->GetID();
|
||||
info.TypeName = asset->GetTypeName();
|
||||
info.Path = storage->GetPath();
|
||||
|
||||
// Load serialized asset data
|
||||
AssetInitData initData;
|
||||
if (storage->LoadAssetHeader(info.ID, initData))
|
||||
if (storage->LoadAssetHeader(asset->GetID(), initData))
|
||||
{
|
||||
LOG(Error, "Cannot load asset header.\nInfo: {0}", info.ToString());
|
||||
LOG(Error, "Cannot load asset header.\nInfo: {0}", AssetInfo(asset->GetID(), asset->GetTypeName(), storage->GetPath()).ToString());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,6 +31,7 @@ bool BinaryAssetFactoryBase::Init(BinaryAsset* asset)
|
||||
if (storage->AllowDataModifications() && upgrader && upgrader->ShouldUpgrade(initData.SerializedVersion))
|
||||
{
|
||||
const auto startTime = DateTime::NowUTC();
|
||||
const AssetInfo info(asset->GetID(), asset->GetTypeName(), storage->GetPath());
|
||||
LOG(Info, "Starting asset \'{0}\' conversion", info.Path);
|
||||
|
||||
// Backup source file (in case of conversion failure)
|
||||
@@ -100,14 +95,14 @@ bool BinaryAssetFactoryBase::Init(BinaryAsset* asset)
|
||||
// Check if serialized asset version is supported
|
||||
if (!IsVersionSupported(initData.SerializedVersion))
|
||||
{
|
||||
LOG(Warning, "Asset version {1} is not supported.\nInfo: {0}", info.ToString(), initData.SerializedVersion);
|
||||
LOG(Warning, "Asset version {1} is not supported.\nInfo: {0}", AssetInfo(asset->GetID(), asset->GetTypeName(), storage->GetPath()).ToString(), initData.SerializedVersion);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Initialize asset
|
||||
if (asset->Init(initData))
|
||||
{
|
||||
LOG(Error, "Cannot initialize asset.\nInfo: {0}", info.ToString());
|
||||
LOG(Error, "Cannot initialize asset.\nInfo: {0}", AssetInfo(asset->GetID(), asset->GetTypeName(), storage->GetPath()).ToString());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user