mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
UI - Restructured layer property VMs
This commit is contained in:
1 parent
41b3c77210
commit
54081b591b
11 files changed
+163
-234
No files matched your search
@@ -125,7 +125,7 @@ namespace Artemis.Core.Models.Profile
|
||||
|
||||
General.ApplyToEntity();
|
||||
Transform.ApplyToEntity();
|
||||
LayerBrush.ApplyToEntity();
|
||||
LayerBrush.BaseProperties.ApplyToEntity();
|
||||
|
||||
// LEDs
|
||||
LayerEntity.Leds.Clear();
|
||||
@@ -187,7 +187,7 @@ namespace Artemis.Core.Models.Profile
|
||||
|
||||
var properties = new List<BaseLayerProperty>(General.GetAllLayerProperties());
|
||||
properties.AddRange(Transform.GetAllLayerProperties());
|
||||
properties.AddRange(LayerBrush.GetAllLayerProperties());
|
||||
properties.AddRange(LayerBrush.BaseProperties.GetAllLayerProperties());
|
||||
|
||||
// For now, reset all keyframe engines after the last keyframe was hit
|
||||
// This is a placeholder method of repeating the animation until repeat modes are implemented
|
||||
@@ -196,13 +196,13 @@ namespace Artemis.Core.Models.Profile
|
||||
{
|
||||
General.Override(TimeSpan.Zero);
|
||||
Transform.Override(TimeSpan.Zero);
|
||||
LayerBrush.OverrideProperties(TimeSpan.Zero);
|
||||
LayerBrush.BaseProperties.Override(TimeSpan.Zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
General.Update(deltaTime);
|
||||
Transform.Update(deltaTime);
|
||||
LayerBrush.UpdateProperties(deltaTime);
|
||||
LayerBrush.BaseProperties.Update(deltaTime);
|
||||
}
|
||||
|
||||
LayerBrush.Update(deltaTime);
|
||||
@@ -212,7 +212,7 @@ namespace Artemis.Core.Models.Profile
|
||||
{
|
||||
General.Override(timeOverride);
|
||||
Transform.Override(timeOverride);
|
||||
LayerBrush.OverrideProperties(timeOverride);
|
||||
LayerBrush.BaseProperties.Override(timeOverride);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -5,7 +5,7 @@ using Artemis.Storage.Entities.Profile;
|
||||
namespace Artemis.Core.Models.Profile.LayerProperties
|
||||
{
|
||||
/// <summary>
|
||||
/// For internal use only, to implement your own layer property type, extend <see cref="LayerProperty{T}"/> instead.
|
||||
/// For internal use only, to implement your own layer property type, extend <see cref="LayerProperty{T}" /> instead.
|
||||
/// </summary>
|
||||
public abstract class BaseLayerProperty
|
||||
{
|
||||
@@ -42,11 +42,15 @@ namespace Artemis.Core.Models.Profile.LayerProperties
|
||||
/// <summary>
|
||||
/// Used to declare that this property doesn't belong to a plugin and should use the core plugin GUID
|
||||
/// </summary>
|
||||
internal bool IsCoreProperty { get; set; }
|
||||
public bool IsCoreProperty { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of all the keyframes in their non-generic base form, without their values being available
|
||||
/// </summary>
|
||||
public abstract IReadOnlyList<BaseLayerPropertyKeyframe> BaseKeyframes { get; }
|
||||
|
||||
internal PropertyEntity PropertyEntity { get; set; }
|
||||
internal LayerPropertyGroup LayerPropertyGroup { get; set; }
|
||||
internal abstract IReadOnlyList<BaseLayerPropertyKeyframe> BaseKeyframes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Applies the provided property entity to the layer property by deserializing the JSON base value and keyframe values
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties
|
||||
/// </summary>
|
||||
public LayerPropertyKeyframe<T> NextKeyframe { get; protected set; }
|
||||
|
||||
internal override IReadOnlyList<BaseLayerPropertyKeyframe> BaseKeyframes => _keyframes.Cast<BaseLayerPropertyKeyframe>().ToList().AsReadOnly();
|
||||
public override IReadOnlyList<BaseLayerPropertyKeyframe> BaseKeyframes => _keyframes.Cast<BaseLayerPropertyKeyframe>().ToList().AsReadOnly();
|
||||
|
||||
/// <summary>
|
||||
/// Adds a keyframe to the layer property
|
||||
|
||||
@@ -14,29 +14,34 @@ namespace Artemis.Core.Models.Profile
|
||||
public class LayerPropertyGroup
|
||||
{
|
||||
private ReadOnlyCollection<BaseLayerProperty> _allLayerProperties;
|
||||
private readonly List<BaseLayerProperty> _layerProperties;
|
||||
private readonly List<LayerPropertyGroup> _layerPropertyGroups;
|
||||
|
||||
protected LayerPropertyGroup()
|
||||
{
|
||||
LayerProperties = new List<BaseLayerProperty>();
|
||||
LayerPropertyGroups = new List<LayerPropertyGroup>();
|
||||
_layerProperties = new List<BaseLayerProperty>();
|
||||
_layerPropertyGroups = new List<LayerPropertyGroup>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether this property group's properties are all initialized
|
||||
/// </summary>
|
||||
public bool PropertiesInitialized { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used to declare that this property group doesn't belong to a plugin and should use the core plugin GUID
|
||||
/// </summary>
|
||||
internal bool IsCorePropertyGroup { get; set; }
|
||||
public bool IsCorePropertyGroup { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// A list of all layer properties in this group
|
||||
/// </summary>
|
||||
internal List<BaseLayerProperty> LayerProperties { get; set; }
|
||||
public ReadOnlyCollection<BaseLayerProperty> LayerProperties => _layerProperties.AsReadOnly();
|
||||
|
||||
/// <summary>
|
||||
/// A list of al child groups in this group
|
||||
/// </summary>
|
||||
internal List<LayerPropertyGroup> LayerPropertyGroups { get; set; }
|
||||
public ReadOnlyCollection<LayerPropertyGroup> LayerPropertyGroups => _layerPropertyGroups.AsReadOnly();
|
||||
|
||||
/// <summary>
|
||||
/// Called when all layer properties in this property group have been initialized
|
||||
@@ -63,7 +68,7 @@ namespace Artemis.Core.Models.Profile
|
||||
var instance = (BaseLayerProperty) Activator.CreateInstance(propertyInfo.PropertyType);
|
||||
InitializeProperty(layer, path, instance);
|
||||
propertyInfo.SetValue(this, instance);
|
||||
LayerProperties.Add(instance);
|
||||
_layerProperties.Add(instance);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -76,7 +81,7 @@ namespace Artemis.Core.Models.Profile
|
||||
var instance = (LayerPropertyGroup) Activator.CreateInstance(propertyInfo.PropertyType);
|
||||
instance.InitializeProperties(layerService, layer, $"{path}{propertyInfo.Name}.");
|
||||
propertyInfo.SetValue(this, instance);
|
||||
LayerPropertyGroups.Add(instance);
|
||||
_layerPropertyGroups.Add(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,7 +126,7 @@ namespace Artemis.Core.Models.Profile
|
||||
/// Recursively gets all layer properties on this group and any subgroups
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal IReadOnlyCollection<BaseLayerProperty> GetAllLayerProperties()
|
||||
public IReadOnlyCollection<BaseLayerProperty> GetAllLayerProperties()
|
||||
{
|
||||
if (!PropertiesInitialized)
|
||||
return new List<BaseLayerProperty>();
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Profile.LayerProperties;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using SkiaSharp;
|
||||
@@ -29,7 +27,7 @@ namespace Artemis.Core.Plugins.LayerBrush
|
||||
/// </summary>
|
||||
public PluginInfo PluginInfo => Descriptor.LayerBrushProvider.PluginInfo;
|
||||
|
||||
internal virtual LayerPropertyGroup BaseProperties => null;
|
||||
public virtual LayerPropertyGroup BaseProperties => null;
|
||||
|
||||
/// <summary>
|
||||
/// Called when the brush is being removed from the layer
|
||||
@@ -62,22 +60,5 @@ namespace Artemis.Core.Plugins.LayerBrush
|
||||
internal virtual void InitializeProperties(ILayerService layerService, string path)
|
||||
{
|
||||
}
|
||||
|
||||
internal virtual void ApplyToEntity()
|
||||
{
|
||||
}
|
||||
|
||||
internal virtual void UpdateProperties(double deltaTime)
|
||||
{
|
||||
}
|
||||
|
||||
internal virtual void OverrideProperties(TimeSpan overrideTime)
|
||||
{
|
||||
}
|
||||
|
||||
internal virtual IReadOnlyCollection<BaseLayerProperty> GetAllLayerProperties()
|
||||
{
|
||||
return new List<BaseLayerProperty>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ namespace Artemis.Core.Plugins.LayerBrush
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override LayerPropertyGroup BaseProperties => Properties;
|
||||
public override LayerPropertyGroup BaseProperties => Properties;
|
||||
|
||||
internal override void InitializeProperties(ILayerService layerService, string path)
|
||||
{
|
||||
@@ -56,22 +56,17 @@ namespace Artemis.Core.Plugins.LayerBrush
|
||||
PropertiesInitialized = true;
|
||||
}
|
||||
|
||||
internal override void ApplyToEntity()
|
||||
internal virtual void ApplyToEntity()
|
||||
{
|
||||
Properties.ApplyToEntity();
|
||||
}
|
||||
|
||||
internal override void UpdateProperties(double deltaTime)
|
||||
{
|
||||
Properties.Update(deltaTime);
|
||||
}
|
||||
|
||||
internal override void OverrideProperties(TimeSpan overrideTime)
|
||||
internal virtual void OverrideProperties(TimeSpan overrideTime)
|
||||
{
|
||||
Properties.Override(overrideTime);
|
||||
}
|
||||
|
||||
internal override IReadOnlyCollection<BaseLayerProperty> GetAllLayerProperties()
|
||||
internal virtual IReadOnlyCollection<BaseLayerProperty> GetAllLayerProperties()
|
||||
{
|
||||
return Properties.GetAllLayerProperties();
|
||||
}
|
||||
|
||||
@@ -76,10 +76,5 @@ namespace Artemis.Core.Services
|
||||
|
||||
layer.LayerEntity.PropertyEntities.RemoveAll(p => p.PluginGuid == brush.PluginInfo.Guid);
|
||||
}
|
||||
|
||||
public void GetLayerPropertyGroups(Layer layer)
|
||||
{
|
||||
var groups = new List<LayerPropertyGroup> {layer.General, layer.Transform, layer.LayerBrush.BrushProperties};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user