1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Core - Added ColorGradient type to use for.. gradients!

Core - Initialisation process no longer takes place in core constructor and is no longer async
UI - Fixed exceptions during init not being shown
Gradient editor - Started work on this
This commit is contained in:
Robert 2020-02-28 23:19:38 +01:00
parent 9b62ba5f3d
commit c3b2c981da
29 changed files with 1517 additions and 113 deletions

View File

@ -36,9 +36,6 @@
<ProjectReference Include="..\Artemis.Storage\Artemis.Storage.csproj">
<Private>false</Private>
</ProjectReference>
<ProjectReference Include="..\Artemis.UI.Shared\Artemis.UI.Shared.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Ben.Demystifier" Version="0.1.6" />

View File

@ -0,0 +1,28 @@
using System.Collections.Generic;
using SkiaSharp;
namespace Artemis.Core.Models.Profile
{
public class ColorGradient
{
public ColorGradient()
{
Colors = new List<ColorGradientColor>();
}
public List<ColorGradientColor> Colors { get; }
public float Rotation { get; set; }
}
public struct ColorGradientColor
{
public ColorGradientColor(SKColor color, float position)
{
Color = color;
Position = position;
}
public SKColor Color { get; set; }
public float Position { get; set; }
}
}

View File

@ -4,7 +4,6 @@ using Artemis.Core.Models.Profile.KeyframeEngines;
using Artemis.Core.Plugins.Models;
using Artemis.Core.Services.Interfaces;
using Artemis.Storage.Repositories.Interfaces;
using Artemis.UI.Shared.Services.Interfaces;
using LiteDB;
using Ninject.Activation;
using Ninject.Extensions.Conventions;
@ -30,16 +29,6 @@ namespace Artemis.Core.Ninject
.Configure(c => c.InSingletonScope());
});
// Bind all shared UI services as singletons
Kernel.Bind(x =>
{
x.FromAssemblyContaining<IArtemisSharedUIService>()
.SelectAllClasses()
.InheritedFrom<IArtemisSharedUIService>()
.BindAllInterfaces()
.Configure(c => c.InSingletonScope());
});
// Bind all protected services as singletons
Kernel.Bind(x =>
{

View File

@ -49,7 +49,6 @@ namespace Artemis.Core.Services
_pluginService.PluginDisabled += (sender, args) => _modules = _pluginService.GetPluginsOfType<Module>();
ConfigureJsonConvert();
Task.Run(Initialize);
}
public bool ModuleUpdatingDisabled { get; set; }
@ -81,7 +80,7 @@ namespace Artemis.Core.Services
};
}
private async Task Initialize()
public void Initialize()
{
if (IsInitialized)
throw new ArtemisCoreException("Cannot initialize the core as it is already initialized.");
@ -90,8 +89,8 @@ namespace Artemis.Core.Services
ApplyLoggingLevel();
// Initialize the services
await Task.Run(() => _pluginService.CopyBuiltInPlugins());
await Task.Run(() => _pluginService.LoadPlugins());
_pluginService.CopyBuiltInPlugins();
_pluginService.LoadPlugins();
var surfaceConfig = _surfaceService.ActiveSurface;
if (surfaceConfig != null)
@ -99,7 +98,7 @@ namespace Artemis.Core.Services
else
_logger.Information("Initialized without an active surface entity");
await Task.Run(() => _profileService.ActivateDefaultProfiles());
_profileService.ActivateDefaultProfiles();
OnInitialized();
}

View File

@ -20,6 +20,11 @@ namespace Artemis.Core.Services.Interfaces
/// </summary>
bool ModuleRenderingDisabled { get; set; }
/// <summary>
/// Initializes the core, only call once
/// </summary>
void Initialize();
/// <summary>
/// Occurs the core has finished initializing
/// </summary>

View File

@ -43,6 +43,16 @@
<ItemGroup>
<None Remove="Resources\Fonts\RobotoMono-Regular.ttf" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Artemis.Core\Artemis.Core.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="MaterialDesignExtensions">
<HintPath>..\..\..\..\.nuget\materialdesignextensions\3.0.0\lib\netcoreapp3.0\MaterialDesignExtensions.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Fonts\RobotoMono-Regular.ttf" />
</ItemGroup>

