1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Layer properties - Fixed some checks

This commit is contained in:
SpoinkyNL 2020-08-03 23:58:46 +02:00
parent 10e9e9446a
commit 7b1cefca8b
3 changed files with 5 additions and 10 deletions

View File

@ -40,8 +40,8 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Attributes
public object MaxInputValue { get; set; }
/// <summary>
/// Whether or not keyframes are supported, true by default and cannot be changed at runtime
/// Whether or not keyframes are always disabled
/// </summary>
public bool KeyframesSupported { get; set; } = true;
public bool DisableKeyframes { get; set; }
}
}

View File

@ -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);

View File

@ -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()