diff options
-rw-r--r-- | CHANGELOG.md | 6 | ||||
-rw-r--r-- | CREDITS.md | 3 | ||||
-rw-r--r-- | UVtools.Core/Layer/LayerManager.cs | 70 | ||||
-rw-r--r-- | UVtools.Core/Operations/OperationLayerClone.cs | 1 | ||||
-rw-r--r-- | UVtools.Core/Operations/OperationLayerImport.cs | 1 | ||||
-rw-r--r-- | UVtools.Core/Operations/OperationLayerReHeight.cs | 1 | ||||
-rw-r--r-- | UVtools.Core/Operations/OperationLayerRemove.cs | 1 | ||||
-rw-r--r-- | UVtools.Core/UVtools.Core.csproj | 2 | ||||
-rw-r--r-- | UVtools.WPF/MainWindow.Clipboard.cs | 9 | ||||
-rw-r--r-- | UVtools.WPF/MainWindow.axaml | 2 | ||||
-rw-r--r-- | UVtools.WPF/MainWindow.axaml.cs | 10 | ||||
-rw-r--r-- | UVtools.WPF/UVtools.WPF.csproj | 2 | ||||
-rw-r--r-- | UVtools.WPF/UserSettings.cs | 7 | ||||
-rw-r--r-- | UVtools.WPF/Windows/SettingsWindow.axaml | 13 |
14 files changed, 101 insertions, 27 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index c84aa05..66ef747 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 22/01/2021 - v2.3.2 + +* (Add) Settings - Automations: Change only light-off delay if value is zero (Enabled by default) +* (Fix) Calibrators: Some file formats will crash when calibration test output more layers than the dummy file +* (Fix) Undo/redo don't unlock the save function + ## 19/01/2021 - v2.3.1 * (Add) Calibrator - Stress Tower: Generates a stress tower to test the printer capabilities @@ -42,4 +42,5 @@ * Timothy Gray * David Gordon * Claus Pfeilschifter -* Chris Taatgen
\ No newline at end of file +* Chris Taatgen +* Andrew Griffiths
\ No newline at end of file diff --git a/UVtools.Core/Layer/LayerManager.cs b/UVtools.Core/Layer/LayerManager.cs index a9841ce..a5ec45d 100644 --- a/UVtools.Core/Layer/LayerManager.cs +++ b/UVtools.Core/Layer/LayerManager.cs @@ -43,6 +43,7 @@ namespace UVtools.Core _layers = value; BoundingRectangle = Rectangle.Empty; SlicerFile.LayerCount = Count; + SlicerFile.RequireFullEncode = true; if (value is null) return; SlicerFile.PrintTime = SlicerFile.PrintTimeComputed; } @@ -187,19 +188,64 @@ namespace UVtools.Core { var layer = this[layerIndex]; layer.Index = layerIndex; - - if(property is null || property == nameof(SlicerFile.BottomExposureTime) || property == nameof(SlicerFile.ExposureTime)) - layer.ExposureTime = SlicerFile.GetInitialLayerValueOrNormal(layerIndex, SlicerFile.BottomExposureTime, SlicerFile.ExposureTime); - if (property is null || property == nameof(SlicerFile.BottomLiftHeight) || property == nameof(SlicerFile.LiftHeight)) - layer.LiftHeight = SlicerFile.GetInitialLayerValueOrNormal(layerIndex, SlicerFile.BottomLiftHeight, SlicerFile.LiftHeight); - if (property is null || property == nameof(SlicerFile.BottomLiftSpeed) || property == nameof(SlicerFile.LiftSpeed)) - layer.LiftSpeed = SlicerFile.GetInitialLayerValueOrNormal(layerIndex, SlicerFile.BottomLiftSpeed, SlicerFile.LiftSpeed); - if (property is null || property == nameof(SlicerFile.RetractSpeed)) - layer.RetractSpeed = SlicerFile.RetractSpeed; - if (property is null || property == nameof(SlicerFile.BottomLightPWM) || property == nameof(SlicerFile.LightPWM)) - layer.LightPWM = SlicerFile.GetInitialLayerValueOrNormal(layerIndex, SlicerFile.BottomLightPWM, SlicerFile.LightPWM); - if (property is null || property == nameof(SlicerFile.BottomLightOffDelay) || property == nameof(SlicerFile.LightOffDelay)) + + if (property is null) + { + layer.ExposureTime = SlicerFile.GetInitialLayerValueOrNormal(layerIndex, SlicerFile.BottomExposureTime, SlicerFile.ExposureTime); + layer.LiftHeight = SlicerFile.GetInitialLayerValueOrNormal(layerIndex, SlicerFile.BottomLiftHeight, SlicerFile.LiftHeight); + layer.LiftSpeed = SlicerFile.GetInitialLayerValueOrNormal(layerIndex, SlicerFile.BottomLiftSpeed, SlicerFile.LiftSpeed); + layer.RetractSpeed = SlicerFile.RetractSpeed; + layer.LightPWM = SlicerFile.GetInitialLayerValueOrNormal(layerIndex, SlicerFile.BottomLightPWM, SlicerFile.LightPWM); layer.LightOffDelay = SlicerFile.GetInitialLayerValueOrNormal(layerIndex, SlicerFile.BottomLightOffDelay, SlicerFile.LightOffDelay); + } + else + { + if (layer.IsNormalLayer) + { + switch (property) + { + case nameof(SlicerFile.ExposureTime): + layer.ExposureTime = SlicerFile.ExposureTime; + break; + case nameof(SlicerFile.LiftHeight): + layer.LiftHeight = SlicerFile.LiftHeight; + break; + case nameof(SlicerFile.LiftSpeed): + layer.LiftSpeed = SlicerFile.LiftSpeed; + break; + case nameof(SlicerFile.LightOffDelay): + layer.LightOffDelay = SlicerFile.LightOffDelay; + break; + case nameof(SlicerFile.LightPWM): + layer.LightPWM = SlicerFile.LightPWM; + break; + } + } + else // Bottom layers + { + switch (property) + { + case nameof(SlicerFile.BottomExposureTime): + layer.ExposureTime = SlicerFile.BottomExposureTime; + break; + case nameof(SlicerFile.BottomLiftHeight): + layer.LiftHeight = SlicerFile.BottomLiftHeight; + break; + case nameof(SlicerFile.BottomLiftSpeed): + layer.LiftSpeed = SlicerFile.BottomLiftSpeed; + break; + case nameof(SlicerFile.RetractSpeed): + layer.RetractSpeed = SlicerFile.RetractSpeed; + break; + case nameof(SlicerFile.BottomLightOffDelay): + layer.LightOffDelay = SlicerFile.BottomLightOffDelay; + break; + case nameof(SlicerFile.BottomLightPWM): + layer.LightPWM = SlicerFile.BottomLightPWM; + break; + } + } + } if (recalculateZPos) { diff --git a/UVtools.Core/Operations/OperationLayerClone.cs b/UVtools.Core/Operations/OperationLayerClone.cs index 211cb7d..5ec7c28 100644 --- a/UVtools.Core/Operations/OperationLayerClone.cs +++ b/UVtools.Core/Operations/OperationLayerClone.cs @@ -108,7 +108,6 @@ namespace UVtools.Core.Operations } slicerFile.LayerManager.Layers = layers; - slicerFile.RequireFullEncode = true; progress.Token.ThrowIfCancellationRequested(); diff --git a/UVtools.Core/Operations/OperationLayerImport.cs b/UVtools.Core/Operations/OperationLayerImport.cs index 7e5b822..a540004 100644 --- a/UVtools.Core/Operations/OperationLayerImport.cs +++ b/UVtools.Core/Operations/OperationLayerImport.cs @@ -495,7 +495,6 @@ namespace UVtools.Core.Operations slicerFile.LayerManager.RebuildLayersProperties(); slicerFile.SuppressRebuildProperties = false; - slicerFile.RequireFullEncode = true; return true; } diff --git a/UVtools.Core/Operations/OperationLayerReHeight.cs b/UVtools.Core/Operations/OperationLayerReHeight.cs index fb04a34..bcd93d5 100644 --- a/UVtools.Core/Operations/OperationLayerReHeight.cs +++ b/UVtools.Core/Operations/OperationLayerReHeight.cs @@ -173,7 +173,6 @@ namespace UVtools.Core.Operations slicerFile.LayerManager.Layers = layers; slicerFile.LayerHeight = (float)Item.LayerHeight; - slicerFile.RequireFullEncode = true; return true; } diff --git a/UVtools.Core/Operations/OperationLayerRemove.cs b/UVtools.Core/Operations/OperationLayerRemove.cs index 45816dd..5fa1907 100644 --- a/UVtools.Core/Operations/OperationLayerRemove.cs +++ b/UVtools.Core/Operations/OperationLayerRemove.cs @@ -104,7 +104,6 @@ namespace UVtools.Core.Operations } slicerFile.LayerManager.Layers = layers; - slicerFile.RequireFullEncode = true; return true; } diff --git a/UVtools.Core/UVtools.Core.csproj b/UVtools.Core/UVtools.Core.csproj index 2131a03..9bfaefd 100644 --- a/UVtools.Core/UVtools.Core.csproj +++ b/UVtools.Core/UVtools.Core.csproj @@ -10,7 +10,7 @@ <RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl> <PackageProjectUrl>https://github.com/sn4k3/UVtools</PackageProjectUrl> <Description>MSLA/DLP, file analysis, calibration, repair, conversion and manipulation</Description> - <Version>2.3.1</Version> + <Version>2.3.2</Version> <Copyright>Copyright © 2020 PTRTECH</Copyright> <PackageIcon>UVtools.png</PackageIcon> <Platforms>AnyCPU;x64</Platforms> diff --git a/UVtools.WPF/MainWindow.Clipboard.cs b/UVtools.WPF/MainWindow.Clipboard.cs index 6ef670c..bf8435d 100644 --- a/UVtools.WPF/MainWindow.Clipboard.cs +++ b/UVtools.WPF/MainWindow.Clipboard.cs @@ -51,6 +51,7 @@ namespace UVtools.WPF public void ClipboardUndo() { + CanSave = true; if ((_globalModifiers & KeyModifiers.Shift) != 0) { ClipboardUndo(true); @@ -61,6 +62,7 @@ namespace UVtools.WPF public async void ClipboardUndo(bool rerun) { + CanSave = true; var clip = Clipboard.CurrentClip; Clipboard.Undo(); if (!rerun) @@ -72,9 +74,16 @@ namespace UVtools.WPF if (operation is null) { Clipboard.Redo(); + CanSave = false; } } + public void ClipboardRedo() + { + CanSave = true; + Clipboard.Redo(); + } + public async void ClipboardClear() { if (await this.MessageBoxQuestion("Are you sure you want to clear the clipboard?\n" + diff --git a/UVtools.WPF/MainWindow.axaml b/UVtools.WPF/MainWindow.axaml index 70439b9..f2dcee6 100644 --- a/UVtools.WPF/MainWindow.axaml +++ b/UVtools.WPF/MainWindow.axaml @@ -1451,7 +1451,7 @@ <Button IsEnabled="{Binding Clipboard.CanRedo}" - Command="{Binding Clipboard.Redo}" + Command="{Binding ClipboardRedo}" HotKey="Ctrl + Y" ToolTip.Tip="Redo [Ctrl + Y]" > diff --git a/UVtools.WPF/MainWindow.axaml.cs b/UVtools.WPF/MainWindow.axaml.cs index 1118a95..f2b4647 100644 --- a/UVtools.WPF/MainWindow.axaml.cs +++ b/UVtools.WPF/MainWindow.axaml.cs @@ -1001,9 +1001,12 @@ namespace UVtools.WPF } bool modified = false; - if (Settings.Automations.BottomLightOffDelay > 0 && + if ( + Settings.Automations.BottomLightOffDelay > 0 && SlicerFile.PrintParameterModifiers is not null && - SlicerFile.PrintParameterModifiers.Contains(FileFormat.PrintParameterModifier.BottomLightOffDelay)) + SlicerFile.PrintParameterModifiers.Contains(FileFormat.PrintParameterModifier.BottomLightOffDelay) && + (!Settings.Automations.ChangeOnlyLightOffDelayIfZero || Settings.Automations.ChangeOnlyLightOffDelayIfZero && SlicerFile.BottomLightOffDelay <= 0) + ) { var lightOff = OperationCalculator.LightOffDelayC.CalculateSeconds(SlicerFile.BottomLiftHeight, SlicerFile.BottomLiftSpeed, SlicerFile.RetractSpeed, (float)Settings.Automations.BottomLightOffDelay); @@ -1016,7 +1019,8 @@ namespace UVtools.WPF if (Settings.Automations.LightOffDelay > 0 && SlicerFile.PrintParameterModifiers is not null && - SlicerFile.PrintParameterModifiers.Contains(FileFormat.PrintParameterModifier.LightOffDelay)) + SlicerFile.PrintParameterModifiers.Contains(FileFormat.PrintParameterModifier.LightOffDelay) && + (!Settings.Automations.ChangeOnlyLightOffDelayIfZero || Settings.Automations.ChangeOnlyLightOffDelayIfZero && SlicerFile.LightOffDelay <= 0)) { var lightOff = OperationCalculator.LightOffDelayC.CalculateSeconds(SlicerFile.LiftHeight, SlicerFile.LiftSpeed, SlicerFile.RetractSpeed, (float)Settings.Automations.LightOffDelay); diff --git a/UVtools.WPF/UVtools.WPF.csproj b/UVtools.WPF/UVtools.WPF.csproj index 4c56924..3db6b4e 100644 --- a/UVtools.WPF/UVtools.WPF.csproj +++ b/UVtools.WPF/UVtools.WPF.csproj @@ -12,7 +12,7 @@ <PackageLicenseFile>LICENSE</PackageLicenseFile> <RepositoryUrl>https://github.com/sn4k3/UVtools</RepositoryUrl> <RepositoryType>Git</RepositoryType> - <Version>2.3.1</Version> + <Version>2.3.2</Version> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> diff --git a/UVtools.WPF/UserSettings.cs b/UVtools.WPF/UserSettings.cs index 16b0ff5..d8686dd 100644 --- a/UVtools.WPF/UserSettings.cs +++ b/UVtools.WPF/UserSettings.cs @@ -1047,6 +1047,7 @@ namespace UVtools.WPF { private bool _saveFileAfterModifications = true; private bool _autoConvertSl1Files = true; + private bool _changeOnlyLightOffDelayIfZero = true; private decimal _lightOffDelay = 2.5m; private decimal _bottomLightOffDelay = 3m; @@ -1062,6 +1063,12 @@ namespace UVtools.WPF set => RaiseAndSetIfChanged(ref _autoConvertSl1Files, value); } + public bool ChangeOnlyLightOffDelayIfZero + { + get => _changeOnlyLightOffDelayIfZero; + set => RaiseAndSetIfChanged(ref _changeOnlyLightOffDelayIfZero, value); + } + public decimal LightOffDelay { diff --git a/UVtools.WPF/Windows/SettingsWindow.axaml b/UVtools.WPF/Windows/SettingsWindow.axaml index fe46049..db86adf 100644 --- a/UVtools.WPF/Windows/SettingsWindow.axaml +++ b/UVtools.WPF/Windows/SettingsWindow.axaml @@ -11,8 +11,7 @@ SizeToContent="Height" CanResize="False" Title="UVtools - Settings" - Icon="/Assets/Icons/UVtools.ico" - > + Icon="/Assets/Icons/UVtools.ico"> <StackPanel Orientation="Vertical" Spacing="10"> <TabControl SelectedIndex="{Binding SelectedTabIndex}"> <TabItem Header="General" VerticalContentAlignment="Center"> @@ -21,8 +20,7 @@ <Border Margin="5" BorderBrush="LightBlue" - BorderThickness="4" - > + BorderThickness="4"> <StackPanel Orientation="Vertical"> <TextBlock Padding="10" Background="LightBlue" FontWeight="Bold" Text="Startup"/> @@ -1332,6 +1330,13 @@ <StackPanel Orientation="Vertical"> <TextBlock Padding="10" Background="LightBlue" FontWeight="Bold" Text="Light-off delay"/> + + <CheckBox Margin="15,15,15,0" + Content="Change only light-off delay if value is zero" + ToolTip.Tip="If enabled, it will only change light-off delay to the defined values if the original value is zero. +
If disabled, it will always change the light-off delay to the defined values." + IsChecked="{Binding Settings.Automations.ChangeOnlyLightOffDelayIfZero}"/> + <Grid Margin="15" RowDefinitions="Auto" ColumnDefinitions="Auto,10,100,5,Auto,30,Auto,10,100,5,Auto"> |