mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Profiles - Added system that displays when a layer is causing errors
This commit is contained in:
1 parent
3b7e226885
commit
5b6fc9eec7
18 files changed
+457
-95
No files matched your search
@@ -8,7 +8,7 @@ namespace Artemis.Core.LayerBrushes
|
||||
/// <summary>
|
||||
/// For internal use only, please use <see cref="LayerBrush{T}" /> or <see cref="PerLedLayerBrush{T}" /> or instead
|
||||
/// </summary>
|
||||
public abstract class BaseLayerBrush : CorePropertyChanged, IDisposable
|
||||
public abstract class BaseLayerBrush : BreakableModel, IDisposable
|
||||
{
|
||||
private LayerBrushType _brushType;
|
||||
private ILayerBrushConfigurationDialog? _configurationDialog;
|
||||
@@ -134,6 +134,12 @@ namespace Artemis.Core.LayerBrushes
|
||||
}
|
||||
}
|
||||
|
||||
internal void InternalUpdate(Timeline timeline)
|
||||
{
|
||||
BaseProperties?.Update(timeline);
|
||||
TryOrBreak(() => Update(timeline.Delta.TotalSeconds), "Failed to update");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables the layer brush if it isn't already enabled
|
||||
/// </summary>
|
||||
@@ -142,7 +148,9 @@ namespace Artemis.Core.LayerBrushes
|
||||
if (Enabled)
|
||||
return;
|
||||
|
||||
EnableLayerBrush();
|
||||
if (!TryOrBreak(EnableLayerBrush, "Failed to enable"))
|
||||
return;
|
||||
|
||||
Enabled = true;
|
||||
}
|
||||
|
||||
@@ -170,6 +178,13 @@ namespace Artemis.Core.LayerBrushes
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
#region Overrides of BreakableModel
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string BrokenDisplayName => Descriptor.DisplayName;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -28,12 +28,12 @@ namespace Artemis.Core.LayerBrushes
|
||||
|
||||
internal override void InternalRender(SKCanvas canvas, SKRect bounds, SKPaint paint)
|
||||
{
|
||||
Render(canvas, bounds, paint);
|
||||
TryOrBreak(() => Render(canvas, bounds, paint), "Failed to render");
|
||||
}
|
||||
|
||||
internal override void Initialize()
|
||||
{
|
||||
InitializeProperties();
|
||||
TryOrBreak(InitializeProperties, "Failed to initialize");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ namespace Artemis.Core.LayerBrushes
|
||||
internal override void InternalRender(SKCanvas canvas, SKRect bounds, SKPaint paint)
|
||||
{
|
||||
// We don't want rotation on this canvas because that'll displace the LEDs, translations are applied to the points of each LED instead
|
||||
if (Layer.General.TransformMode.CurrentValue == LayerTransformMode.Normal && SupportsTransformation)
|
||||
if (Layer.General.TransformMode.CurrentValue == LayerTransformMode.Normal && SupportsTransformation)
|
||||
canvas.SetMatrix(canvas.TotalMatrix.PreConcat(Layer.GetTransformMatrix(true, false, false, true).Invert()));
|
||||
|
||||
using SKPath pointsPath = new();
|
||||
@@ -46,34 +46,38 @@ namespace Artemis.Core.LayerBrushes
|
||||
}
|
||||
|
||||
// Apply the translation to the points of each LED instead
|
||||
if (Layer.General.TransformMode.CurrentValue == LayerTransformMode.Normal && SupportsTransformation)
|
||||
if (Layer.General.TransformMode.CurrentValue == LayerTransformMode.Normal && SupportsTransformation)
|
||||
pointsPath.Transform(Layer.GetTransformMatrix(true, true, true, true).Invert());
|
||||
|
||||
SKPoint[] points = pointsPath.Points;
|
||||
for (int index = 0; index < Layer.Leds.Count; index++)
|
||||
|
||||
TryOrBreak(() =>
|
||||
{
|
||||
ArtemisLed artemisLed = Layer.Leds[index];
|
||||
SKPoint renderPoint = points[index * 2 + 1];
|
||||
if (!float.IsFinite(renderPoint.X) || !float.IsFinite(renderPoint.Y))
|
||||
continue;
|
||||
for (int index = 0; index < Layer.Leds.Count; index++)
|
||||
{
|
||||
ArtemisLed artemisLed = Layer.Leds[index];
|
||||
SKPoint renderPoint = points[index * 2 + 1];
|
||||
if (!float.IsFinite(renderPoint.X) || !float.IsFinite(renderPoint.Y))
|
||||
continue;
|
||||
|
||||
// Let the brush determine the color
|
||||
ledPaint.Color = GetColor(artemisLed, renderPoint);
|
||||
// Let the brush determine the color
|
||||
ledPaint.Color = GetColor(artemisLed, renderPoint);
|
||||
|
||||
SKRect ledRectangle = SKRect.Create(
|
||||
artemisLed.AbsoluteRectangle.Left - Layer.Bounds.Left,
|
||||
artemisLed.AbsoluteRectangle.Top - Layer.Bounds.Top,
|
||||
artemisLed.AbsoluteRectangle.Width,
|
||||
artemisLed.AbsoluteRectangle.Height
|
||||
);
|
||||
SKRect ledRectangle = SKRect.Create(
|
||||
artemisLed.AbsoluteRectangle.Left - Layer.Bounds.Left,
|
||||
artemisLed.AbsoluteRectangle.Top - Layer.Bounds.Top,
|
||||
artemisLed.AbsoluteRectangle.Width,
|
||||
artemisLed.AbsoluteRectangle.Height
|
||||
);
|
||||
|
||||
canvas.DrawRect(ledRectangle, ledPaint);
|
||||
}
|
||||
canvas.DrawRect(ledRectangle, ledPaint);
|
||||
}
|
||||
}, "Failed to render");
|
||||
}
|
||||
|
||||
internal override void Initialize()
|
||||
{
|
||||
InitializeProperties();
|
||||
TryOrBreak(InitializeProperties, "Failed to initialize");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using Artemis.Core.Services;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core.LayerEffects
|
||||
@@ -7,7 +6,7 @@ namespace Artemis.Core.LayerEffects
|
||||
/// <summary>
|
||||
/// For internal use only, please use <see cref="LayerEffect{T}" /> instead
|
||||
/// </summary>
|
||||
public abstract class BaseLayerEffect : CorePropertyChanged, IDisposable
|
||||
public abstract class BaseLayerEffect : BreakableModel, IDisposable
|
||||
{
|
||||
private ILayerEffectConfigurationDialog? _configurationDialog;
|
||||
private LayerEffectDescriptor _descriptor;
|
||||
@@ -182,6 +181,22 @@ namespace Artemis.Core.LayerEffects
|
||||
|
||||
internal virtual string GetEffectTypeName() => GetType().Name;
|
||||
|
||||
internal void InternalUpdate(Timeline timeline)
|
||||
{
|
||||
BaseProperties?.Update(timeline);
|
||||
TryOrBreak(() => Update(timeline.Delta.TotalSeconds), "Failed to update");
|
||||
}
|
||||
|
||||
internal void InternalPreProcess(SKCanvas canvas, SKRect renderBounds, SKPaint paint)
|
||||
{
|
||||
TryOrBreak(() => PreProcess(canvas, renderBounds, paint), "Failed to pre-process");
|
||||
}
|
||||
|
||||
internal void InternalPostProcess(SKCanvas canvas, SKRect renderBounds, SKPaint paint)
|
||||
{
|
||||
TryOrBreak(() => PostProcess(canvas, renderBounds, paint), "Failed to post-process");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables the layer effect if it isn't already enabled
|
||||
/// </summary>
|
||||
@@ -205,5 +220,12 @@ namespace Artemis.Core.LayerEffects
|
||||
DisableLayerEffect();
|
||||
Enabled = false;
|
||||
}
|
||||
|
||||
#region Overrides of BreakableModel
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string BrokenDisplayName => Name;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user