From 7b1cefca8b95050b06a6386db9a8c6dd863f4510 Mon Sep 17 00:00:00 2001 From: SpoinkyNL Date: Mon, 3 Aug 2020 23:58:46 +0200 Subject: [PATCH] Layer properties - Fixed some checks --- .../Attributes/PropertyDescriptionAttribute.cs | 4 ++-- src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs | 9 ++------- .../ColorBrushProperties.cs | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/Attributes/PropertyDescriptionAttribute.cs b/src/Artemis.Core/Models/Profile/LayerProperties/Attributes/PropertyDescriptionAttribute.cs index d069cae16..48b83535a 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/Attributes/PropertyDescriptionAttribute.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/Attributes/PropertyDescriptionAttribute.cs @@ -40,8 +40,8 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Attributes public object MaxInputValue { get; set; } /// - /// Whether or not keyframes are supported, true by default and cannot be changed at runtime + /// Whether or not keyframes are always disabled /// - public bool KeyframesSupported { get; set; } = true; + public bool DisableKeyframes { get; set; } } } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs b/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs index 70893bc8f..d8996de33 100644 --- a/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs +++ b/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs @@ -156,14 +156,9 @@ namespace Artemis.Core.Models.Profile instance.ProfileElement = profileElement; instance.Parent = this; instance.PropertyDescription = (PropertyDescriptionAttribute) propertyDescription; - if (!instance.KeyframesSupported && instance.PropertyDescription.KeyframesSupported) - { - throw new ArtemisPluginException($"Failed to create instance of layer property at {path + propertyInfo.Name}. " + - $"In the description attribute {nameof(instance.KeyframesSupported)} is set to true but this layer property type " + - "does not support keyframes."); - } + if (instance.PropertyDescription.DisableKeyframes) + instance.KeyframesSupported = false; - instance.KeyframesSupported = instance.PropertyDescription.KeyframesSupported; InitializeProperty(profileElement, path + propertyInfo.Name, instance); propertyInfo.SetValue(this, instance); diff --git a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrushProperties.cs b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrushProperties.cs index 041e9d035..4e1264854 100644 --- a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrushProperties.cs +++ b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrushProperties.cs @@ -21,7 +21,7 @@ namespace Artemis.Plugins.LayerBrushes.Color [PropertyDescription(Description = "The gradient of the brush")] public ColorGradientLayerProperty Gradient { get; set; } - [PropertyDescription(KeyframesSupported = false, Description = "How many times to repeat the colors in the selected gradient", MinInputValue = 0, MaxInputValue = 10)] + [PropertyDescription(DisableKeyframes = true, Description = "How many times to repeat the colors in the selected gradient", MinInputValue = 0, MaxInputValue = 10)] public IntLayerProperty GradientRepeat { get; set; } protected override void PopulateDefaults()