MCPcopy Create free account
hub / github.com/Illation/ETEngine / GetLoadData

Method GetLoadData

Engine/source/EtRuntime/Core/PackageResourceManager.cpp:85–107  ·  view source on GitHub ↗

-------------------------------------- PackageResourceManager::GetLoadData Retrieve the data for this asset from its package

Source from the content-addressed store, hash-verified

83// Retrieve the data for this asset from its package
84//
85bool PackageResourceManager::GetLoadData(core::I_Asset const* const asset, std::vector<uint8>& outData) const
86{
87 // Get the package the asset lives in
88 auto const foundPackageIt = std::find_if(m_Packages.begin(), m_Packages.end(), [asset](T_IndexedPackage const& indexedPackage)
89 {
90 return indexedPackage.first == asset->GetPackageId();
91 });
92
93 // check the iterator is valid
94 if (foundPackageIt == m_Packages.cend())
95 {
96 LOG(FS("No package (id:'%s') found for asset '%s'", asset->GetPackageId().ToStringDbg(), asset->GetName().c_str()), core::LogLevel::Warning);
97 return false;
98 }
99
100 // get binary data from the package
101 if (!(foundPackageIt->second->GetEntryData(asset->GetPackageEntryId(), outData)))
102 {
103 return false;
104 }
105
106 return true;
107}
108
109//---------------------------------
110// PackageResourceManager::Flush

Callers

nothing calls this directly

Calls 5

beginMethod · 0.80
endMethod · 0.80
ToStringDbgMethod · 0.80
GetNameMethod · 0.80
GetEntryDataMethod · 0.45

Tested by

no test coverage detected