mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Layer brushes - Make enable-disable process consistent with plugins
This commit is contained in:
1 parent
a1c2e4ad5a
commit
ee37c3b836
37 files changed
+325
-128
No files matched your search
@@ -16,7 +16,7 @@ namespace Artemis.Plugins.Devices.Asus
|
||||
_rgbService = rgbService;
|
||||
}
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(AsusRGBDevice<>), sender, args);
|
||||
_rgbService.AddDeviceProvider(RgbDeviceProvider);
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Artemis.Plugins.Devices.CoolerMaster
|
||||
_rgbService = rgbService;
|
||||
}
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(CoolerMasterRGBDevice<>), sender, args);
|
||||
RGB.NET.Devices.CoolerMaster.CoolerMasterDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "CMSDK.dll"));
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Artemis.Plugins.Devices.Corsair
|
||||
_rgbService = rgbService;
|
||||
}
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(CorsairRGBDevice<>), sender, args);
|
||||
RGB.NET.Devices.Corsair.CorsairDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "CUESDK.x64_2017.dll"));
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Artemis.Plugins.Devices.DMX
|
||||
HasConfigurationViewModel = true;
|
||||
}
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
// TODO: Load from configuration
|
||||
// RGB.NET.Devices.DMX.DMXDeviceProvider.Instance.AddDeviceDefinition();
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Artemis.Plugins.Devices.Logitech
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(LogitechRGBDevice<>), sender, args);
|
||||
RGB.NET.Devices.Logitech.LogitechDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "LogitechLedEnginesWrapper.dll"));
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Artemis.Plugins.Devices.Msi
|
||||
_rgbService = rgbService;
|
||||
}
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(MsiRGBDevice<>), sender, args);
|
||||
RGB.NET.Devices.Msi.MsiDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "MysticLight_SDK.dll"));
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Artemis.Plugins.Devices.Novation
|
||||
_rgbService = rgbService;
|
||||
}
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(NovationRGBDevice<>), sender, args);
|
||||
_rgbService.AddDeviceProvider(RgbDeviceProvider);
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Artemis.Plugins.Devices.Razer
|
||||
_rgbService = rgbService;
|
||||
}
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(RazerRGBDevice<>), sender, args);
|
||||
RGB.NET.Devices.Razer.RazerDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "RzChromaSDK.dll"));
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Artemis.Plugins.Devices.Roccat
|
||||
_rgbService = rgbService;
|
||||
}
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
// TODO: Find out why this is missing, Roccat seems unimplemented
|
||||
// PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(RoccatRGBDevice<>), sender, args);
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Artemis.Plugins.Devices.SteelSeries
|
||||
_rgbService = rgbService;
|
||||
}
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
// TODO Check to see if this works, it's usually a generic type after all
|
||||
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(SteelSeriesRGBDevice), sender, args);
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Artemis.Plugins.Devices.WS281X
|
||||
|
||||
public PluginSettings Settings { get; }
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
var definitions = Settings.GetSetting<List<DeviceDefinition>>("DeviceDefinitions");
|
||||
if (definitions.Value == null)
|
||||
@@ -49,7 +49,7 @@ namespace Artemis.Plugins.Devices.WS281X
|
||||
_rgbService.AddDeviceProvider(RgbDeviceProvider);
|
||||
}
|
||||
|
||||
protected override void DisablePlugin()
|
||||
public override void DisablePlugin()
|
||||
{
|
||||
// TODO: Remove the device provider from the surface
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Artemis.Plugins.Devices.Wooting
|
||||
_rgbService = rgbService;
|
||||
}
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
PathHelper.ResolvingAbsolutePath += (sender, args) => ResolveAbsolutePath(typeof(WootingRGBDevice<>), sender, args);
|
||||
RGB.NET.Devices.Wooting.WootingDeviceProvider.PossibleX64NativePaths.Add(Path.Combine(PluginInfo.Directory.FullName, "x64", "wooting-rgb-sdk64.dll"));
|
||||
@@ -25,7 +25,7 @@ namespace Artemis.Plugins.Devices.Wooting
|
||||
_rgbService.AddDeviceProvider(RgbDeviceProvider);
|
||||
}
|
||||
|
||||
protected override void DisablePlugin()
|
||||
public override void DisablePlugin()
|
||||
{
|
||||
// TODO: Remove the device provider from the surface
|
||||
}
|
||||
|
||||
@@ -17,6 +17,21 @@ namespace Artemis.Plugins.LayerBrushes.Color
|
||||
Layer.RenderPropertiesUpdated += (sender, args) => CreateShader();
|
||||
}
|
||||
|
||||
public override void EnableLayerBrush()
|
||||
{
|
||||
Properties.GradientType.BaseValueChanged += (sender, args) => CreateShader();
|
||||
Properties.Color.BaseValueChanged += (sender, args) => CreateShader();
|
||||
Properties.Gradient.BaseValue.PropertyChanged += (sender, args) => CreateShader();
|
||||
}
|
||||
|
||||
public override void DisableLayerBrush()
|
||||
{
|
||||
_paint?.Dispose();
|
||||
_shader?.Dispose();
|
||||
_paint = null;
|
||||
_shader = null;
|
||||
}
|
||||
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
// Only check if a solid is being drawn, because that can be changed by keyframes
|
||||
@@ -40,24 +55,6 @@ namespace Artemis.Plugins.LayerBrushes.Color
|
||||
canvas.DrawPath(path, paint);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_paint?.Dispose();
|
||||
_shader?.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
protected override void OnPropertiesInitialized()
|
||||
{
|
||||
Properties.GradientType.BaseValueChanged += (sender, args) => CreateShader();
|
||||
Properties.Color.BaseValueChanged += (sender, args) => CreateShader();
|
||||
Properties.Gradient.BaseValue.PropertyChanged += (sender, args) => CreateShader();
|
||||
}
|
||||
|
||||
private void CreateShader()
|
||||
{
|
||||
var center = new SKPoint(_shaderBounds.MidX, _shaderBounds.MidY);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Profile.Colors;
|
||||
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Artemis.Core.Plugins.LayerBrush;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.LayerBrush;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
|
||||
namespace Artemis.Plugins.LayerBrushes.Color
|
||||
@@ -10,11 +11,11 @@ namespace Artemis.Plugins.LayerBrushes.Color
|
||||
AddLayerBrushDescriptor<ColorBrush>("Color", "A color with an (optional) gradient", "Brush");
|
||||
}
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void DisablePlugin()
|
||||
public override void DisablePlugin()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using Artemis.Core.Extensions;
|
||||
using Artemis.Core.Extensions;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Plugins.LayerBrush;
|
||||
using RGB.NET.Brushes;
|
||||
@@ -16,6 +15,14 @@ namespace Artemis.Plugins.LayerBrushes.ColorRgbNet
|
||||
_solidBrush = new SolidColorBrush(Color.Transparent);
|
||||
}
|
||||
|
||||
public override void EnableLayerBrush()
|
||||
{
|
||||
}
|
||||
|
||||
public override void DisableLayerBrush()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
_solidBrush.Color = Properties.Color.CurrentValue.ToRgbColor();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Artemis.Core.Plugins.LayerBrush;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Plugins.LayerBrushes.ColorRgbNet.PropertyInput;
|
||||
using Artemis.UI.Shared.Services.Interfaces;
|
||||
@@ -15,12 +15,12 @@ namespace Artemis.Plugins.LayerBrushes.ColorRgbNet
|
||||
AddLayerBrushDescriptor<RgbNetColorBrush>("RGB.NET Color", "A RGB.NET based color", "Brush");
|
||||
}
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
_profileEditorService.RegisterPropertyInput(PluginInfo, typeof(StringPropertyInputViewModel));
|
||||
}
|
||||
|
||||
protected override void DisablePlugin()
|
||||
public override void DisablePlugin()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,18 @@ namespace Artemis.Plugins.LayerBrushes.Noise
|
||||
DetermineRenderScale();
|
||||
}
|
||||
|
||||
public override void EnableLayerBrush()
|
||||
{
|
||||
Properties.GradientColor.BaseValue.PropertyChanged += GradientColorChanged;
|
||||
CreateColorMap();
|
||||
}
|
||||
|
||||
public override void DisableLayerBrush()
|
||||
{
|
||||
_bitmap?.Dispose();
|
||||
_bitmap = null;
|
||||
}
|
||||
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
_x += Properties.ScrollSpeed.CurrentValue.X / 500f / (float) deltaTime;
|
||||
@@ -103,23 +115,7 @@ namespace Artemis.Plugins.LayerBrushes.Noise
|
||||
paint.Shader = foregroundShader;
|
||||
canvas.DrawRect(path.Bounds, paint);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_bitmap?.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
protected override void OnPropertiesInitialized()
|
||||
{
|
||||
Properties.GradientColor.BaseValue.PropertyChanged += GradientColorChanged;
|
||||
CreateColorMap();
|
||||
}
|
||||
|
||||
|
||||
private void GradientColorChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
CreateColorMap();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Profile.Colors;
|
||||
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
||||
using Artemis.Core.Models.Profile.LayerProperties.Types;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Artemis.Core.Plugins.LayerBrush;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.LayerBrush;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
|
||||
namespace Artemis.Plugins.LayerBrushes.Noise
|
||||
@@ -10,11 +11,11 @@ namespace Artemis.Plugins.LayerBrushes.Noise
|
||||
AddLayerBrushDescriptor<NoiseBrush>("Noise", "A brush of that shows an animated random noise", "ScatterPlot");
|
||||
}
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void DisablePlugin()
|
||||
public override void DisablePlugin()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ namespace Artemis.Plugins.Modules.General
|
||||
return new List<ModuleViewModel> {new GeneralViewModel(this)};
|
||||
}
|
||||
|
||||
protected override void EnablePlugin()
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void DisablePlugin()
|
||||
public override void DisablePlugin()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user