diff --git a/FModel/MainWindow.xaml b/FModel/MainWindow.xaml index 95c8a4f8..f3d9f802 100644 --- a/FModel/MainWindow.xaml +++ b/FModel/MainWindow.xaml @@ -486,7 +486,13 @@ - + + + + + + + @@ -495,7 +501,13 @@ - + + + + + + + @@ -504,7 +516,13 @@ - + + + + + + + @@ -513,7 +531,13 @@ - + + + + + + + @@ -522,6 +546,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FModel/ViewModels/ApplicationViewModel.cs b/FModel/ViewModels/ApplicationViewModel.cs index 307f43b1..9d8ea3ec 100644 --- a/FModel/ViewModels/ApplicationViewModel.cs +++ b/FModel/ViewModels/ApplicationViewModel.cs @@ -47,19 +47,13 @@ namespace FModel.ViewModels IsReady = Status != EStatusKind.Loading && Status != EStatusKind.Stopping; } } - - private MenuCommand _menuCommand; - public ExtractNewTabCommand ExtractNewTabCommand => _extractNewTabCommand ??= new ExtractNewTabCommand(this); - private ExtractNewTabCommand _extractNewTabCommand; + + public RightClickMenuCommand RightClickMenuCommand => _rightClickMenuCommand ??= new RightClickMenuCommand(this); + private RightClickMenuCommand _rightClickMenuCommand; public MenuCommand MenuCommand => _menuCommand ??= new MenuCommand(this); - private ExportDataCommand _exportDataCommand; - public ExportDataCommand ExportDataCommand => _exportDataCommand ??= new ExportDataCommand(this); - private SavePropertyCommand _savePropertyCommand; - public SavePropertyCommand SavePropertyCommand => _savePropertyCommand ??= new SavePropertyCommand(this); - private SaveTextureCommand _saveTextureCommand; - public SaveTextureCommand SaveTextureCommand => _saveTextureCommand ??= new SaveTextureCommand(this); - private CopyCommand _copyCommand; + private MenuCommand _menuCommand; public CopyCommand CopyCommand => _copyCommand ??= new CopyCommand(this); + private CopyCommand _copyCommand; public string TitleExtra => $"{CUE4Parse.Game.GetDescription()} ({UserSettings.Default.OverridedGame[CUE4Parse.Game]}){(Build != EBuildKind.Release ? $" ({Build})" : "")}"; public LoadingModesViewModel LoadingModes { get; } diff --git a/FModel/ViewModels/Commands/ExportDataCommand.cs b/FModel/ViewModels/Commands/ExportDataCommand.cs deleted file mode 100644 index 10ea905d..00000000 --- a/FModel/ViewModels/Commands/ExportDataCommand.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Collections; -using System.Linq; -using FModel.Framework; -using FModel.Services; - -namespace FModel.ViewModels.Commands -{ - public class ExportDataCommand : ViewModelCommand - { - private ThreadWorkerViewModel _threadWorkerView => ApplicationService.ThreadWorkerView; - - public ExportDataCommand(ApplicationViewModel contextViewModel) : base(contextViewModel) - { - } - - public override async void Execute(ApplicationViewModel contextViewModel, object parameter) - { - if (parameter == null) return; - - var assetItems = ((IList) parameter).Cast().ToArray(); - if (!assetItems.Any()) return; - - await _threadWorkerView.Begin(_ => - { - foreach (var asset in assetItems) - { - contextViewModel.CUE4Parse.ExportData(asset.FullPath); - } - }); - } - } -} \ No newline at end of file diff --git a/FModel/ViewModels/Commands/ExtractNewTabCommand.cs b/FModel/ViewModels/Commands/ExtractNewTabCommand.cs deleted file mode 100644 index fb494f89..00000000 --- a/FModel/ViewModels/Commands/ExtractNewTabCommand.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections; -using System.Linq; -using FModel.Framework; -using FModel.Services; - -namespace FModel.ViewModels.Commands -{ - public class ExtractNewTabCommand : ViewModelCommand - { - private ThreadWorkerViewModel _threadWorkerView => ApplicationService.ThreadWorkerView; - - public ExtractNewTabCommand(ApplicationViewModel contextViewModel) : base(contextViewModel) - { - } - - public override async void Execute(ApplicationViewModel contextViewModel, object parameter) - { - if (parameter == null) return; - - var assetItems = ((IList) parameter).Cast().ToArray(); - if (!assetItems.Any()) return; - - await _threadWorkerView.Begin(cancellationToken => - { - foreach (var asset in assetItems) - { - cancellationToken.ThrowIfCancellationRequested(); - contextViewModel.CUE4Parse.Extract(asset.FullPath, true); - } - }); - } - } -} \ No newline at end of file diff --git a/FModel/ViewModels/Commands/RightClickMenuCommand.cs b/FModel/ViewModels/Commands/RightClickMenuCommand.cs new file mode 100644 index 00000000..0d18488f --- /dev/null +++ b/FModel/ViewModels/Commands/RightClickMenuCommand.cs @@ -0,0 +1,66 @@ +using System.Collections; +using System.Linq; +using FModel.Framework; +using FModel.Services; + +namespace FModel.ViewModels.Commands +{ + public class RightClickMenuCommand : ViewModelCommand + { + private ThreadWorkerViewModel _threadWorkerView => ApplicationService.ThreadWorkerView; + + public RightClickMenuCommand(ApplicationViewModel contextViewModel) : base(contextViewModel) + { + } + + public override async void Execute(ApplicationViewModel contextViewModel, object parameter) + { + if (parameter is not object[] parameters || parameters[0] is not string trigger) + return; + + var assetItems = ((IList) parameters[1]).Cast().ToArray(); + if (!assetItems.Any()) return; + + await _threadWorkerView.Begin(cancellationToken => + { + switch (trigger) + { + case "Assets_Extract_New_Tab": + foreach (var asset in assetItems) + { + cancellationToken.ThrowIfCancellationRequested(); + contextViewModel.CUE4Parse.Extract(asset.FullPath, true); + } + break; + case "Assets_Export_Data": + foreach (var asset in assetItems) + { + cancellationToken.ThrowIfCancellationRequested(); + contextViewModel.CUE4Parse.ExportData(asset.FullPath); + } + break; + case "Assets_Save_Properties": + foreach (var asset in assetItems) + { + cancellationToken.ThrowIfCancellationRequested(); + contextViewModel.CUE4Parse.Extract(asset.FullPath); + contextViewModel.CUE4Parse.TabControl.SelectedTab.SaveProperty(false); + } + break; + case "Assets_Save_Texture": + foreach (var asset in assetItems) + { + cancellationToken.ThrowIfCancellationRequested(); + contextViewModel.CUE4Parse.Extract(asset.FullPath); + contextViewModel.CUE4Parse.TabControl.SelectedTab.SaveImage(false); + } + break; + // case "Assets_Save_Material": + // break; + // case "Assets_Save_Mesh": + // break; + } + }); + } + } +} \ No newline at end of file diff --git a/FModel/ViewModels/Commands/SavePropertyCommand.cs b/FModel/ViewModels/Commands/SavePropertyCommand.cs deleted file mode 100644 index 21669243..00000000 --- a/FModel/ViewModels/Commands/SavePropertyCommand.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections; -using System.Linq; -using FModel.Framework; -using FModel.Services; - -namespace FModel.ViewModels.Commands -{ - public class SavePropertyCommand : ViewModelCommand - { - private ThreadWorkerViewModel _threadWorkerView => ApplicationService.ThreadWorkerView; - - public SavePropertyCommand(ApplicationViewModel contextViewModel) : base(contextViewModel) - { - } - - public override async void Execute(ApplicationViewModel contextViewModel, object parameter) - { - if (parameter == null) return; - - var assetItems = ((IList) parameter).Cast().ToArray(); - if (!assetItems.Any()) return; - - await _threadWorkerView.Begin(_ => - { - foreach (var asset in assetItems) - { - contextViewModel.CUE4Parse.Extract(asset.FullPath); - contextViewModel.CUE4Parse.TabControl.SelectedTab.SaveProperty(false); - } - }); - } - } -} \ No newline at end of file diff --git a/FModel/ViewModels/Commands/SaveTextureCommand.cs b/FModel/ViewModels/Commands/SaveTextureCommand.cs deleted file mode 100644 index 8d92aee3..00000000 --- a/FModel/ViewModels/Commands/SaveTextureCommand.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections; -using System.Linq; -using FModel.Framework; -using FModel.Services; - -namespace FModel.ViewModels.Commands -{ - public class SaveTextureCommand : ViewModelCommand - { - private ThreadWorkerViewModel _threadWorkerView => ApplicationService.ThreadWorkerView; - - public SaveTextureCommand(ApplicationViewModel contextViewModel) : base(contextViewModel) - { - } - - public override async void Execute(ApplicationViewModel contextViewModel, object parameter) - { - if (parameter == null) return; - - var assetItems = ((IList) parameter).Cast().ToArray(); - if (!assetItems.Any()) return; - - await _threadWorkerView.Begin(_ => - { - foreach (var asset in assetItems) - { - contextViewModel.CUE4Parse.Extract(asset.FullPath); - contextViewModel.CUE4Parse.TabControl.SelectedTab.SaveImage(false); - } - }); - } - } -} \ No newline at end of file diff --git a/FModel/Views/Resources/Resources.xaml b/FModel/Views/Resources/Resources.xaml index 953617e2..9580f3d9 100644 --- a/FModel/Views/Resources/Resources.xaml +++ b/FModel/Views/Resources/Resources.xaml @@ -63,6 +63,8 @@ M8.12 19.3c.39.39 1.02.39 1.41 0L12 16.83l2.47 2.47c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41l-3.17-3.17c-.39-.39-1.02-.39-1.41 0l-3.17 3.17c-.4.38-.4 1.02-.01 1.41zm7.76-14.6c-.39-.39-1.02-.39-1.41 0L12 7.17 9.53 4.7c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.03 0 1.42l3.17 3.17c.39.39 1.02.39 1.41 0l3.17-3.17c.4-.39.4-1.03.01-1.42z M12 5.83l2.46 2.46c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L12.7 3.7c-.39-.39-1.02-.39-1.41 0L8.12 6.88c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 5.83zm0 12.34l-2.46-2.46c-.39-.39-1.02-.39-1.41 0-.39.39-.39 1.02 0 1.41l3.17 3.18c.39.39 1.02.39 1.41 0l3.17-3.17c.39-.39.39-1.02 0-1.41-.39-.39-1.02-.39-1.41 0L12 18.17z M11.71,17.99C8.53,17.84,6,15.22,6,12c0-3.31,2.69-6,6-6c3.22,0,5.84,2.53,5.99,5.71l-2.1-0.63C15.48,9.31,13.89,8,12,8 c-2.21,0-4,1.79-4,4c0,1.89,1.31,3.48,3.08,3.89L11.71,17.99z M22,12c0,0.3-0.01,0.6-0.04,0.9l-1.97-0.59C20,12.21,20,12.1,20,12 c0-4.42-3.58-8-8-8s-8,3.58-8,8s3.58,8,8,8c0.1,0,0.21,0,0.31-0.01l0.59,1.97C12.6,21.99,12.3,22,12,22C6.48,22,2,17.52,2,12 C2,6.48,6.48,2,12,2S22,6.48,22,12z M18.23,16.26l2.27-0.76c0.46-0.15,0.45-0.81-0.01-0.95l-7.6-2.28 c-0.38-0.11-0.74,0.24-0.62,0.62l2.28,7.6c0.14,0.47,0.8,0.48,0.95,0.01l0.76-2.27l3.91,3.91c0.2,0.2,0.51,0.2,0.71,0l1.27-1.27 c0.2-0.2,0.2-0.51,0-0.71L18.23,16.26z + M12 2c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm8 7h-5v12c0 .55-.45 1-1 1s-1-.45-1-1v-5h-2v5c0 .55-.45 1-1 1s-1-.45-1-1V9H4c-.55 0-1-.45-1-1s.45-1 1-1h16c.55 0 1 .45 1 1s-.45 1-1 1z + M11 9h2v2h-2V9zm-2 2h2v2H9v-2zm4 0h2v2h-2v-2zm2-2h2v2h-2V9zM7 9h2v2H7V9zm12-6H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 18H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm2-7h-2v2h2v2h-2v-2h-2v2h-2v-2h-2v2H9v-2H7v2H5v-2h2v-2H5V6c0-.55.45-1 1-1h12c.55 0 1 .45 1 1v5z