View File

@ -0,0 +1,42 @@
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
using Artemis.Core.Models.Profile;
using SkiaSharp;
namespace Artemis.UI.Shared.Converters
{
/// <inheritdoc />
/// <summary>
/// Converts <see cref="T:Artemis.Core.Models.Profile.ColorGradient" /> into a
/// <see cref="T:System.Windows.Media.GradientStopCollection" />.
/// </summary>
[ValueConversion(typeof(ColorGradient), typeof(GradientStopCollection))]
public class ColorGradientToGradientStopsConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var colorGradient = (ColorGradient) value;
var collection = new GradientStopCollection();
if (colorGradient == null)
return collection;
foreach (var c in colorGradient.Colors)
collection.Add(new GradientStop(Color.FromArgb(c.Color.Alpha, c.Color.Red, c.Color.Green, c.Color.Blue), c.Position));
return collection;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
var collection = (GradientStopCollection) value;
var colorGradient = new ColorGradient();
if (collection == null)
return colorGradient;
foreach (var c in collection)
colorGradient.Colors.Add(new ColorGradientColor(new SKColor(c.Color.R, c.Color.G, c.Color.B, c.Color.A), (float) c.Offset));
return colorGradient;
}
}
}

View File

@ -0,0 +1,51 @@
<UserControl x:Class="Artemis.UI.Shared.GradientPicker"
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:Artemis.UI.Shared"
xmlns:converters="clr-namespace:Artemis.UI.Shared.Converters"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ColorPicker.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
</ResourceDictionary.MergedDictionaries>
<converters:ColorGradientToGradientStopsConverter x:Key="ColorGradientToGradientStopsConverter" />
<VisualBrush x:Key="Checkerboard" TileMode="Tile" Stretch="Uniform" ViewportUnits="Absolute" Viewport="0,0,10,10">
<VisualBrush.Visual>
<Grid Width="10" Height="10">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Rectangle Grid.Row="0" Grid.Column="0" Fill="Gray" />
<Rectangle Grid.Row="0" Grid.Column="1" Fill="White" />
<Rectangle Grid.Row="1" Grid.Column="0" Fill="White" />
<Rectangle Grid.Row="1" Grid.Column="1" Fill="Gray" />
</Grid>
</VisualBrush.Visual>
</VisualBrush>
</ResourceDictionary>
</UserControl.Resources>
<Border Height="15"
CornerRadius="5"
Margin="0,0,0,2"
HorizontalAlignment="Stretch"
Background="{StaticResource Checkerboard}">
<Ellipse Stroke="{DynamicResource NormalBorderBrush}" Cursor="Hand" MouseUp="UIElement_OnMouseUp">
<Ellipse.Fill>
<LinearGradientBrush
GradientStops="{Binding ColorGradient, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Converter={StaticResource ColorGradientToGradientStopsConverter}}" />
</Ellipse.Fill>
</Ellipse>
</Border>
</UserControl>

View File

