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:
SpoinkyNL committed 2020-06-13 22:23:33 +02:00
1 parent 692cf806b7
commit 18593853d8
39 files changed
+691 -334

No files matched your search

@@ -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();