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

Method TryGetImportOptions

Source/Engine/ContentImporters/ImportAudio.cpp:23–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21#include "Engine/Platform/MessageBox.h"
22
23bool ImportAudio::TryGetImportOptions(const StringView& path, Options& options)
24{
25#if IMPORT_AUDIO_CACHE_OPTIONS
26 if (FileSystem::FileExists(path))
27 {
28 auto tmpFile = ContentStorageManager::GetStorage(path);
29 AssetInitData data;
30 if (tmpFile
31 && tmpFile->GetEntriesCount() == 1
32 && tmpFile->GetEntry(0).TypeName == AudioClip::TypeName
33 && !tmpFile->LoadAssetHeader(0, data)
34 && data.SerializedVersion >= 1)
35 {
36 // Check import meta
37 rapidjson_flax::Document metadata;
38 metadata.Parse(data.Metadata.Get<const char>(), data.Metadata.Length());
39 if (!metadata.HasParseError())
40 {
41 options.Deserialize(metadata, nullptr);
42 return true;
43 }
44 }
45 }
46#endif
47 return false;
48}
49
50CreateAssetResult ImportAudio::Import(CreateAssetContext& context, AudioDecoder& decoder)
51{

Callers

nothing calls this directly

Calls 7

GetEntriesCountMethod · 0.80
LoadAssetHeaderMethod · 0.80
GetEntryMethod · 0.45
ParseMethod · 0.45
LengthMethod · 0.45
HasParseErrorMethod · 0.45
DeserializeMethod · 0.45

Tested by

no test coverage detected