123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- #include "AkAudioBankGenerationHelpers.h"
- #include "AkAudioDevice.h"
- #include "AkSettings.h"
- #include "AkSettingsPerUser.h"
- #include "WwiseUnrealDefines.h"
- #include "IAudiokineticTools.h"
- #include "AssetManagement/AkAssetDatabase.h"
- #include "ObjectTools.h"
- #if UE_5_0_OR_LATER
- #include "HAL/PlatformFileManager.h"
- #else
- #include "HAL/PlatformFilemanager.h"
- #endif
- #include "Interfaces/IMainFrameModule.h"
- #include "Misc/Paths.h"
- #include "Misc/ScopedSlowTask.h"
- #include "Framework/Application/SlateApplication.h"
- #include "Widgets/SWindow.h"
- #include "AssetManagement/WwiseProjectInfo.h"
- #include "UI/SGenerateSoundBanks.h"
- #define LOCTEXT_NAMESPACE "AkAudio"
- namespace AkAudioBankGenerationHelper
- {
- FString GetWwiseConsoleApplicationPath()
- {
- const UAkSettingsPerUser* AkSettingsPerUser = GetDefault<UAkSettingsPerUser>();
- FString ApplicationToRun;
- ApplicationToRun.Empty();
- if (AkSettingsPerUser)
- {
- #if PLATFORM_WINDOWS
- ApplicationToRun = AkSettingsPerUser->WwiseWindowsInstallationPath.Path;
- #else
- ApplicationToRun = AkSettingsPerUser->WwiseMacInstallationPath.FilePath;
- #endif
- if (FPaths::IsRelative(ApplicationToRun))
- {
- ApplicationToRun = FPaths::ConvertRelativePathToFull(WwiseUnrealHelper::GetProjectDirectory(), ApplicationToRun);
- }
- if (!(ApplicationToRun.EndsWith(TEXT("/")) || ApplicationToRun.EndsWith(TEXT("\\"))))
- {
- ApplicationToRun += TEXT("/");
- }
- #if PLATFORM_WINDOWS
- if (FPaths::FileExists(ApplicationToRun + TEXT("Authoring/x64/Release/bin/WwiseConsole.exe")))
- {
- ApplicationToRun += TEXT("Authoring/x64/Release/bin/WwiseConsole.exe");
- }
- else
- {
- ApplicationToRun += TEXT("Authoring/Win32/Release/bin/WwiseConsole.exe");
- }
- ApplicationToRun.ReplaceInline(TEXT("/"), TEXT("\\"));
- #elif PLATFORM_MAC
- ApplicationToRun += TEXT("Contents/Tools/WwiseConsole.sh");
- ApplicationToRun = TEXT("\"") + ApplicationToRun + TEXT("\"");
- #endif
- }
- return ApplicationToRun;
- }
- void CreateGenerateSoundDataWindow(bool ProjectSave)
- {
- if (!FApp::CanEverRender())
- {
- return;
- }
- if (AkAssetDatabase::Get().CheckIfLoadingAssets())
- {
- return;
- }
- TSharedRef<SWindow> WidgetWindow = SNew(SWindow)
- .Title(LOCTEXT("AkAudioGenerateSoundData", "Generate SoundBanks"))
- .ClientSize(FVector2D(600.f, 332.f))
- .SupportsMaximize(false).SupportsMinimize(false)
- .SizingRule(ESizingRule::FixedSize)
- .FocusWhenFirstShown(true);
- TSharedRef<SGenerateSoundBanks> WindowContent = SNew(SGenerateSoundBanks);
- if (!WindowContent->ShouldDisplayWindow())
- {
- return;
- }
-
- WidgetWindow->SetContent(WindowContent);
-
- WidgetWindow->SetWidgetToFocusOnActivate(WindowContent);
-
-
-
-
-
- TSharedPtr<SWindow> ParentWindow;
- if (FModuleManager::Get().IsModuleLoaded("MainFrame"))
- {
- IMainFrameModule& MainFrame = FModuleManager::GetModuleChecked<IMainFrameModule>("MainFrame");
- ParentWindow = MainFrame.GetParentWindow();
- }
- if (ParentWindow.IsValid())
- {
-
- FSlateApplication::Get().AddModalWindow(WidgetWindow, ParentWindow.ToSharedRef());
- }
- else
- {
-
- FSlateApplication::Get().AddWindow(WidgetWindow);
- }
- }
- }
- #undef LOCTEXT_NAMESPACE
|