From ee16d69fb34338225dad8403b2bbe7910bd30cdd Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 3 Jul 2021 15:30:49 +0200 Subject: [PATCH] Profile editor - Increase device image rescale quality Profile editor - Fix double timeline speed when switching between play modes --- .../Services/Storage/ProfileService.cs | 31 +++++++------------ .../LayerPropertiesViewModel.cs | 2 +- .../ProfileEditor/ProfileEditorView.xaml | 6 ++-- .../Visualization/ProfileView.xaml | 1 + .../Visualization/SurfaceDeviceView.xaml | 6 +++- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/Artemis.Core/Services/Storage/ProfileService.cs b/src/Artemis.Core/Services/Storage/ProfileService.cs index 82e91c674..5cdf00f06 100644 --- a/src/Artemis.Core/Services/Storage/ProfileService.cs +++ b/src/Artemis.Core/Services/Storage/ProfileService.cs @@ -246,6 +246,16 @@ namespace Artemis.Core.Services { lock (_profileCategories) { + ProfileConfiguration? editedProfileConfiguration = _profileCategories.SelectMany(c => c.ProfileConfigurations).FirstOrDefault(p => p.IsBeingEdited); + if (editedProfileConfiguration != null) + { + editedProfileConfiguration.Profile?.Render(canvas, SKPointI.Empty); + return; + } + + if (RenderForEditor) + return; + // Iterate the children in reverse because the first category must be rendered last to end up on top for (int i = _profileCategories.Count - 1; i > -1; i--) { @@ -255,15 +265,9 @@ namespace Artemis.Core.Services try { ProfileConfiguration profileConfiguration = profileCategory.ProfileConfigurations[j]; - // Always render profiles being edited - if (profileConfiguration.IsBeingEdited) + // Ensure all criteria are met before rendering + if (!profileConfiguration.IsSuspended && !profileConfiguration.IsMissingModule && profileConfiguration.ActivationConditionMet) profileConfiguration.Profile?.Render(canvas, SKPointI.Empty); - else - { - // Ensure all criteria are met before rendering - if (!profileConfiguration.IsSuspended && !profileConfiguration.IsMissingModule && profileConfiguration.ActivationConditionMet) - profileConfiguration.Profile?.Render(canvas, SKPointI.Empty); - } } catch (Exception e) { @@ -395,13 +399,6 @@ namespace Artemis.Core.Services } } - /// - /// Creates a new profile configuration and adds it to the provided - /// - /// The profile category to add the profile to - /// The name of the new profile configuration - /// The icon of the new profile configuration - /// The newly created profile configuration public ProfileConfiguration CreateProfileConfiguration(ProfileCategory category, string name, string icon) { ProfileConfiguration configuration = new(category, name, icon); @@ -413,10 +410,6 @@ namespace Artemis.Core.Services return configuration; } - /// - /// Removes the provided profile configuration from the - /// - /// public void RemoveProfileConfiguration(ProfileConfiguration profileConfiguration) { profileConfiguration.Category.RemoveProfileConfiguration(profileConfiguration); diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs index 54a144305..944111d23 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs @@ -570,7 +570,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties { if (!ProfileEditorService.Playing) { - Pause(); + CoreService.FrameRendering -= CoreServiceOnFrameRendering; return; } diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml index 4c71321df..d63979f9d 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml @@ -27,7 +27,7 @@ - + @@ -105,10 +105,10 @@ Command="{s:Action ToggleSuspend}" InputGestureText="F5" /> + InputGestureText="Shift+F5" /> diff --git a/src/Artemis.UI/Screens/SurfaceEditor/Visualization/SurfaceDeviceView.xaml b/src/Artemis.UI/Screens/SurfaceEditor/Visualization/SurfaceDeviceView.xaml index 3f43883b0..f6bc87ac3 100644 --- a/src/Artemis.UI/Screens/SurfaceEditor/Visualization/SurfaceDeviceView.xaml +++ b/src/Artemis.UI/Screens/SurfaceEditor/Visualization/SurfaceDeviceView.xaml @@ -33,7 +33,11 @@ Visibility="{Binding Device.Layout.Image, ConverterParameter=Inverted, Converter={StaticResource NullToVisibilityConverter}}" IsHitTestVisible="False"/> - +