mirror of
https://github.com/4sval/FModel.git
synced 2026-03-22 01:34:37 -05:00
Generic search for wwise directory (v2)
and cute icon
This commit is contained in:
parent
9318838ea7
commit
adc19388c9
|
|
@ -73,6 +73,7 @@
|
|||
<None Remove="Resources\asset_psd.png" />
|
||||
<None Remove="Resources\asset_png.png" />
|
||||
<None Remove="Resources\athena.png" />
|
||||
<None Remove="Resources\deadbydaylight.png" />
|
||||
<None Remove="Resources\Json.xshd" />
|
||||
<None Remove="Resources\Ini.xshd" />
|
||||
<None Remove="Resources\Verse.xshd" />
|
||||
|
|
@ -181,6 +182,7 @@
|
|||
<Resource Include="Resources\battlebreakers.png" />
|
||||
<Resource Include="Resources\blueprint.png" />
|
||||
<Resource Include="Resources\borderlands.png" />
|
||||
<Resource Include="Resources\deadbydaylight.png" />
|
||||
<Resource Include="Resources\fallenorder.png" />
|
||||
<Resource Include="Resources\FModel.ico" />
|
||||
<Resource Include="Resources\folder.png" />
|
||||
|
|
|
|||
BIN
FModel/Resources/deadbydaylight.png
Normal file
BIN
FModel/Resources/deadbydaylight.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 680 B |
|
|
@ -838,25 +838,13 @@ public class CUE4ParseViewModel : ViewModel
|
|||
}
|
||||
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");
|
||||
|
||||
// If .bnk was found we will use that for base wwise directory
|
||||
if (!string.IsNullOrEmpty(bnkDirectory))
|
||||
{
|
||||
baseWwiseAudioPath = bnkDirectory;
|
||||
}
|
||||
|
||||
var projectName = string.IsNullOrEmpty(Provider.ProjectName) ? "Game" : Provider.ProjectName;
|
||||
var baseWwiseAudioPath = DetermineBaseWwiseAudioPath(projectName, kvp.Value.Value);
|
||||
var audioEventPath = pointer.Object.Value.GetPathName().Replace("Game", projectName);
|
||||
|
||||
foreach (var soundBank in kvp.Value.Value.SoundBanks)
|
||||
|
|
@ -951,16 +939,11 @@ public class CUE4ParseViewModel : ViewModel
|
|||
|
||||
foreach (var media in kvp.Value.Value.Media)
|
||||
{
|
||||
var candidatePath = Path.Combine(baseWwiseAudioPath, media.MediaPathName.Text);
|
||||
var mediaRelativePath = media.MediaPathName.Text.Replace('\\', '/');
|
||||
var mediaRelativePath = Path.Combine(baseWwiseAudioPath, media.MediaPathName.Text.Replace('\\', '/'));
|
||||
|
||||
if (!Provider.TrySaveAsset(candidatePath, out byte[] data))
|
||||
{
|
||||
candidatePath = Path.Combine(baseWwiseAudioPath, mediaRelativePath);
|
||||
if (!Provider.TrySaveAsset(candidatePath, out data))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!Provider.TrySaveAsset(mediaRelativePath, out byte[] data))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var debugName = !string.IsNullOrEmpty(media.DebugName.Text)
|
||||
|
|
@ -1154,5 +1137,40 @@ public class CUE4ParseViewModel : ViewModel
|
|||
private static bool HasFlag(EBulkType a, EBulkType b)
|
||||
{
|
||||
return (a & b) == b;
|
||||
}
|
||||
|
||||
private string DetermineBaseWwiseAudioPath(string projectName, FWwiseEventCookedData value)
|
||||
{
|
||||
var files = Provider.Files.Values.ToList();
|
||||
|
||||
// Most common directory
|
||||
var baseWwiseAudioPath = Path.Combine(projectName, "Content", "WwiseAudio");
|
||||
|
||||
var soundBankName = value.SoundBanks.FirstOrDefault().SoundBankPathName.ToString() ?? string.Empty;
|
||||
var mediaPathName = value.Media.FirstOrDefault().MediaPathName.Text ?? string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(soundBankName))
|
||||
{
|
||||
var matchingFile = files.FirstOrDefault(f => f.Path.Contains(soundBankName));
|
||||
if (matchingFile != null)
|
||||
{
|
||||
var matchingDirectory = matchingFile.Path[..matchingFile.Path.LastIndexOf(soundBankName)];
|
||||
baseWwiseAudioPath = matchingDirectory.Replace('/', Path.DirectorySeparatorChar);
|
||||
return baseWwiseAudioPath;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(mediaPathName))
|
||||
{
|
||||
var matchingFile = files.FirstOrDefault(f => f.Path.Contains(mediaPathName));
|
||||
if (matchingFile != null)
|
||||
{
|
||||
var matchingDirectory = matchingFile.Path[..matchingFile.Path.LastIndexOf(mediaPathName)];
|
||||
baseWwiseAudioPath = matchingDirectory.Replace('/', Path.DirectorySeparatorChar);
|
||||
return baseWwiseAudioPath;
|
||||
}
|
||||
}
|
||||
|
||||
return baseWwiseAudioPath;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:FModel"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
||||
|
|
@ -417,6 +417,9 @@
|
|||
<DataTrigger Binding="{Binding Header}" Value="Athena">
|
||||
<Setter TargetName="TreeImage" Property="Source" Value="/FModel;component/Resources/athena.png" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Header}" Value="DeadByDaylight">
|
||||
<Setter TargetName="TreeImage" Property="Source" Value="/FModel;component/Resources/deadbydaylight.png" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Header, Converter={x:Static converters:CaseInsensitiveStringEqualsConverter.Instance}, ConverterParameter='StateOfDecay2'}" Value="True">
|
||||
<Setter TargetName="TreeImage" Property="Source" Value="/FModel;component/Resources/stateofdecay2.png" />
|
||||
</DataTrigger>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user