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

Method Load

Engine/source/EtCore/Content/Asset.cpp:154–188  ·  view source on GitHub ↗

--------------------------------- I_Asset::Load Sets the name of an asset and generates its ID

Source from the content-addressed store, hash-verified

152// Sets the name of an asset and generates its ID
153//
154void I_Asset::Load()
155{
156 // Make sure all references are loaded
157 for (Reference& reference : m_References)
158 {
159 reference.Ref();
160 }
161
162 // get binary data from the package
163 if (!(ResourceManager::Instance()->GetLoadData(this, m_LoadData)))
164 {
165 ET_ASSERT(false, "Couldn't get data for '%s' (%i) in package '%s'",
166 m_PackageEntryId.ToStringDbg(),
167 m_PackageEntryId.Get(),
168 m_PackageId.ToStringDbg());
169 return;
170 }
171
172 // let the asset load from binary data
173 if (!LoadFromMemory(m_LoadData))
174 {
175 LOG("I_Asset::Load > Failed loading asset from memory, name: '" + m_Name + std::string("'"), LogLevel::Warning);
176 }
177
178 if (!m_IsPersistent)
179 {
180 m_LoadData.clear();
181 }
182
183 // dereference non persistent references
184 for (Reference& reference : m_References)
185 {
186 reference.Deref();
187 }
188}
189
190//---------------------------------
191// I_Asset::Unload

Callers 1

I_AssetPtrMethod · 0.80

Calls 6

LoadFromMemoryFunction · 0.85
RefMethod · 0.80
ToStringDbgMethod · 0.80
DerefMethod · 0.80
GetLoadDataMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected