mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Layers - Seperated activation and removal of layers/effects
Effects - Added effects UI, order is still a bit messed up and reordering is missed Effects - Added renaming of effects on the layer
This commit is contained in:
1 parent
692cf806b7
commit
18593853d8
39 files changed
+691
-334
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Artemis.Core.Plugins.Exceptions;
|
||||
using Artemis.Core.Plugins.LayerBrush;
|
||||
@@ -17,6 +18,7 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
protected LayerBrushProvider()
|
||||
{
|
||||
_layerBrushDescriptors = new List<LayerBrushDescriptor>();
|
||||
PluginDisabled += OnPluginDisabled;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -42,5 +44,10 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
|
||||
_layerBrushDescriptors.Add(new LayerBrushDescriptor(displayName, description, icon, typeof(T), this));
|
||||
}
|
||||
|
||||
private void OnPluginDisabled(object sender, EventArgs e)
|
||||
{
|
||||
_layerBrushDescriptors.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Artemis.Core.Plugins.Exceptions;
|
||||
using Artemis.Core.Plugins.LayerEffect;
|
||||
@@ -17,6 +18,7 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
protected LayerEffectProvider()
|
||||
{
|
||||
_layerEffectDescriptors = new List<LayerEffectDescriptor>();
|
||||
PluginDisabled += OnPluginDisabled;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -42,5 +44,10 @@ namespace Artemis.Core.Plugins.Abstract
|
||||
|
||||
_layerEffectDescriptors.Add(new LayerEffectDescriptor(displayName, description, icon, typeof(T), this));
|
||||
}
|
||||
|
||||
private void OnPluginDisabled(object sender, EventArgs e)
|
||||
{
|
||||
_layerEffectDescriptors.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,14 @@ using Artemis.Core.Plugins.Exceptions;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using SkiaSharp;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerBrush.Abstract
|
||||
{
|
||||
/// <summary>
|
||||
/// For internal use only, please use <see cref="LayerBrush{T}" /> or <see cref="RgbNetLayerBrush{T}" /> or instead
|
||||
/// </summary>
|
||||
public abstract class BaseLayerBrush : IDisposable
|
||||
public abstract class BaseLayerBrush : PropertyChangedBase, IDisposable
|
||||
{
|
||||
private bool _supportsTransformation = true;
|
||||
|
||||
@@ -48,7 +49,7 @@ namespace Artemis.Core.Plugins.LayerBrush.Abstract
|
||||
get => _supportsTransformation;
|
||||
protected set
|
||||
{
|
||||
if (BrushType == LayerBrushType.RgbNet)
|
||||
if (value && BrushType == LayerBrushType.RgbNet)
|
||||
throw new ArtemisPluginException(PluginInfo, "An RGB.NET brush cannot support transformation");
|
||||
_supportsTransformation = value;
|
||||
}
|
||||
|
||||
@@ -3,13 +3,14 @@ using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using SkiaSharp;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
||||
{
|
||||
/// <summary>
|
||||
/// For internal use only, please use <see cref="LayerEffect" /> instead
|
||||
/// </summary>
|
||||
public abstract class BaseLayerEffect : IDisposable
|
||||
public abstract class BaseLayerEffect : PropertyChangedBase, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the layer this effect is applied to
|
||||
@@ -21,6 +22,22 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
||||
/// </summary>
|
||||
public Folder Folder { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name which appears in the editor
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the effect has been renamed by the user, if true consider refraining from changing the name
|
||||
/// programatically
|
||||
/// </summary>
|
||||
public bool HasBeenRenamed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the order in which this effect appears in the update loop and editor
|
||||
/// </summary>
|
||||
public int Order { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the descriptor of this effect
|
||||
/// </summary>
|
||||
@@ -36,6 +53,8 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
||||
/// </summary>
|
||||
public virtual LayerPropertyGroup BaseProperties => null;
|
||||
|
||||
internal string PropertyRootPath => $"LayerEffect.{Order}.{GetType().Name}.";
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
DisableLayerEffect();
|
||||
@@ -67,6 +86,16 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
||||
/// </summary>
|
||||
public abstract void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint);
|
||||
|
||||
public void UpdateOrder(int newOrder)
|
||||
{
|
||||
if (newOrder == Order)
|
||||
return;
|
||||
|
||||
var oldOrder = Order;
|
||||
Order = newOrder;
|
||||
BaseProperties.UpdateOrder(oldOrder);
|
||||
}
|
||||
|
||||
internal void InternalPreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||
{
|
||||
// Move the canvas to the top-left of the render path
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
||||
{
|
||||
Properties = Activator.CreateInstance<T>();
|
||||
Properties.LayerEffect = this;
|
||||
Properties.InitializeProperties(layerService, Layer, "LayerEffect.");
|
||||
Properties.InitializeProperties(layerService, Layer, PropertyRootPath);
|
||||
PropertiesInitialized = true;
|
||||
|
||||
EnableLayerEffect();
|
||||
|
||||
Reference in new issue
Block a user