diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs index ea94d24b1..63ce526bd 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs @@ -550,7 +550,11 @@ namespace Artemis.Core try { foreach (KeyframeEntity keyframeEntity in Entity.KeyframeEntities.Where(k => k.Position <= ProfileElement.Timeline.Length)) - CreateKeyframeFromEntity(keyframeEntity); + { + LayerPropertyKeyframe? keyframe = CreateKeyframeFromEntity(keyframeEntity) as LayerPropertyKeyframe; + if (keyframe != null) + AddKeyframe(keyframe); + } } catch (JsonException) { diff --git a/src/Artemis.UI.Shared/ReactiveCoreWindow.cs b/src/Artemis.UI.Shared/ReactiveCoreWindow.cs index e2b33f871..67eac6a73 100644 --- a/src/Artemis.UI.Shared/ReactiveCoreWindow.cs +++ b/src/Artemis.UI.Shared/ReactiveCoreWindow.cs @@ -4,7 +4,6 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Media; using Avalonia.Media.Immutable; -using FluentAvalonia.Styling; using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Media; using ReactiveUI; @@ -56,19 +55,16 @@ namespace Artemis.UI.Shared { base.OnOpened(e); - // Enable Mica on Windows 11 - FluentAvaloniaTheme? thm = AvaloniaLocator.Current.GetService(); - if (thm != null && RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - // TODO: add Windows version to CoreWindow - if (IsWindows11 && thm.RequestedTheme != FluentAvaloniaTheme.HighContrastModeString) - { - TransparencyBackgroundFallback = Brushes.Transparent; - TransparencyLevelHint = WindowTransparencyLevel.Mica; - - TryEnableMicaEffect(thm); - } - } + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || !IsWindows11) + return; + + // Enable Mica on Windows 11, based on the FluentAvalonia sample application + TransparencyBackgroundFallback = Brushes.Transparent; + TransparencyLevelHint = WindowTransparencyLevel.Mica; + + Color2 color = this.TryFindResource("SolidBackgroundFillColorBase", out object? value) ? (Color) value : new Color2(32, 32, 32); + color = color.LightenPercent(-0.8f); + Background = new ImmutableSolidColorBrush(color, 0.78); } private void OnDataContextChanged(object? value) @@ -85,29 +81,5 @@ namespace Artemis.UI.Shared ClearValue(DataContextProperty); else if (DataContext != value) DataContext = value; } - - private void TryEnableMicaEffect(FluentAvaloniaTheme thm) - { - // The background colors for the Mica brush are still based around SolidBackgroundFillColorBase resource - // BUT since we can't control the actual Mica brush color, we have to use the window background to create - // the same effect. However, we can't use SolidBackgroundFillColorBase directly since its opaque, and if - // we set the opacity the color become lighter than we want. So we take the normal color, darken it and - // apply the opacity until we get the roughly the correct color - // NOTE that the effect still doesn't look right, but it suffices. Ideally we need access to the Mica - // CompositionBrush to properly change the color but I don't know if we can do that or not - if (thm.RequestedTheme == FluentAvaloniaTheme.DarkModeString) - { - Color2 color = this.TryFindResource("SolidBackgroundFillColorBase", out object? value) ? (Color) value : new Color2(32, 32, 32); - color = color.LightenPercent(-0.8f); - Background = new ImmutableSolidColorBrush(color, 0.78); - } - else if (thm.RequestedTheme == FluentAvaloniaTheme.LightModeString) - { - // Similar effect here - Color2 color = this.TryFindResource("SolidBackgroundFillColorBase", out object? value) ? (Color) value : new Color2(243, 243, 243); - color = color.LightenPercent(0.5f); - Background = new ImmutableSolidColorBrush(color, 0.9); - } - } } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml index 75b799e45..7d1777250 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml @@ -8,6 +8,7 @@ mc:Ignorable="d" x:Class="Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.LayerHintsDialogView" x:DataType="dialogs:LayerHintsDialogViewModel" + WindowStartupLocation="CenterOwner" Title="Artemis | Adaption hints" Width="750" Height="800"> @@ -15,10 +16,10 @@ - - + + - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + You haven't set up any adaption hints + + + Artemis will attempt to directly map the LEDs of this layer to different surfaces but results may vary. + + + + + diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/TreeItemViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/TreeItemViewModel.cs index 71500bec7..8773076e5 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/TreeItemViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/TreeItemViewModel.cs @@ -260,6 +260,7 @@ public abstract class TreeItemViewModel : ActivatableViewModelBase return; await _windowService.ShowDialogAsync(("layer", layer)); + await ProfileEditorService.SaveProfileAsync(); } private async void UpdateCanPaste(bool isFlyoutOpen) diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml index 13f951a51..2c88bddea 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml @@ -82,10 +82,7 @@ - - - - + - + - - + + + + + Get more plugins + + + + - + \ No newline at end of file