Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion AssetEditor/DependencyInjectionContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public override void Register(IServiceCollection serviceCollection)
{
serviceCollection.AddScoped<MainWindow>();
serviceCollection.AddScoped<MainViewModel>();
serviceCollection.AddSingleton<IEditorCreator>( x=> x.GetRequiredService<IEditorManager>());
serviceCollection.AddSingleton<IEditorManager, EditorManager>();

serviceCollection.AddTransient<OpenGamePackCommand>();
Expand Down
2 changes: 1 addition & 1 deletion AssetEditor/ViewModels/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private void Save()
_settingsService.CurrentSettings.CameraControlMode = SelectedCameraMode;

foreach (var item in GameDirectores)
_settingsService.CurrentSettings.GameDirectories.Add(new ApplicationSettings.GamePathPair() { Game = item.GameType, Path = item.Path });
_settingsService.CurrentSettings.GameDirectories.Add(new ApplicationSettings.GamePathPair(item.GameType, item.Path));
_settingsService.CurrentSettings.WwisePath = WwisePath;

_localizationManager.LoadLanguage(SelectedLanguage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ namespace Editors.AnimationVisualEditors.CampaignAnimationCreator.DevConfig
{
internal class CampaignAnimation_Damsel : IDeveloperConfiguration
{
private readonly IEditorCreator _editorCreator;
private readonly IEditorManager _editorCreator;
private readonly IPackFileService _packFileService;

public CampaignAnimation_Damsel(IEditorCreator editorCreator, IPackFileService packFileService)
public CampaignAnimation_Damsel(IEditorManager editorCreator, IPackFileService packFileService)
{
_editorCreator = editorCreator;
_packFileService = packFileService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ namespace Editors.AnimationVisualEditors.MountAnimationCreator.DevConfig
{
internal class MountTool : IDeveloperConfiguration
{
private readonly IEditorCreator _editorCreator;
private readonly IEditorManager _editorCreator;
private readonly IPackFileService _packFileService;

public MountTool(IEditorCreator editorCreator, IPackFileService packFileService)
public MountTool(IEditorManager editorCreator, IPackFileService packFileService)
{
_editorCreator = editorCreator;
_packFileService = packFileService;
Expand All @@ -30,7 +30,7 @@ public void OpenFileOnLoad()
CreateLionAndHu01b(_editorCreator, _packFileService);
}

static void CreateLionAndHu01b(IEditorCreator creator, IPackFileService packfileService)
static void CreateLionAndHu01b(IEditorManager creator, IPackFileService packfileService)
{
var riderInput = new AnimationToolInput()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ namespace Editors.AnimatioReTarget.DevConfig
{
internal class AnimTransfer_DwarfArcher : IDeveloperConfiguration
{
private readonly IEditorCreator _editorCreator;
private readonly IEditorManager _editorCreator;
private readonly IPackFileService _packFileService;

public AnimTransfer_DwarfArcher(IEditorCreator editorCreator, IPackFileService packFileService)
public AnimTransfer_DwarfArcher(IEditorManager editorCreator, IPackFileService packFileService)
{
_editorCreator = editorCreator;
_packFileService = packFileService;
Expand All @@ -30,7 +30,7 @@ public void OpenFileOnLoad()
CreateDwarfAndEmpArcher(_editorCreator, _packFileService);
}

static void CreateDwarfAndEmpArcher(IEditorCreator creator, IPackFileService packfileService)
static void CreateDwarfAndEmpArcher(IEditorManager creator, IPackFileService packfileService)
{
var targetInput = new AnimationToolInput()
{
Expand Down
2 changes: 1 addition & 1 deletion Editors/BmdEditor/DependencyInjectionContainer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Editors.BmdEditor.ViewModels;
using Editors.BmdEditor.ViewModels;
using Editors.BmdEditor.Views;
using Editors.BmdEditor.Services;
using Microsoft.Extensions.DependencyInjection;
Expand Down
4 changes: 2 additions & 2 deletions Editors/BmdEditor/ViewModels/BmdSceneViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public partial class BmdSceneViewModel : ObservableObject, IDisposable
{
private readonly ILogger _logger = Serilog.Log.ForContext<BmdSceneViewModel>();
private readonly IPackFileService _packFileService;
private readonly IEditorCreator _editorCreator;
private readonly IEditorManager _editorCreator;
private readonly ResourceLibrary _resourceLibrary;
private readonly IGraphicsResourceCreator _graphicsResourceCreator;
private readonly MeshBuilderService _meshBuilderService;
Expand Down Expand Up @@ -56,7 +56,7 @@ public IWpfGame? Scene3D

public BmdSceneViewModel(
IPackFileService packFileService,
IEditorCreator editorCreator,
IEditorManager editorCreator,
ResourceLibrary resourceLibrary,
IGraphicsResourceCreator graphicsResourceCreator,
MeshBuilderService meshBuilderService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Shared.Core.PackFiles.Models;
using Shared.Core.PackFiles.Models;

namespace Shared.Ui.BaseDialogs.PackFileTree.ContextMenu.External
namespace Editors.ImportExport.ContextMenu
{
public interface IExportFileContextMenuHelper
{
bool CanExportFile(PackFile packFile);
void ShowDialog(PackFile packFile);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Shared.Core.PackFiles.Models;
using TreeNode = Shared.Ui.BaseDialogs.PackFileTree.TreeNode;

namespace Editors.ImportExport.ContextMenu
{
public interface IImportFileContextMenuHelper
{
bool CanImportFile(PackFile file);
void ShowDialog(TreeNode node);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Editors.ImportExport.Exporting.Presentation.DdsToNormalPng;
using Editors.ImportExport.Exporting.Presentation.DdsToPng;
using Editors.ImportExport.Exporting.Presentation.RmvToGltf;
using Editors.ImportExport.ContextMenu;
using Editors.ImportExport.Importing;
using Editors.ImportExport.Importing.Importers.GltfToRmv;
using Editors.ImportExport.Importing.Importers.GltfToRmv.Helper;
Expand All @@ -18,7 +19,7 @@
using Shared.Core.DependencyInjection;
using Shared.Core.DevConfig;
using Editors.ImportImport.Importing.Presentation.RmvToGltf;
using Shared.Ui.BaseDialogs.PackFileTree.ContextMenu.External;
using Shared.Ui.BaseDialogs.PackFileTree.ContextMenu;

namespace Editors.ImportExport
{
Expand Down Expand Up @@ -55,6 +56,8 @@ public override void Register(IServiceCollection services)
services.AddScoped<IImageSaveHandler, SystemImageSaveHandler>();

// Helpers to ensure we can hook up to the UI
services.AddTransient<AdvancedExportCommand>();
services.AddTransient<AdvancedImportCommand>();
services.AddTransient<IExportFileContextMenuHelper, ExportFileContextMenuHelper>();
services.AddTransient<DisplayExportFileToolCommand>();

Expand All @@ -69,7 +72,18 @@ public override void Register(IServiceCollection services)
services.AddTransient<GltfSkeletonBuilder>();
services.AddTransient<GltfAnimationBuilder>();

services.AddSingleton<IPackFileContextMenuRegistration, ImportExportPackFileContextMenuRegistration>();

RegisterAllAsInterface<IDeveloperConfiguration>(services, ServiceLifetime.Transient);
}
}

public class ImportExportPackFileContextMenuRegistration : IPackFileContextMenuRegistration
{
public void Register(PackFileContextMenuRegistry registry)
{
registry.RegisterPackFileContextMenuItem<AdvancedExportCommand>(ContextMenuType.MainApplication, path: "Export", priority: 10, ContextMenuCluster.Export);
registry.RegisterPackFileContextMenuItem<AdvancedImportCommand>(ContextMenuType.MainApplication, path: "Import", priority: 20, ContextMenuCluster.FolderOperation);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Shared.Ui.BaseDialogs.PackFileTree.ContextMenu.Commands;
using Shared.Ui.BaseDialogs.PackFileTree;
using Editors.ImportExport.ContextMenu;

namespace Editors.ImportExport.Exporting
{
public class AdvancedExportCommand(IExportFileContextMenuHelper exportFileContextMenuHelper) : IContextMenuCommand
{
public string GetDisplayName(TreeNode node) => "Advanced Export";
public bool ShouldAdd(TreeNode node) => node.NodeType == NodeType.File && node.Item != null;
public bool IsEnabled(TreeNode node) => exportFileContextMenuHelper.CanExportFile(node.Item);

public void Execute(TreeNode selectedNode) => exportFileContextMenuHelper.ShowDialog(selectedNode.Item);
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Editors.ImportExport.Misc;
using Editors.ImportExport.Exporting.Exporters;
using Editors.ImportExport.ContextMenu;
using Shared.Core.Events;
using Shared.Core.PackFiles.Models;
using Shared.Core.Settings;
using Shared.Ui.BaseDialogs.PackFileTree.ContextMenu.External;

namespace Editors.ImportExport.Exporting
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Editors.ImportExport.ContextMenu;
using Shared.Ui.BaseDialogs.PackFileTree;
using Shared.Ui.BaseDialogs.PackFileTree.ContextMenu.Commands;

namespace Editors.ImportExport.Importing
{
public class AdvancedImportCommand(IImportFileContextMenuHelper importFileContextMenuHelper) : IContextMenuCommand
{
public string GetDisplayName(TreeNode node) => "Advanced Import";
public bool ShouldAdd(TreeNode node) => node.NodeType == NodeType.Directory && !node.FileOwner.IsCaPackFile;
public bool IsEnabled(TreeNode node) => true;

public void Execute(TreeNode selectedNode) => importFileContextMenuHelper.ShowDialog(selectedNode);
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.IO;
using Editors.ImportExport.ContextMenu;
using Editors.ImportExport.Exporting.Exporters;
using Editors.ImportExport.Misc;
using Shared.Core.Events;
using Shared.Core.PackFiles.Models;
using Shared.Core.Settings;
using Shared.Ui.BaseDialogs.PackFileTree.ContextMenu.External;
using TreeNode = Shared.Ui.BaseDialogs.PackFileTree.TreeNode;

namespace Editors.ImportExport.Importing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public partial class SceneExplorerContextMenuHandler : ObservableObject, IDispos
ISceneNode _activeNode;
IEnumerable<ISceneNode> _activeNodes;

[ObservableProperty] ObservableCollection<ContextMenuItem> _items = [];
[ObservableProperty] ObservableCollection<ContextMenuItem?> _items = [];

public SceneExplorerContextMenuHandler(IEventHub eventHub, SceneManager sceneManager, CommandFactory commandFactory, SelectionManager selectionManager)
{
Expand All @@ -49,26 +49,26 @@ void OnSelectionChanged(SceneNodeSelectedEvent selectionChangedEvent)
return;

if (CanMakeEditable(_activeNode))
Items.Add(new ContextMenuItem("Make Editable", new RelayCommand(MakeEditable)));
Items.Add(new ContextMenuItem("Make Editable", MakeEditable));

if (IsUngroupable(_activeNode))
Items.Add(new ContextMenuItem("Ungroup", new RelayCommand(Ungroup)));
Items.Add(new ContextMenuItem("Ungroup", Ungroup));

if (IsLockable(_activeNode))
Items.Add(new ContextMenuItem("Lock", new RelayCommand(ToggleLock)));
Items.Add(new ContextMenuItem("Lock", ToggleLock));
else if (IsUnlockable(_activeNode))
Items.Add(new ContextMenuItem("Unlock", new RelayCommand(ToggleLock)));
Items.Add(new ContextMenuItem("Unlock", ToggleLock));

if (Items.Count != 0)
Items.Add(null);
Items.Add(new ContextMenuItem("Invert Selection", new RelayCommand(InvertSelection)));
Items.Add(new ContextMenuItem("Select Similarly Named", new RelayCommand(SelectSimilar)));
Items.Add(new ContextMenuItem("Invert Selection", InvertSelection));
Items.Add(new ContextMenuItem("Select Similarly Named", SelectSimilar));

if (IsRemovable(_activeNode))
{
if (Items.Count != 0)
Items.Add(null);
Items.Add(new ContextMenuItem("Remove", new RelayCommand(RemoveNode)));
Items.Add(new ContextMenuItem("Remove", RemoveNode));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,27 @@
<CheckBox IsChecked="{Binding UseSkin, UpdateSourceTrigger=PropertyChanged}"/>
</basedialogs:AeAttribute>

<basedialogs:AeAttribute DockPanel.Dock="Top" LabelText="{loc:Loc KitbashTool.AdvancedRmv.DirtMap}" LabelWidth="{StaticResource labelWidth}" ToolTipEnumValue="None" IsEnabled="{Binding ShowDirtMap, UpdateSourceTrigger=PropertyChanged}">
<basedialogs:AeAttribute DockPanel.Dock="Top" LabelText="{loc:Loc KitbashTool.AdvancedRmv.DirtMap}" LabelWidth="{StaticResource labelWidth}" IsEnabled="{Binding ShowDirtMap, UpdateSourceTrigger=PropertyChanged}">
<userinterface:ShaderTextureView DataContext="{Binding DirtMap}"/>
</basedialogs:AeAttribute>

<basedialogs:AeAttribute DockPanel.Dock="Top" LabelText="{loc:Loc KitbashTool.AdvancedRmv.DirtMask}" LabelWidth="{StaticResource labelWidth}" ToolTipEnumValue="None" IsEnabled="{Binding ShowDirtMask, UpdateSourceTrigger=PropertyChanged}">
<basedialogs:AeAttribute DockPanel.Dock="Top" LabelText="{loc:Loc KitbashTool.AdvancedRmv.DirtMask}" LabelWidth="{StaticResource labelWidth}" IsEnabled="{Binding ShowDirtMask, UpdateSourceTrigger=PropertyChanged}">
<userinterface:ShaderTextureView DataContext="{Binding DirtMask}"/>
</basedialogs:AeAttribute>

<basedialogs:AeAttribute DockPanel.Dock="Top" LabelText="{loc:Loc KitbashTool.AdvancedRmv.SkinMask}" LabelWidth="{StaticResource labelWidth}" ToolTipEnumValue="None" IsEnabled="{Binding ShowSkinMask, UpdateSourceTrigger=PropertyChanged}">
<basedialogs:AeAttribute DockPanel.Dock="Top" LabelText="{loc:Loc KitbashTool.AdvancedRmv.SkinMask}" LabelWidth="{StaticResource labelWidth}" IsEnabled="{Binding ShowSkinMask, UpdateSourceTrigger=PropertyChanged}">
<userinterface:ShaderTextureView DataContext="{Binding SkinMask}"/>
</basedialogs:AeAttribute>

<basedialogs:AeAttribute DockPanel.Dock="Top" LabelText="{loc:Loc KitbashTool.AdvancedRmv.DecalMask}" LabelWidth="{StaticResource labelWidth}" ToolTipEnumValue="None" IsEnabled="{Binding ShowDecalMask, UpdateSourceTrigger=PropertyChanged}">
<basedialogs:AeAttribute DockPanel.Dock="Top" LabelText="{loc:Loc KitbashTool.AdvancedRmv.DecalMask}" LabelWidth="{StaticResource labelWidth}" IsEnabled="{Binding ShowDecalMask, UpdateSourceTrigger=PropertyChanged}">
<userinterface:ShaderTextureView DataContext="{Binding DecalMask}" />
</basedialogs:AeAttribute>

<basedialogs:AeAttribute DockPanel.Dock="Top" LabelText="{loc:Loc KitbashTool.AdvancedRmv.UvScale}" LabelWidth="{StaticResource labelWidth}" ToolTipEnumValue="None" IsEnabled="{Binding ShowUvScale, UpdateSourceTrigger=PropertyChanged}">
<basedialogs:AeAttribute DockPanel.Dock="Top" LabelText="{loc:Loc KitbashTool.AdvancedRmv.UvScale}" LabelWidth="{StaticResource labelWidth}" IsEnabled="{Binding ShowUvScale, UpdateSourceTrigger=PropertyChanged}">
<mathviews1:Vector2View DataContext="{Binding UvScale}" />
</basedialogs:AeAttribute>

<basedialogs:AeAttribute DockPanel.Dock="Top" LabelText="{loc:Loc KitbashTool.AdvancedRmv.TextureTransform}" LabelWidth="{StaticResource labelWidth}" ToolTipEnumValue="None" IsEnabled="{Binding ShowTextureTransform, UpdateSourceTrigger=PropertyChanged}">
<basedialogs:AeAttribute DockPanel.Dock="Top" LabelText="{loc:Loc KitbashTool.AdvancedRmv.TextureTransform}" LabelWidth="{StaticResource labelWidth}" IsEnabled="{Binding ShowTextureTransform, UpdateSourceTrigger=PropertyChanged}">
<mathviews11:Vector4View Vector4="{Binding TextureTransform}" />
</basedialogs:AeAttribute>

Expand Down
Loading
Loading