| 216 | #endif |
| 217 | |
| 218 | Asset* BinaryAssetFactoryBase::New(const AssetInfo& info) |
| 219 | { |
| 220 | // Get the asset storage container but don't load it now |
| 221 | const auto storage = ContentStorageManager::GetStorage(info.Path, false); |
| 222 | if (!storage) |
| 223 | { |
| 224 | // Note: missing file situation should be handled before asset creation |
| 225 | LOG(Warning, "Missing asset storage container at \'{0}\'!\nInfo: ", info.Path, info.ToString()); |
| 226 | return nullptr; |
| 227 | } |
| 228 | |
| 229 | // Create asset object |
| 230 | auto result = Create(info); |
| 231 | |
| 232 | // Perform fast init, we assume that given AssetInfo is valid |
| 233 | // and we can create asset object now without further verification |
| 234 | // which will be done during asset loading on content pool thread. |
| 235 | // Then we will perform asset storage upgrading and loading. |
| 236 | AssetHeader header; |
| 237 | header.ID = info.ID; |
| 238 | header.TypeName = info.TypeName; |
| 239 | if (result->Init(storage, header)) |
| 240 | { |
| 241 | LOG(Warning, "Cannot initialize asset.\nInfo: {0}", info.ToString()); |
| 242 | Delete(result); |
| 243 | result = nullptr; |
| 244 | } |
| 245 | |
| 246 | return result; |
| 247 | } |
| 248 | |
| 249 | Asset* BinaryAssetFactoryBase::NewVirtual(const AssetInfo& info) |
| 250 | { |