@ -0,0 +1,65 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Artemis.Core.Models.Profile;
using Artemis.UI.Shared.Annotations;
using Artemis.UI.Shared.Screens.GradientEditor;
namespace Artemis.UI.Shared
{
/// <summary>
/// Interaction logic for GradientPicker.xaml
/// </summary>
public partial class GradientPicker : UserControl, INotifyPropertyChanged
{
public static readonly DependencyProperty ColorGradientProperty = DependencyProperty.Register(nameof(ColorGradient), typeof(ColorGradient), typeof(GradientPicker),
new FrameworkPropertyMetadata(default(ColorGradient), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, ColorGradientPropertyChangedCallback));
public static readonly RoutedEvent ColorGradientChangedEvent =
EventManager.RegisterRoutedEvent(
nameof(ColorGradient),
RoutingStrategy.Bubble,
typeof(RoutedPropertyChangedEventHandler<ColorGradient>),
typeof(GradientPicker));
private bool _inCallback;
public GradientPicker()
{
InitializeComponent();
}
public ColorGradient ColorGradient
{
get => (ColorGradient) GetValue(ColorGradientProperty);
set => SetValue(ColorGradientProperty, value);
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private static void ColorGradientPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var colorPicker = (GradientPicker) d;
if (colorPicker._inCallback)
return;
colorPicker._inCallback = true;
colorPicker.OnPropertyChanged(nameof(ColorGradient));
colorPicker._inCallback = false;
}
private void UIElement_OnMouseUp(object sender, MouseButtonEventArgs e)
{
var gradientEditor = new GradientEditor(ColorGradientProperty);
gradientEditor.ShowDialog();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
<controls:MaterialWindow x:Class="Artemis.UI.Shared.Screens.GradientEditor.GradientEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Artemis.UI.Shared.Screens.GradientEditor"
xmlns:controls="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Title="Gradient Editor"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
UseLayoutRounding="True"
Width="800"
Height="450"
ResizeMode="NoResize"
Icon="/Resources/Images/Logo/logo-512.png"
d:DesignHeight="450"
d:DesignWidth="800">
<Grid>
</Grid>
</controls:MaterialWindow>

View File

@ -0,0 +1,26 @@
using System.Windows;
using Artemis.Core.Models.Profile;
using MaterialDesignExtensions.Controls;
namespace Artemis.UI.Shared.Screens.GradientEditor
{
/// <summary>
/// Interaction logic for GradientEditor.xaml
/// </summary>
public partial class GradientEditor : MaterialWindow
{
public GradientEditor(DependencyProperty colorGradientProperty)
{
ColorGradientProperty = colorGradientProperty;
InitializeComponent();
}
public DependencyProperty ColorGradientProperty { get; }
public ColorGradient ColorGradient
{
get => (ColorGradient) GetValue(ColorGradientProperty);
set => SetValue(ColorGradientProperty, value);
}
}
}

View File

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
@ -10,6 +9,7 @@ using Artemis.Core.Services.Interfaces;
using Artemis.UI.Ninject;
using Artemis.UI.Screens;
using Artemis.UI.Screens.Splash;
using Artemis.UI.Shared.Services.Interfaces;
using Artemis.UI.Stylet;
using Ninject;
using Serilog;
@ -32,35 +32,38 @@ namespace Artemis.UI
protected override void Launch()
{
StartupArguments = Args.ToList();
var logger = Kernel.Get<ILogger>();
var windowManager = Kernel.Get<IWindowManager>();
var viewManager = Kernel.Get<IViewManager>();
// Create the Artemis core
_core = Kernel.Get<ICoreService>();
// Create and bind the root view, this is a tray icon so don't show it with the window manager
Execute.OnUIThread(() => viewManager.CreateAndBindViewForModelIfNecessary(RootViewModel));
// Initialize the core async so the UI can show the progress
Task.Run(async () =>
{
try
{
StartupArguments = Args.ToList();
if (StartupArguments.Contains("-autorun"))
{
logger.Information("Sleeping for 15 seconds on auto run to allow applications like iCUE and LGS to start");
await Task.Delay(TimeSpan.FromSeconds(15));
}
// Create and bind the root view, this is a tray icon so don't show it with the window manager
Execute.OnUIThread(() => viewManager.CreateAndBindViewForModelIfNecessary(RootViewModel));
// Start the Artemis core
_core = Kernel.Get<ICoreService>();
_core.Initialize();
}
catch (Exception e)
{
logger.Fatal(e, "Fatal exception during initialization, shutting down.");
// TODO: A proper exception viewer
// Can't use a pretty exception dialog here since the UI might not even be visible
Execute.OnUIThread(() =>
{
windowManager.ShowMessageBox(e.Message + "\n\n Please refer the log file for more details.",
Kernel.Get<IWindowManager>().ShowMessageBox(e.Message + "\n\n Please refer the log file for more details.",
"Fatal exception during initialization",
MessageBoxButton.OK,
MessageBoxImage.Error
@ -87,9 +90,13 @@ namespace Artemis.UI
protected override void OnUnhandledException(DispatcherUnhandledExceptionEventArgs e)
{
var logger = Kernel.Get<ILogger>();
logger.Fatal(e.Exception, "Fatal exception, shutting down.");
logger.Fatal(e.Exception, "Unhandled exception");
base.OnUnhandledException(e);
var dialogService = Kernel.Get<IDialogService>();
dialogService.ShowExceptionDialog("Artemis encountered an error", e.Exception);
// Don't shut down, is that a good idea? Depends on the exception of course..
e.Handled = true;
}
private void ShowMainWindow(IWindowManager windowManager, SplashViewModel splashViewModel)

View File

@ -5,6 +5,7 @@ using Artemis.UI.Screens.Module.ProfileEditor;
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput;
using Artemis.UI.Services.Interfaces;
using Artemis.UI.Shared.Services.Dialog;
using Artemis.UI.Shared.Services.Interfaces;
using Artemis.UI.Stylet;
using FluentValidation;
using Ninject.Extensions.Conventions;
@ -86,6 +87,16 @@ namespace Artemis.UI.Ninject
.InheritedFrom<IValidator>()
.BindAllInterfaces();
});
// Bind all shared UI services as singletons
Kernel.Bind(x =>
{
x.FromAssemblyContaining<IArtemisSharedUIService>()
.SelectAllClasses()
.InheritedFrom<IArtemisSharedUIService>()
.BindAllInterfaces()
.Configure(c => c.InSingletonScope());
});
}
}
}

View File

@ -1,16 +0,0 @@
<mde:MaterialWindow x:Class="Artemis.UI.Screens.GradientEditor.GradientEditorView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:gradientEditor="clr-namespace:Artemis.UI.Screens.GradientEditor"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mde="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions"
mc:Ignorable="d"
Title="Gradient Editor"
Height="450" Width="800"
d:DataContext="{d:DesignInstance {x:Type gradientEditor:GradientEditorViewModel}}">
<Grid>
<materialDesign:ColorPicker Color="{Binding CurrentColor}" />
</Grid>
</mde:MaterialWindow>

View File

@ -1,10 +0,0 @@
using System.Windows.Media;
using Stylet;
namespace Artemis.UI.Screens.GradientEditor
{
public class GradientEditorViewModel : Screen
{
public Color CurrentColor { get; set; }
}
}

View File

@ -95,7 +95,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
base.OnDeactivate();
}
private void ProfileEditorServiceOnProfileElementSelected(object? sender, ProfileElementEventArgs e)
private void ProfileEditorServiceOnProfileElementSelected(object sender, ProfileElementEventArgs e)
{
PopulateProperties(e.ProfileElement, e.PreviousProfileElement);
}

View File

@ -1,15 +0,0 @@
using System.Windows.Controls;
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput
{
/// <summary>
/// Interaction logic for BrushPropertyInputView.xaml
/// </summary>
public partial class BrushPropertyInputView : UserControl
{
public BrushPropertyInputView()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,20 @@
<UserControl x:Class="Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput.ColorGradientPropertyInputView"
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:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput"
xmlns:artemis="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
xmlns:converters="clr-namespace:Artemis.UI.Shared.Converters;assembly=Artemis.UI.Shared"
mc:Ignorable="d"
d:DesignHeight="25" d:DesignWidth="800"
d:DataContext="{d:DesignInstance local:ColorGradientPropertyInputViewModel}">
<StackPanel Orientation="Horizontal">
<TextBlock Margin="0 0 5 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputPrefix}" />
<artemis:GradientPicker Width="132"
Margin="0 2"
Padding="0 -1"
ColorGradient="{Binding ColorGradientInputValue}" />
<TextBlock Margin="5 0 0 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
</StackPanel>
</UserControl>

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using Artemis.Core.Models.Profile;
using Artemis.UI.Services.Interfaces;
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput
{
public class ColorGradientPropertyInputViewModel : PropertyInputViewModel
{
public ColorGradientPropertyInputViewModel(IProfileEditorService profileEditorService) : base(profileEditorService)
{
}
public sealed override List<Type> CompatibleTypes { get; } = new List<Type> {typeof(ColorGradient)};
public ColorGradient ColorGradientInputValue
{
get => (ColorGradient) InputValue ?? new ColorGradient();
set => InputValue = value;
}
public override void Update()
{
NotifyOfPropertyChange(() => ColorGradientInputValue);
}
}
}

View File

@ -1,15 +0,0 @@
using System.Windows.Controls;
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput
{
/// <summary>
/// Interaction logic for EnumPropertyInputView.xaml
/// </summary>
public partial class EnumPropertyInputView : UserControl
{
public EnumPropertyInputView()
{
InitializeComponent();
}
}
}

View File

@ -1,15 +0,0 @@
using System.Windows.Controls;
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput
{
/// <summary>
/// Interaction logic for SKColorPropertyInputView.xaml
/// </summary>
public partial class SKColorPropertyInputView : UserControl
{
public SKColorPropertyInputView()
{
InitializeComponent();
}
}
}

View File

@ -85,12 +85,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree
parent?.RaiseEvent(eventArg);
}
private void OnCurrentTimeChanged(object? sender, EventArgs e)
private void OnCurrentTimeChanged(object sender, EventArgs e)
{
Update(false);
}
private void OnSelectedProfileElementUpdated(object? sender, ProfileElementEventArgs e)
private void OnSelectedProfileElementUpdated(object sender, ProfileElementEventArgs e)
{
Update(true);
}

View File

@ -102,12 +102,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
UpdateEndTime();
}
private void OnSelectedProfileElementUpdated(object? sender, ProfileElementEventArgs e)
private void OnSelectedProfileElementUpdated(object sender, ProfileElementEventArgs e)
{
Update();
}
private void OnPixelsPerSecondChanged(object? sender, EventArgs e)
private void OnPixelsPerSecondChanged(object sender, EventArgs e)
{
UpdateKeyframePositions();
}

View File

@ -47,22 +47,22 @@ namespace Artemis.UI.Screens.Splash
base.OnClose();
}
private void OnPluginServiceOnPluginLoaded(object? sender, PluginEventArgs args)
private void OnPluginServiceOnPluginLoaded(object sender, PluginEventArgs args)
{
Status = "Initializing UI";
}
private void OnPluginServiceOnPluginLoading(object? sender, PluginEventArgs args)
private void OnPluginServiceOnPluginLoading(object sender, PluginEventArgs args)
{
Status = "Loading plugin: " + args.PluginInfo.Name;
}
private void OnPluginServiceOnCopyingBuildInPlugins(object? sender, EventArgs args)
private void OnPluginServiceOnCopyingBuildInPlugins(object sender, EventArgs args)
{
Status = "Updating built-in plugins";
}
private void OnCoreServiceOnInitialized(object? sender, EventArgs args)
private void OnCoreServiceOnInitialized(object sender, EventArgs args)
{
Execute.OnUIThread(() => RequestClose());
}

View File

@ -1,5 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/CSharpCompletingCharacters/UpgradedFromVSSettings/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=Artemis_002EUI_002EShared_002EAnnotations/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Built-in: Full Cleanup</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_FOR/@EntryValue">RequiredForMultiline</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_FOREACH/@EntryValue">RequiredForMultiline</s:String>

View File

@ -29,6 +29,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="MaterialDesignThemes.Wpf">
<HintPath>..\..\..\..\..\.nuget\materialdesignthemes\3.0.1\lib\netcoreapp3.0\MaterialDesignThemes.Wpf.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Core">
<HintPath>..\..\..\..\RGB.NET\bin\netstandard2.0\RGB.NET.Core.dll</HintPath>
</Reference>

View File

@ -19,6 +19,7 @@ namespace Artemis.Plugins.LayerBrushes.Color
public ColorBrush(Layer layer, LayerBrushDescriptor descriptor) : base(layer, descriptor)
{
ColorProperty = RegisterLayerProperty("Brush.Color", "Color", "The color of the brush", new SKColor(255,0,0));
GradientProperty = RegisterLayerProperty("Brush.Gradient", "Gradient", "The gradient of the brush", new ColorGradient());
GradientTypeProperty = RegisterLayerProperty<GradientType>("Brush.GradientType", "Gradient type", "The type of color brush to draw");
GradientTypeProperty.CanUseKeyframes = false;
@ -36,7 +37,13 @@ namespace Artemis.Plugins.LayerBrushes.Color
GradientTypeProperty.ValueChanged += (sender, args) => CreateShader(_shaderBounds);
}
private void GradientTypePropertyOnValueChanged(object? sender, EventArgs e)
{
throw new NotImplementedException();
}
public LayerProperty<SKColor> ColorProperty { get; set; }
public LayerProperty<ColorGradient> GradientProperty { get; set; }
public LayerProperty<GradientType> GradientTypeProperty { get; set; }
public override void Update(double deltaTime)