WwiseProjectDatabaseSource.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*******************************************************************************
  2. The content of this file includes portions of the proprietary AUDIOKINETIC Wwise
  3. Technology released in source code form as part of the game integration package.
  4. The content of this file may not be used without valid licenses to the
  5. AUDIOKINETIC Wwise Technology.
  6. Note that the use of the game engine is subject to the Unreal(R) Engine End User
  7. License Agreement at https://www.unrealengine.com/en-US/eula/unreal
  8. License Usage
  9. Licensees holding valid licenses to the AUDIOKINETIC Wwise Technology may use
  10. this file in accordance with the end user license agreement provided with the
  11. software or, alternatively, in accordance with the terms contained
  12. in a written agreement between you and Audiokinetic Inc.
  13. Copyright (c) 2023 Audiokinetic Inc.
  14. *******************************************************************************/
  15. #pragma once
  16. #include "IWwiseBrowserDataSource.h"
  17. #include "Misc/TextFilter.h"
  18. #include "Wwise/Ref/WwiseRefCollections.h"
  19. struct FWwiseMetadataBasicReference;
  20. struct WwiseItemTreePath
  21. {
  22. FString HierarchyName;
  23. FString RootFolder;
  24. TArray<FString> IntermediateFolders;
  25. FString ItemName;
  26. };
  27. class FWwiseProjectDatabaseDataSource : IWwiseBrowserDataSource
  28. {
  29. public:
  30. DECLARE_DELEGATE(FOnWwiseProjectDatasbaseDataSourceRefreshed)
  31. virtual ~FWwiseProjectDatabaseDataSource() override;
  32. FText GetProjectName();
  33. // IWwiseBrowserDataSource
  34. virtual bool Init() override;
  35. virtual void ConstructTree(bool bShouldRefresh) override;
  36. virtual FWwiseTreeItemPtr ConstructTreeRoot(EWwiseItemType::Type Type) override;
  37. virtual int32 LoadChildren(const FGuid& InParentId, const FString& InParentPath, TArray<FWwiseTreeItemPtr>& OutChildren) override;
  38. virtual int32 LoadChildren(FWwiseTreeItemPtr InParentItem) override;
  39. virtual int32 GetChildItemCount(const FWwiseTreeItemPtr& InParentItem) override;
  40. virtual FWwiseTreeItemPtr GetRootItem(EWwiseItemType::Type RootType) override;
  41. virtual FWwiseTreeItemPtr LoadFilteredRootItem(EWwiseItemType::Type ItemType, TSharedPtr<StringFilter> CurrentFilter) override;
  42. FWwiseTreeItemPtr FindItemFromPath(const FString& InCurrentItemPath);
  43. FWwiseTreeItemPtr FindItem(const FWwiseTreeItemPtr InItem);
  44. FOnWwiseProjectDatasbaseDataSourceRefreshed ProjectDatabaseDataSourceRefreshed;
  45. private:
  46. void BuildEvents(const WwiseEventGlobalIdsMap& Events);
  47. void BuildBusses(const WwiseBusGlobalIdsMap& Busses);
  48. void BuildAuxBusses(const WwiseAuxBusGlobalIdsMap& AuxBusses);
  49. void BuildAcousticTextures(const WwiseAcousticTextureGlobalIdsMap& AcousticTextures);
  50. void BuildStateGroups(const WwiseStateGroupGlobalIdsMap& StateGroups);
  51. void BuildStates(const WwiseStateGlobalIdsMap& States);
  52. void BuildSwitchGroups(const WwiseSwitchGroupGlobalIdsMap& SwitchGroups);
  53. void BuildSwitches(const WwiseSwitchGlobalIdsMap& Switches);
  54. void BuildGameParameters(const WwiseGameParameterGlobalIdsMap& GameParameters);
  55. void BuildTriggers(const WwiseTriggerGlobalIdsMap& Triggers);
  56. void BuildEffectShareSets(const WwisePluginShareSetGlobalIdsMap& EffectShareSets);
  57. bool ParseTreePath(const FString& ObjectPath, WwiseItemTreePath& OutItemPath);
  58. bool BuildFolderHierarchy(const FWwiseMetadataBasicReference& WwiseItem, EWwiseItemType::Type ItemType,
  59. const FWwiseTreeItemPtr
  60. CurrentRootFolder);
  61. void CopyTree(FWwiseTreeItemPtr SourceTreeItem, FWwiseTreeItemPtr DestTreeItem);
  62. void FilterTree(FWwiseTreeItemPtr TreeItem, TSharedPtr<StringFilter> SearchFilter);
  63. bool IsContainer(EWwiseItemType::Type ItemType) const;
  64. /** Root items, one for each type of Wwise object */
  65. FCriticalSection RootItemsLock;
  66. TArray< FWwiseTreeItemPtr > RootItems;
  67. // Map of all tree items
  68. TMap<FGuid, FWwiseTreeItemPtr> AllValidTreeItemsByGuid;
  69. // Container paths along the Browser Tree
  70. TMap<FString, FWwiseTreeItemPtr> NodesByPath;
  71. // Allows some optimization if we have already applied a search
  72. FString OldFilterText;
  73. FDelegateHandle OnDatabaseUpdateCompleteHandle;
  74. };