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

Method RebuildAssetList

Engine/source/EtEditor/Content/ResourceView.cpp:242–277  ·  view source on GitHub ↗

------------------------------------------------ ResourceView::RebuildDirectoryTree

Source from the content-addressed store, hash-verified

240// ResourceView::RebuildDirectoryTree
241//
242void ResourceView::RebuildAssetList()
243{
244 m_FilteredAssets.clear();
245
246 // clear flow box
247 for (Gtk::Widget* const child : m_FlowBox->get_children())
248 {
249 m_FlowBox->remove(*child);
250 }
251
252 // if we only allow specific types of assets and no asset types are selected, there will be nothing to populate
253 if (!m_TypeFilter.AreAllTypesAllowed() && m_TypeFilter.GetFilteredTypes().empty())
254 {
255 return;
256 }
257
258 // fetch assets
259 FileResourceManager* const resourceMan = static_cast<FileResourceManager*>(core::ResourceManager::Instance());
260 ET_ASSERT(resourceMan != nullptr);
261
262 core::AssetDatabase& database = m_ProjectSelected ? resourceMan->GetProjectDatabase() : resourceMan->GetEngineDatabase();
263 std::vector<core::I_Asset*> const filteredAssets = database.GetAssetsMatchingQuery(m_SelectedDirectory,
264 m_TypeFilter.AreDirectoriesRecursive(),
265 m_SearchTerm,
266 m_TypeFilter.GetFilteredTypes());
267
268 // repopulate
269 for (core::I_Asset* const asset : filteredAssets)
270 {
271 m_FilteredAssets.emplace_back(asset);
272 AssetWidget& assetWidget = m_FilteredAssets.back();
273 m_FlowBox->add(*(assetWidget.GetAttachment()));
274 }
275
276 m_FlowBox->show_all_children();
277}
278
279
280} // namespace edit

Callers

nothing calls this directly

Calls 4

AreAllTypesAllowedMethod · 0.80
GetAttachmentMethod · 0.45

Tested by

no test coverage detected