MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / New

Method New

Source/Engine/Content/Factories/BinaryAssetFactory.cpp:218–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216#endif
217
218Asset* 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
249Asset* BinaryAssetFactoryBase::NewVirtual(const AssetInfo& info)
250{

Callers 1

LoadAsyncMethod · 0.45

Calls 4

DeleteFunction · 0.85
CreateFunction · 0.50
ToStringMethod · 0.45
InitMethod · 0.45

Tested by

no test coverage detected