mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Core - Made FloatRange and IntRange readonly structs
ColorGradient - Fixed missing subscribtions when using object list manipulation API ColorGradient - Fixed editor VM going out of sync
This commit is contained in:
1 parent
bd26f447c6
commit
e385165200
19 files changed
+337
-327
No files matched your search
@@ -55,6 +55,21 @@ public class ColorGradient : IList<ColorGradientStop>, IList, INotifyCollectionC
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="ColorGradient" /> class
|
||||
/// </summary>
|
||||
/// <param name="stops">The stops to copy</param>
|
||||
public ColorGradient(List<ColorGradientStop> stops)
|
||||
{
|
||||
_stops = new List<ColorGradientStop>();
|
||||
foreach (ColorGradientStop colorGradientStop in stops)
|
||||
{
|
||||
ColorGradientStop stop = new(colorGradientStop.Color, colorGradientStop.Position);
|
||||
stop.PropertyChanged += ItemOnPropertyChanged;
|
||||
_stops.Add(stop);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the colors in the color gradient
|
||||
/// </summary>
|
||||
@@ -462,7 +477,7 @@ public class ColorGradient : IList<ColorGradientStop>, IList, INotifyCollectionC
|
||||
public int Add(object? value)
|
||||
{
|
||||
if (value is ColorGradientStop stop)
|
||||
_stops.Add(stop);
|
||||
Add(stop);
|
||||
|
||||
return IndexOf(value);
|
||||
}
|
||||
@@ -492,14 +507,14 @@ public class ColorGradient : IList<ColorGradientStop>, IList, INotifyCollectionC
|
||||
public void Insert(int index, object? value)
|
||||
{
|
||||
if (value is ColorGradientStop stop)
|
||||
_stops.Insert(index, stop);
|
||||
Insert(index, stop);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Remove(object? value)
|
||||
{
|
||||
if (value is ColorGradientStop stop)
|
||||
_stops.Remove(stop);
|
||||
Remove(stop);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -379,7 +379,7 @@ namespace Artemis.Core
|
||||
|
||||
UpdateDisplayCondition();
|
||||
UpdateTimeline(deltaTime);
|
||||
|
||||
|
||||
if (ShouldBeEnabled)
|
||||
Enable();
|
||||
else if (Timeline.IsFinished && !_renderCopies.Any())
|
||||
@@ -514,7 +514,7 @@ namespace Artemis.Core
|
||||
}, "Failed to enable one or more effects");
|
||||
if (!tryOrBreak)
|
||||
return;
|
||||
|
||||
|
||||
Enabled = true;
|
||||
}
|
||||
|
||||
@@ -633,6 +633,7 @@ namespace Artemis.Core
|
||||
if (!baseLayerEffect.Suspended)
|
||||
baseLayerEffect.InternalPreProcess(canvas, bounds, layerPaint);
|
||||
}
|
||||
|
||||
canvas.ClipPath(renderPath);
|
||||
|
||||
// Restore the blend mode before doing the actual render
|
||||
@@ -788,10 +789,14 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public void ChangeLayerBrush(BaseLayerBrush? layerBrush)
|
||||
{
|
||||
BaseLayerBrush? oldLayerBrush = LayerBrush;
|
||||
|
||||
General.BrushReference.SetCurrentValue(layerBrush != null ? new LayerBrushReference(layerBrush.Descriptor) : null, null);
|
||||
LayerBrush = layerBrush;
|
||||
LayerEntity.LayerBrush = new LayerBrushEntity();
|
||||
|
||||
|
||||
oldLayerBrush?.InternalDisable();
|
||||
|
||||
if (LayerBrush != null)
|
||||
ActivateLayerBrush();
|
||||
else
|
||||
@@ -815,7 +820,12 @@ namespace Artemis.Core
|
||||
General.ShapeType.IsHidden = LayerBrush != null && !LayerBrush.SupportsTransformation;
|
||||
General.BlendMode.IsHidden = LayerBrush != null && !LayerBrush.SupportsTransformation;
|
||||
Transform.IsHidden = LayerBrush != null && !LayerBrush.SupportsTransformation;
|
||||
LayerBrush?.Update(0);
|
||||
if (LayerBrush != null)
|
||||
{
|
||||
if (!LayerBrush.Enabled)
|
||||
LayerBrush.InternalEnable();
|
||||
LayerBrush?.Update(0);
|
||||
}
|
||||
|
||||
OnLayerBrushUpdated();
|
||||
ClearBrokenState("Failed to initialize layer brush");
|
||||
|
||||
@@ -5,18 +5,10 @@ namespace Artemis.Core
|
||||
/// <summary>
|
||||
/// Represents a range between two single-precision floating point numbers
|
||||
/// </summary>
|
||||
public class FloatRange
|
||||
public readonly struct FloatRange
|
||||
{
|
||||
private readonly Random _rand;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="FloatRange" /> class
|
||||
/// </summary>
|
||||
public FloatRange()
|
||||
{
|
||||
_rand = new Random();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="FloatRange" /> class
|
||||
/// </summary>
|
||||
@@ -31,14 +23,14 @@ namespace Artemis.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the start value of the range
|
||||
/// Gets the start value of the range
|
||||
/// </summary>
|
||||
public float Start { get; set; }
|
||||
public float Start { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the end value of the range
|
||||
/// Gets the end value of the range
|
||||
/// </summary>
|
||||
public float End { get; set; }
|
||||
public float End { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the given value is in this range
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Artemis.Core
|
||||
/// Gets a boolean indicating whether data bindings are supported on this type of property
|
||||
/// </summary>
|
||||
public bool DataBindingsSupported { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique path of the property on the render element
|
||||
/// </summary>
|
||||
|
||||
@@ -5,18 +5,10 @@ namespace Artemis.Core
|
||||
/// <summary>
|
||||
/// Represents a range between two signed integers
|
||||
/// </summary>
|
||||
public class IntRange
|
||||
public readonly struct IntRange
|
||||
{
|
||||
private readonly Random _rand;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="IntRange" /> class
|
||||
/// </summary>
|
||||
public IntRange()
|
||||
{
|
||||
_rand = new Random();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="IntRange" /> class
|
||||
/// </summary>
|
||||
@@ -31,14 +23,14 @@ namespace Artemis.Core
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the start value of the range
|
||||
/// Gets the start value of the range
|
||||
/// </summary>
|
||||
public int Start { get; set; }
|
||||
public int Start { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the end value of the range
|
||||
/// Gets the end value of the range
|
||||
/// </summary>
|
||||
public int End { get; set; }
|
||||
public int End { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the given value is in this range
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace Artemis.Core
|
||||
/// <summary>
|
||||
/// Gets whether keyframes are supported on this type of property
|
||||
/// </summary>
|
||||
public bool KeyframesSupported { get; protected internal set; } = true;
|
||||
public bool KeyframesSupported { get; protected set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether keyframes are enabled on this property, has no effect if <see cref="KeyframesSupported" /> is
|
||||
|
||||
Reference in new issue
Block a user