diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/Types/ColorGradientLayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/Types/ColorGradientLayerProperty.cs index 11cf760d3..483fb2c05 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/Types/ColorGradientLayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/Types/ColorGradientLayerProperty.cs @@ -24,5 +24,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Types // Don't allow color gradients to be null BaseValue ??= DefaultValue ?? new ColorGradient(); } + + public static implicit operator ColorGradient(ColorGradientLayerProperty p) => p.CurrentValue; } } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/Types/EnumLayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/Types/EnumLayerProperty.cs index 63cfbbfd7..ce1edb251 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/Types/EnumLayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/Types/EnumLayerProperty.cs @@ -15,5 +15,8 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Types { throw new ArtemisCoreException("Enum properties do not support keyframes."); } + + public static implicit operator T(EnumLayerProperty p) => p.CurrentValue; + public static implicit operator int(EnumLayerProperty p) => Convert.ToInt32(p.CurrentValue); } } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/Types/FloatLayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/Types/FloatLayerProperty.cs index bc6e2ed01..1d5a09c9c 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/Types/FloatLayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/Types/FloatLayerProperty.cs @@ -12,5 +12,8 @@ var diff = NextKeyframe.Value - CurrentKeyframe.Value; CurrentValue = CurrentKeyframe.Value + diff * keyframeProgressEased; } + + public static implicit operator float(FloatLayerProperty p) => p.CurrentValue; + public static implicit operator double(FloatLayerProperty p) => p.CurrentValue; } } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/Types/IntLayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/Types/IntLayerProperty.cs index 96eab86f2..4ec1e3e8d 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/Types/IntLayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/Types/IntLayerProperty.cs @@ -14,5 +14,9 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Types var diff = NextKeyframe.Value - CurrentKeyframe.Value; CurrentValue = (int) Math.Round(CurrentKeyframe.Value + diff * keyframeProgressEased, MidpointRounding.AwayFromZero); } + + public static implicit operator int(IntLayerProperty p) => p.CurrentValue; + public static implicit operator float(IntLayerProperty p) => p.CurrentValue; + public static implicit operator double(IntLayerProperty p) => p.CurrentValue; } } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/Types/LayerBrushReferenceLayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/Types/LayerBrushReferenceLayerProperty.cs index f1d99e642..e7e4e2023 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/Types/LayerBrushReferenceLayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/Types/LayerBrushReferenceLayerProperty.cs @@ -16,5 +16,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Types { throw new ArtemisCoreException("Layer brush references do not support keyframes."); } + + public static implicit operator LayerBrushReference(LayerBrushReferenceLayerProperty p) => p.CurrentValue; } } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKColorLayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKColorLayerProperty.cs index b478cbd77..1b5d1359b 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKColorLayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKColorLayerProperty.cs @@ -29,5 +29,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Types { return (byte) Math.Max(0, Math.Min(255, value)); } + + public static implicit operator SKColor(SKColorLayerProperty p) => p.CurrentValue; } } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKPointLayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKPointLayerProperty.cs index 7595d2d62..4246cd740 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKPointLayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKPointLayerProperty.cs @@ -15,5 +15,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Types var yDiff = NextKeyframe.Value.Y - CurrentKeyframe.Value.Y; CurrentValue = new SKPoint(CurrentKeyframe.Value.X + xDiff * keyframeProgressEased, CurrentKeyframe.Value.Y + yDiff * keyframeProgressEased); } + + public static implicit operator SKPoint(SKPointLayerProperty p) => p.CurrentValue; } } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKSizeLayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKSizeLayerProperty.cs index f89229005..647ed68cf 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKSizeLayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/Types/SKSizeLayerProperty.cs @@ -15,5 +15,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Types var heightDiff = NextKeyframe.Value.Height - CurrentKeyframe.Value.Height; CurrentValue = new SKSize(CurrentKeyframe.Value.Width + widthDiff * keyframeProgressEased, CurrentKeyframe.Value.Height + heightDiff * keyframeProgressEased); } + + public static implicit operator SKSize(SKSizeLayerProperty p) => p.CurrentValue; } } \ No newline at end of file