Generic search for wwise directory

This commit is contained in:
Masusder 2025-04-28 17:28:04 +02:00
parent 48d172446e
commit 9318838ea7

View File

@ -837,14 +837,26 @@ public class CUE4ParseViewModel : ViewModel
return false;
}
case UAkAudioEvent when isNone && pointer.Object.Value is UAkAudioEvent { EventCookedData: { } wwiseData }:
{
{
var files = Provider.Files.Values.ToList();
var bnkFile = files.FirstOrDefault(f => f.Path.Contains("/WwiseAudio/") && f.Path.EndsWith(".bnk", StringComparison.OrdinalIgnoreCase));
string bnkDirectory = bnkFile != null ? Path.GetDirectoryName(bnkFile.Path.Replace('/', Path.DirectorySeparatorChar)) : null;
foreach (var kvp in wwiseData.EventLanguageMap)
{
if (!kvp.Value.HasValue)
continue;
var projectName = string.IsNullOrEmpty(Provider.ProjectName) ? "Game" : Provider.ProjectName;
var baseWwiseAudioPath = Path.Combine(projectName, "Content", "WwiseAudio", "Cooked");
var baseWwiseAudioPath = Path.Combine(projectName, "Content", "WwiseAudio", "Cooked");
// If .bnk was found we will use that for base wwise directory
if (!string.IsNullOrEmpty(bnkDirectory))
{
baseWwiseAudioPath = bnkDirectory;
}
var audioEventPath = pointer.Object.Value.GetPathName().Replace("Game", projectName);
foreach (var soundBank in kvp.Value.Value.SoundBanks)