From c9326032df46f5535b71fe1ae222059b0c4ed2ff Mon Sep 17 00:00:00 2001 From: Shaf Manzur Date: Wed, 25 Dec 2024 18:49:32 -0500 Subject: [PATCH 01/14] initialize a template --- Mapping_Tools/Viewmodels/RadialDesignerVm.cs | 28 +++++++ .../RadialDesigner/RadialDesignerView.xaml | 58 ++++++++++++++ .../RadialDesigner/RadialDesignerView.xaml.cs | 76 +++++++++++++++++++ 3 files changed, 162 insertions(+) create mode 100644 Mapping_Tools/Viewmodels/RadialDesignerVm.cs create mode 100644 Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml create mode 100644 Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs diff --git a/Mapping_Tools/Viewmodels/RadialDesignerVm.cs b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs new file mode 100644 index 00000000..6ccbe5be --- /dev/null +++ b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs @@ -0,0 +1,28 @@ +using Mapping_Tools.Classes.SystemTools; +using Newtonsoft.Json; + +namespace Mapping_Tools.Viewmodels { + public class RadialDesignerVm : BindableBase { + #region Properties + + [JsonIgnore] + public string[] Paths { + get; set; + } + + [JsonIgnore] + public bool Quick { + get; set; + } + + // Add any properties you might need in the future + + #endregion + + public RadialDesignerVm() { + // Initialize default values if necessary + } + + // Add any methods or enums if needed in the future + } +} diff --git a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml new file mode 100644 index 00000000..fee1e9fb --- /dev/null +++ b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs new file mode 100644 index 00000000..c8f6dcc2 --- /dev/null +++ b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs @@ -0,0 +1,76 @@ +using System; +using System.ComponentModel; +using System.IO; +using System.Windows; +using System.Windows.Input; +using Mapping_Tools.Classes.SystemTools; +using Mapping_Tools.Classes.SystemTools.QuickRun; +using Mapping_Tools.Viewmodels; + +namespace Mapping_Tools.Views.RadialDesigner { + /// + /// Interaction logic for RadialDesignerView.xaml + /// + [SmartQuickRunUsage(SmartQuickRunTargets.MultipleSelection)] + [VerticalContentScroll] + [HorizontalContentScroll] + public partial class RadialDesignerView : IQuickRun, ISavable { + public static readonly string ToolName = "Radial Designer"; + + public static readonly string ToolDescription = + @"Design radial patterns for your beatmaps."; + + public RadialDesignerView() { + InitializeComponent(); + Width = MainWindow.AppWindow.ContentViews.Width; + Height = MainWindow.AppWindow.ContentViews.Height; + DataContext = new RadialDesignerVm(); + ProjectManager.LoadProject(this, message: false); + } + + public RadialDesignerVm ViewModel => (RadialDesignerVm) DataContext; + + public event EventHandler RunFinished; + + public void QuickRun() { + RunTool(new[] { IOHelper.GetCurrentBeatmapOrCurrentBeatmap() }, true); + } + + protected override void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { + // Implement the background work if needed in the future + // Currently, nothing to do since no functionality is implemented + e.Result = string.Empty; + } + + private void Start_Click(object sender, RoutedEventArgs e) { + RunTool(MainWindow.AppWindow.GetCurrentMaps()); + } + + private void RunTool(string[] paths, bool quick = false) { + if (!CanRun) return; + + // Remove logical focus to trigger LostFocus on any fields that didn't yet update the ViewModel + FocusManager.SetFocusedElement(FocusManager.GetFocusScope(this), null); + + BackupManager.SaveMapBackup(paths); + + ViewModel.Paths = paths; + ViewModel.Quick = quick; + + BackgroundWorker.RunWorkerAsync(ViewModel); + CanRun = false; + } + + public RadialDesignerVm GetSaveData() { + return ViewModel; + } + + public void SetSaveData(RadialDesignerVm saveData) { + DataContext = saveData; + } + + public string AutoSavePath => Path.Combine(MainWindow.AppDataPath, "radialdesignerproject.json"); + + public string DefaultSaveFolder => Path.Combine(MainWindow.AppDataPath, "Radial Designer Projects"); + } +} From 900c8119d1f5f029dd3e41df5d4b4e3acf660602 Mon Sep 17 00:00:00 2001 From: Shaf Manzur Date: Wed, 25 Dec 2024 21:21:51 -0500 Subject: [PATCH 02/14] ui almost done --- Mapping_Tools/Viewmodels/RadialDesignerVm.cs | 37 +++++- .../RadialDesigner/RadialDesignerView.xaml | 112 ++++++++++++++---- .../RadialDesigner/RadialDesignerView.xaml.cs | 33 +++++- 3 files changed, 152 insertions(+), 30 deletions(-) diff --git a/Mapping_Tools/Viewmodels/RadialDesignerVm.cs b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs index 6ccbe5be..8be242c3 100644 --- a/Mapping_Tools/Viewmodels/RadialDesignerVm.cs +++ b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs @@ -1,4 +1,5 @@ using Mapping_Tools.Classes.SystemTools; +using Mapping_Tools.Components.ObjectVisualiser; using Newtonsoft.Json; namespace Mapping_Tools.Viewmodels { @@ -15,12 +16,44 @@ public bool Quick { get; set; } - // Add any properties you might need in the future + private int copies; + public int Copies { + get => copies; + set => Set(ref copies, value); + } + + private double distance; + public double Distance { + get => distance; + set => Set(ref distance, value); + } + + private double localRotation; + public double LocalRotation { + get => localRotation; + set => Set(ref localRotation, value); + } + + private double globalRotation; + public double GlobalRotation { + get => globalRotation; + set => Set(ref globalRotation, value); + } + + private HitObjectElement tumouredPreviewHitObject; + public HitObjectElement TumouredPreviewHitObject { + get => tumouredPreviewHitObject; + set => Set(ref tumouredPreviewHitObject, value); + } #endregion public RadialDesignerVm() { - // Initialize default values if necessary + Copies = 1; + Distance = 100; + LocalRotation = 0; + GlobalRotation = 0; + TumouredPreviewHitObject = new HitObjectElement(); } // Add any methods or enums if needed in the future diff --git a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml index fee1e9fb..5e807c02 100644 --- a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml +++ b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml @@ -1,46 +1,97 @@  + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="clr-namespace:Mapping_Tools.Views" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:objectVisualiser="clr-namespace:Mapping_Tools.Components.ObjectVisualiser" + xmlns:domain="clr-namespace:Mapping_Tools.Components.Domain" + mc:Ignorable="d" + x:Name="This" + d:DesignHeight="450" Width="800" d:DataContext="{d:DesignData RadialDesignerVM}"> + + + + + + + - + + + + + + + Generate radial patterns by copying and rotating hit objects around a center point. + + Adjust the number of copies, distance, and rotation to create various circular patterns. + + - - - - - + + + + + + + + + + + - + + + + + + + + + + @@ -54,5 +105,16 @@ + + + + - + \ No newline at end of file diff --git a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs index c8f6dcc2..fffeb6cf 100644 --- a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs +++ b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs @@ -5,6 +5,7 @@ using System.Windows.Input; using Mapping_Tools.Classes.SystemTools; using Mapping_Tools.Classes.SystemTools.QuickRun; +using Mapping_Tools.Components.ObjectVisualiser; using Mapping_Tools.Viewmodels; namespace Mapping_Tools.Views.RadialDesigner { @@ -37,9 +38,8 @@ public void QuickRun() { } protected override void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { - // Implement the background work if needed in the future - // Currently, nothing to do since no functionality is implemented - e.Result = string.Empty; + var bgw = sender as BackgroundWorker; + e.Result = RunRadialDesigner((RadialDesignerVm) e.Argument, bgw); } private void Start_Click(object sender, RoutedEventArgs e) { @@ -61,6 +61,33 @@ private void RunTool(string[] paths, bool quick = false) { CanRun = false; } + private string RunRadialDesigner(RadialDesignerVm arg, BackgroundWorker worker) { + // Implement the radial design logic here + // For now, we'll simulate a process + + for (int i = 0; i <= 100; i++) { + if (worker.WorkerReportsProgress) { + worker.ReportProgress(i); + } + System.Threading.Thread.Sleep(10); + } + + // Update the preview + ViewModel.TumouredPreviewHitObject = new HitObjectElement { + // Initialize with example data + }; + + // Complete progressbar + if (worker.WorkerReportsProgress) worker.ReportProgress(100); + + // Do stuff + RunFinished?.Invoke(this, new RunToolCompletedEventArgs(true, true, arg.Quick)); + + // Make an accurate message + var message = "Radial pattern designed successfully!"; + return arg.Quick ? "" : message; + } + public RadialDesignerVm GetSaveData() { return ViewModel; } From d952ed9d1afc8b8ee3402cd78af528b2efa454c1 Mon Sep 17 00:00:00 2001 From: shaf Date: Wed, 25 Dec 2024 22:57:17 -0500 Subject: [PATCH 03/14] a button --- Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml index 5e807c02..b750d852 100644 --- a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml +++ b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml @@ -73,6 +73,7 @@ Style="{StaticResource MaterialDesignDiscreteSlider}" ToolTip="Overall rotation applied to the radial pattern." Margin="0,0,0,10"/> + + + + + + + + + + + + + @@ -98,7 +132,7 @@ - + diff --git a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs index cdca3fa5..17dfc662 100644 --- a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs +++ b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs @@ -70,8 +70,7 @@ private string Generate_Sliders(RadialDesignerVm arg, BackgroundWorker worker) { var beatmap = editor.Beatmap; - // TODO: Implement radial pattern generation logic here - // For now, just save the imported slider + // Save the file after processing editor.SaveFile(); } From 6f863c6110306a8a1457f95901e012acdf39413a Mon Sep 17 00:00:00 2001 From: freshfriedfish Date: Mon, 30 Dec 2024 22:51:21 -0500 Subject: [PATCH 08/14] add functionality of importmode dropdown --- Mapping_Tools/Viewmodels/RadialDesignerVm.cs | 39 ++++++++++++++++++- .../RadialDesigner/RadialDesignerView.xaml | 11 +++--- .../RadialDesigner/RadialDesignerView.xaml.cs | 32 ++++++++++----- 3 files changed, 67 insertions(+), 15 deletions(-) diff --git a/Mapping_Tools/Viewmodels/RadialDesignerVm.cs b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs index a2836833..70b24946 100644 --- a/Mapping_Tools/Viewmodels/RadialDesignerVm.cs +++ b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs @@ -1,4 +1,8 @@ -using Mapping_Tools.Classes.SystemTools; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows; +using Mapping_Tools.Classes.SystemTools; using Newtonsoft.Json; namespace Mapping_Tools.Viewmodels { @@ -39,6 +43,36 @@ public double GlobalRotation { set => Set(ref globalRotation, value); } + public enum ImportMode { + Selected, + Bookmarked, + Time, + Everything + } + + private ImportMode importModeSetting; + public ImportMode ImportModeSetting { + get => importModeSetting; + set { + if (Set(ref importModeSetting, value)) { + RaisePropertyChanged(nameof(TimeCodeBoxVisibility)); + } + } + } + + [JsonIgnore] + public IEnumerable ImportModes => Enum.GetValues(typeof(ImportMode)).Cast(); + + private string timeCode; + public string TimeCode { + get => timeCode; + set => Set(ref timeCode, value); + } + + [JsonIgnore] + public Visibility TimeCodeBoxVisibility => + ImportModeSetting == ImportMode.Time ? Visibility.Visible : Visibility.Collapsed; + #endregion public RadialDesignerVm() { @@ -46,6 +80,9 @@ public RadialDesignerVm() { Distance = 0; LocalRotation = 0; GlobalRotation = 0; + + ImportModeSetting = ImportMode.Selected; + TimeCode = ""; } } } diff --git a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml index f0b44ad8..fba283c7 100644 --- a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml +++ b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml @@ -18,7 +18,7 @@ - + @@ -81,11 +81,13 @@ + ToolTip="Import" + Style="{StaticResource MaterialDesignFloatingHintComboBox}" + materialDesign:HintAssist.Hint="Object selection mode"/> + materialDesign:HintAssist.Hint="Time code" + ToolTip="Input a time code here. Example: 01:23:456 (1,2) " /> + + - - - - - - - - - - - - - - - - - - - - - - - From b4a5545a13ad4bb827834632a8c83209356469eb Mon Sep 17 00:00:00 2001 From: freshfriedfish Date: Mon, 30 Dec 2024 23:30:20 -0500 Subject: [PATCH 10/14] added a "CenterMode" option to pick between the first hitobject, or the average of all hitobjects, as the central point --- Mapping_Tools/Viewmodels/RadialDesignerVm.cs | 13 +++++++++++++ .../Views/RadialDesigner/RadialDesignerView.xaml | 7 ++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Mapping_Tools/Viewmodels/RadialDesignerVm.cs b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs index 70b24946..fe3d033a 100644 --- a/Mapping_Tools/Viewmodels/RadialDesignerVm.cs +++ b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs @@ -73,6 +73,19 @@ public string TimeCode { public Visibility TimeCodeBoxVisibility => ImportModeSetting == ImportMode.Time ? Visibility.Visible : Visibility.Collapsed; + public enum CenterMode { + First, + Average + } + + private CenterMode centerModeSetting; + public CenterMode CenterModeSetting { + get => centerModeSetting; + set => Set(ref centerModeSetting, value); + } + + public IEnumerable CenterModes => Enum.GetValues(typeof(CenterMode)).Cast(); + #endregion public RadialDesignerVm() { diff --git a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml index 03723366..13a9db76 100644 --- a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml +++ b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml @@ -97,6 +97,12 @@ Style="{StaticResource MaterialDesignDiscreteSlider}" ToolTip="Overall rotation applied to the radial pattern." /> + @@ -108,7 +114,6 @@ ShowsPreview="True"/> - From cbd4b8346c449f4fa8085d2df8a63e2edae5b16d Mon Sep 17 00:00:00 2001 From: freshfriedfish Date: Wed, 1 Jan 2025 12:28:54 -0500 Subject: [PATCH 11/14] implement ui functionality of export --- Mapping_Tools/Viewmodels/RadialDesignerVm.cs | 46 +++++++++++++++---- .../RadialDesigner/RadialDesignerView.xaml | 20 ++++++-- 2 files changed, 54 insertions(+), 12 deletions(-) diff --git a/Mapping_Tools/Viewmodels/RadialDesignerVm.cs b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs index fe3d033a..e9487706 100644 --- a/Mapping_Tools/Viewmodels/RadialDesignerVm.cs +++ b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs @@ -43,6 +43,18 @@ public double GlobalRotation { set => Set(ref globalRotation, value); } + private string importTimeCode; + public string ImportTimeCode { + get => importTimeCode; + set => Set(ref importTimeCode, value); + } + + private string exportTimeCode; + public string ExportTimeCode { + get => exportTimeCode; + set => Set(ref exportTimeCode, value); + } + public enum ImportMode { Selected, Bookmarked, @@ -55,7 +67,7 @@ public ImportMode ImportModeSetting { get => importModeSetting; set { if (Set(ref importModeSetting, value)) { - RaisePropertyChanged(nameof(TimeCodeBoxVisibility)); + RaisePropertyChanged(nameof(ImportTimeCodeBoxVisibility)); } } } @@ -63,15 +75,33 @@ public ImportMode ImportModeSetting { [JsonIgnore] public IEnumerable ImportModes => Enum.GetValues(typeof(ImportMode)).Cast(); - private string timeCode; - public string TimeCode { - get => timeCode; - set => Set(ref timeCode, value); + [JsonIgnore] + public Visibility ImportTimeCodeBoxVisibility => + ImportModeSetting == ImportMode.Time ? Visibility.Visible : Visibility.Collapsed; + + public enum ExportMode { + Auto, + Current, + Time, + } + + private ExportMode exportModeSetting; + public ExportMode ExportModeSetting { + get => exportModeSetting; + set { + if (Set(ref exportModeSetting, value)) { + RaisePropertyChanged(nameof(ExportTimeCodeBoxVisibility)); + } + } } [JsonIgnore] - public Visibility TimeCodeBoxVisibility => - ImportModeSetting == ImportMode.Time ? Visibility.Visible : Visibility.Collapsed; + public IEnumerable ExportModes => Enum.GetValues(typeof(ExportMode)).Cast(); + + [JsonIgnore] + public Visibility ExportTimeCodeBoxVisibility => + ExportModeSetting == ExportMode.Time ? Visibility.Visible : Visibility.Collapsed; + public enum CenterMode { First, @@ -95,7 +125,7 @@ public RadialDesignerVm() { GlobalRotation = 0; ImportModeSetting = ImportMode.Selected; - TimeCode = ""; + ImportTimeCode = ""; } } } diff --git a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml index 13a9db76..c5d55bb5 100644 --- a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml +++ b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml @@ -55,7 +55,7 @@ Style="{StaticResource MaterialDesignFloatingHintComboBox}" materialDesign:HintAssist.Hint="Import mode"/> - @@ -64,10 +64,21 @@ Dummy - + + + + + + + materialDesign:HintAssist.Hint="Export mode"/> + + + From d116fff9ad35d1febc0c293200f372b943ac65eb Mon Sep 17 00:00:00 2001 From: freshfriedfish Date: Wed, 1 Jan 2025 14:21:08 -0500 Subject: [PATCH 12/14] delete the combobox for centerModes --- Mapping_Tools/Viewmodels/RadialDesignerVm.cs | 14 -------------- .../Views/RadialDesigner/RadialDesignerView.xaml | 8 +------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/Mapping_Tools/Viewmodels/RadialDesignerVm.cs b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs index e9487706..9c297a6d 100644 --- a/Mapping_Tools/Viewmodels/RadialDesignerVm.cs +++ b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs @@ -102,20 +102,6 @@ public ExportMode ExportModeSetting { public Visibility ExportTimeCodeBoxVisibility => ExportModeSetting == ExportMode.Time ? Visibility.Visible : Visibility.Collapsed; - - public enum CenterMode { - First, - Average - } - - private CenterMode centerModeSetting; - public CenterMode CenterModeSetting { - get => centerModeSetting; - set => Set(ref centerModeSetting, value); - } - - public IEnumerable CenterModes => Enum.GetValues(typeof(CenterMode)).Cast(); - #endregion public RadialDesignerVm() { diff --git a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml index c5d55bb5..30da43e3 100644 --- a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml +++ b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml @@ -15,6 +15,7 @@ + @@ -108,13 +109,6 @@ Style="{StaticResource MaterialDesignDiscreteSlider}" ToolTip="Overall rotation applied to the radial pattern." /> - From ce0cb412191cb78a6a6a66ff8dc3e596224c4868 Mon Sep 17 00:00:00 2001 From: freshfriedfish Date: Wed, 1 Jan 2025 14:26:08 -0500 Subject: [PATCH 13/14] implemented checkbox for centering logic --- Mapping_Tools/Viewmodels/RadialDesignerVm.cs | 7 +++++++ Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml | 5 +++++ .../Views/RadialDesigner/RadialDesignerView.xaml.cs | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/Mapping_Tools/Viewmodels/RadialDesignerVm.cs b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs index 9c297a6d..a7934799 100644 --- a/Mapping_Tools/Viewmodels/RadialDesignerVm.cs +++ b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs @@ -43,6 +43,12 @@ public double GlobalRotation { set => Set(ref globalRotation, value); } + private bool moveToCenter; + public bool MoveToCenter { + get => moveToCenter; + set => Set(ref moveToCenter, value); + } + private string importTimeCode; public string ImportTimeCode { get => importTimeCode; @@ -95,6 +101,7 @@ public ExportMode ExportModeSetting { } } + [JsonIgnore] public IEnumerable ExportModes => Enum.GetValues(typeof(ExportMode)).Cast(); diff --git a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml index 30da43e3..a7e9a620 100644 --- a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml +++ b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml @@ -109,6 +109,11 @@ Style="{StaticResource MaterialDesignDiscreteSlider}" ToolTip="Overall rotation applied to the radial pattern." /> + + Move to center + diff --git a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs index c83e06f0..2aa53001 100644 --- a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs +++ b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs @@ -83,6 +83,10 @@ private string Generate_Sliders(RadialDesignerVm arg, BackgroundWorker worker) { break; } + if (arg.MoveToCenter) { + // Implement center movement logic + } + // Save after processing editor.SaveFile(); } From a8b8dbde3f1a1fc780be8f7eb8936b4b95c727cf Mon Sep 17 00:00:00 2001 From: freshfriedfish Date: Thu, 16 Jan 2025 19:32:13 -0500 Subject: [PATCH 14/14] remove movetocenter checkbox --- Mapping_Tools/Viewmodels/RadialDesignerVm.cs | 7 ---- .../RadialDesigner/RadialDesignerView.xaml | 5 --- .../RadialDesigner/RadialDesignerView.xaml.cs | 37 +++++++++++++------ 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/Mapping_Tools/Viewmodels/RadialDesignerVm.cs b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs index a7934799..af60a724 100644 --- a/Mapping_Tools/Viewmodels/RadialDesignerVm.cs +++ b/Mapping_Tools/Viewmodels/RadialDesignerVm.cs @@ -42,13 +42,6 @@ public double GlobalRotation { get => globalRotation; set => Set(ref globalRotation, value); } - - private bool moveToCenter; - public bool MoveToCenter { - get => moveToCenter; - set => Set(ref moveToCenter, value); - } - private string importTimeCode; public string ImportTimeCode { get => importTimeCode; diff --git a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml index a7e9a620..30da43e3 100644 --- a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml +++ b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml @@ -109,11 +109,6 @@ Style="{StaticResource MaterialDesignDiscreteSlider}" ToolTip="Overall rotation applied to the radial pattern." /> - - Move to center - diff --git a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs index 2aa53001..d17c4071 100644 --- a/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs +++ b/Mapping_Tools/Views/RadialDesigner/RadialDesignerView.xaml.cs @@ -1,13 +1,17 @@ using System; +using System.Collections.Generic; using System.ComponentModel; using System.IO; +using System.Linq; using System.Windows; using System.Windows.Input; +using Mapping_Tools.Classes.BeatmapHelper; using Mapping_Tools.Classes.SystemTools; using Mapping_Tools.Classes.SystemTools.QuickRun; using Mapping_Tools.Classes.ToolHelpers; using Mapping_Tools.Viewmodels; + namespace Mapping_Tools.Views.RadialDesigner { [SmartQuickRunUsage(SmartQuickRunTargets.MultipleSelection)] [VerticalContentScroll] @@ -59,49 +63,60 @@ private void RunTool(string[] paths, bool quick = false) { private string Generate_Sliders(RadialDesignerVm arg, BackgroundWorker worker) { var reader = EditorReaderStuff.GetFullEditorReaderOrNot(out var editorReaderException); - // Iterate over each map foreach (var path in arg.Paths) { var editor = EditorReaderStuff.GetNewestVersionOrNot(path, reader, out var selected, out var editorReaderException2); - if (editorReaderException2 != null) { + if (editorReaderException2 != null && arg.ImportModeSetting == RadialDesignerVm.ImportMode.Selected) { throw new Exception("Could not fetch selected hit objects.", editorReaderException2); } var beatmap = editor.Beatmap; + var beatDivisor = beatmap.Editor["BeatDivisor"].IntValue; + // 1) IMPORT for ImportMode.Selected: + List importedObjects = new List(); switch (arg.ImportModeSetting) { case RadialDesignerVm.ImportMode.Selected: - // selected hit objects + importedObjects = selected.ToList(); break; case RadialDesignerVm.ImportMode.Bookmarked: - // beatmap.GetBookmarkedObjects() + // omitted for now break; case RadialDesignerVm.ImportMode.Time: - // beatmap.QueryTimeCode(arg.TimeCode) + // omitted for now break; case RadialDesignerVm.ImportMode.Everything: - // beatmap.HitObjects + // omitted for now break; } - if (arg.MoveToCenter) { - // Implement center movement logic + // 2) APPLY ExportMode.Auto + the "copies" parameter: + if (arg.ExportModeSetting == RadialDesignerVm.ExportMode.Auto) { + // Example: duplicate each imported object 'Copies' times and add them + // (This snippet does not rotate or move them—just demonstrates duplication) + var allNewObjects = new List(); + foreach (var ho in importedObjects) { + for (int i = 0; i < arg.Copies; i++) { + // Create a deep copy. (Implementation of Copy() or equivalent is up to you.) + var copy = ho.DeepCopy(); + allNewObjects.Add(copy); + } + } + beatmap.HitObjects.AddRange(allNewObjects); } // Save after processing editor.SaveFile(); } - // Complete progressbar if (worker != null && worker.WorkerReportsProgress) { worker.ReportProgress(100); } - // Fire event RunFinished?.Invoke(this, new RunToolCompletedEventArgs(true, reader != null, arg.Quick)); - return arg.Quick ? "" : "Successfully generated radial patterns!"; } + public RadialDesignerVm GetSaveData() { return ViewModel; }