mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Core - Streamlined public parts of profile creation
UI - Started adjusting the VMs for the layer refactor
This commit is contained in:
1 parent
1de6fefc2a
commit
c07ea09c9d
58 files changed
+694
-1196
No files matched your search
@@ -148,5 +148,7 @@ namespace Artemis.Core.LayerEffects
|
||||
// Not only is this needed to initialize properties on the layer effects, it also prevents implementing anything
|
||||
// but LayerEffect<T> outside the core
|
||||
internal abstract void Initialize();
|
||||
|
||||
internal virtual string GetEffectTypeName() => GetType().Name;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Artemis.Core.LayerBrushes;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Ninject;
|
||||
|
||||
@@ -51,6 +50,11 @@ namespace Artemis.Core.LayerEffects
|
||||
/// </summary>
|
||||
internal IKernel Kernel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating if this descriptor is a placeholder for a missing plugin
|
||||
/// </summary>
|
||||
public bool IsPlaceHolder { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the described effect and applies it to the render element
|
||||
/// </summary>
|
||||
@@ -60,6 +64,12 @@ namespace Artemis.Core.LayerEffects
|
||||
if (renderElement.LayerEffects.Any(e => e.EntityId == entity.Id))
|
||||
return;
|
||||
|
||||
if (IsPlaceHolder)
|
||||
{
|
||||
CreatePlaceHolderInstance(renderElement, entity);
|
||||
return;
|
||||
}
|
||||
|
||||
var effect = (BaseLayerEffect) Kernel.Get(LayerEffectType);
|
||||
effect.ProfileElement = renderElement;
|
||||
effect.EntityId = entity.Id;
|
||||
@@ -73,5 +83,11 @@ namespace Artemis.Core.LayerEffects
|
||||
|
||||
renderElement.ActivateLayerEffect(effect);
|
||||
}
|
||||
|
||||
private void CreatePlaceHolderInstance(RenderProfileElement renderElement, LayerEffectEntity entity)
|
||||
{
|
||||
var effect = new PlaceholderLayerEffect(entity) {ProfileElement = renderElement, Descriptor = this};
|
||||
renderElement.ActivateLayerEffect(effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core.LayerEffects
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a layer effect that could not be loaded due to a missing plugin
|
||||
/// </summary>
|
||||
public class PlaceholderLayerEffect : BaseLayerEffect
|
||||
{
|
||||
internal PlaceholderLayerEffect(LayerEffectEntity originalEntity)
|
||||
{
|
||||
OriginalEntity = originalEntity;
|
||||
|
||||
EntityId = OriginalEntity.Id;
|
||||
Order = OriginalEntity.Order;
|
||||
Name = OriginalEntity.Name;
|
||||
Enabled = OriginalEntity.Enabled;
|
||||
HasBeenRenamed = OriginalEntity.HasBeenRenamed;
|
||||
}
|
||||
|
||||
internal LayerEffectEntity OriginalEntity { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void EnableLayerEffect()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void DisableLayerEffect()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Update(double deltaTime)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath renderBounds, SKPaint paint)
|
||||
{
|
||||
}
|
||||
|
||||
internal override string GetEffectTypeName()
|
||||
{
|
||||
return OriginalEntity.EffectType;
|
||||
}
|
||||
|
||||
internal override void Initialize()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Artemis.Core.LayerEffects.Placeholder
|
||||
{
|
||||
internal static class PlaceholderLayerEffectDescriptor
|
||||
{
|
||||
public static LayerEffectDescriptor Create()
|
||||
{
|
||||
var descriptor = new LayerEffectDescriptor("Missing effect", "This effect could not be loaded", "FileQuestion", null, null) {IsPlaceHolder = true};
|
||||
return descriptor;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user