Elevate Engine 1
Loading...
Searching...
No Matches
WwiseMergedDataSource.cpp
Go to the documentation of this file.
1#ifdef EE_USES_WWISE
2
4
6
7Elevate::WwiseMergedDataSource::WwiseMergedDataSource(std::string& wwiseProjectPath, std::string& rootOutputPath, std::string& platform)
8{
9 m_fileDataSource.reset(new WwiseFileDataSource(wwiseProjectPath));;
10 m_projectDataSource.reset(new WwiseProjectDBDataSource(rootOutputPath, platform));
11}
12
13void Elevate::WwiseMergedDataSource::InitializeSource()
14{
15 m_fileDataSource->InitializeSource();
16 m_projectDataSource->InitializeSource();
17 RefreshSource();
18}
19
20void Elevate::WwiseMergedDataSource::RefreshSource()
21{
22 // This works as the project db data source keeps all of the items at the first le vel in the hierarchy
23 // This lets us acess to the refs without having to loop over the array every time.
24 std::map<std::string, WwiseItemPtr> projectDBRefs;
25 for (const auto item : m_projectDataSource->GetItems().lock()->Children)
26 {
27 projectDBRefs.emplace(item->GUID, item);
28 }
29 ProcessChildrenMerge(m_fileDataSource->GetItems().lock(), projectDBRefs);
30
31 // todo go get the remaining items in the refs and add them to the project
32 EE_CORE_TRACE("Completed the Wwise Merged Data Source Refresh.");
33}
34
35std::weak_ptr<WwiseItem> Elevate::WwiseMergedDataSource::GetItems() const
36{
37 // we return this root as this is the map that is modified, for the moment there is not copy whatsoever
38 return m_fileDataSource->GetItems();
39}
40
41void Elevate::WwiseMergedDataSource::ProcessChildrenMerge(WwiseItemPtr parent, std::map<std::string, WwiseItemPtr>& projectDBRefs)
42{
43 for (const auto item : parent->Children)
44 {
45 if (projectDBRefs.contains(item->GUID))
46 {
47 WwiseItemPtr projectDBItemRef = projectDBRefs[item->GUID];
48 item->ShortID = projectDBItemRef->ShortID;
49 item->Path = projectDBItemRef->Path;
50 item->IsInBank = true;
51 projectDBRefs.erase(item->GUID);
52 }
53 ProcessChildrenMerge(item, projectDBRefs);
54 }
55}
56
57#endif // #ifdef EE_USES_WWISE