mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-13 04:18:51 +00:00
Core - Reworked brush/effect property storage
Profile editor - Added brush selection Profile editor - Added playback controls
This commit is contained in:
1 parent
022beb6a48
commit
1832a25426
64 files changed
+1168
-481
No files matched your search
+5
@@ -7,6 +7,11 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public class PropertyDescriptionAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// The identifier of this property used for storage, if not set one will be generated property name in code
|
||||
/// </summary>
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The user-friendly name for this property, shown in the UI
|
||||
/// </summary>
|
||||
|
||||
+8
-3
@@ -8,12 +8,17 @@ namespace Artemis.Core
|
||||
public class PropertyGroupDescriptionAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// The user-friendly name for this property, shown in the UI.
|
||||
/// The identifier of this property group used for storage, if not set one will be generated based on the group name in code
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The user-friendly description for this property, shown in the UI.
|
||||
/// The user-friendly name for this property group, shown in the UI.
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The user-friendly description for this property group, shown in the UI.
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
|
||||
@@ -16,6 +16,11 @@ namespace Artemis.Core
|
||||
/// Gets the description attribute applied to this property
|
||||
/// </summary>
|
||||
PropertyDescriptionAttribute PropertyDescription { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the profile element (such as layer or folder) this property is applied to
|
||||
/// </summary>
|
||||
RenderProfileElement ProfileElement { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The parent group of this layer property, set after construction
|
||||
@@ -43,7 +48,7 @@ namespace Artemis.Core
|
||||
public bool DataBindingsSupported { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique path of the property on the layer
|
||||
/// Gets the unique path of the property on the render element
|
||||
/// </summary>
|
||||
string Path { get; }
|
||||
|
||||
@@ -56,7 +61,7 @@ namespace Artemis.Core
|
||||
/// Indicates whether the BaseValue was loaded from storage, useful to check whether a default value must be applied
|
||||
/// </summary>
|
||||
bool IsLoadedFromStorage { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the layer property
|
||||
/// <para>
|
||||
@@ -64,7 +69,7 @@ namespace Artemis.Core
|
||||
/// <see cref="LayerProperty{T}" />
|
||||
/// </para>
|
||||
/// </summary>
|
||||
void Initialize(RenderProfileElement profileElement, LayerPropertyGroup group, PropertyEntity entity, bool fromStorage, PropertyDescriptionAttribute description, string path);
|
||||
void Initialize(RenderProfileElement profileElement, LayerPropertyGroup group, PropertyEntity entity, bool fromStorage, PropertyDescriptionAttribute description);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to load and add the provided keyframe entity to the layer property
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@@ -27,10 +28,10 @@ namespace Artemis.Core
|
||||
// These are set right after construction to keep the constructor (and inherited constructs) clean
|
||||
ProfileElement = null!;
|
||||
LayerPropertyGroup = null!;
|
||||
Path = null!;
|
||||
Entity = null!;
|
||||
PropertyDescription = null!;
|
||||
DataBinding = null!;
|
||||
Path = "";
|
||||
|
||||
CurrentValue = default!;
|
||||
DefaultValue = default!;
|
||||
@@ -117,13 +118,11 @@ namespace Artemis.Core
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the profile element (such as layer or folder) this property is applied to
|
||||
/// </summary>
|
||||
public RenderProfileElement ProfileElement { get; internal set; }
|
||||
/// <inheritdoc />
|
||||
public RenderProfileElement ProfileElement { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public LayerPropertyGroup LayerPropertyGroup { get; internal set; }
|
||||
public LayerPropertyGroup LayerPropertyGroup { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -457,16 +456,18 @@ namespace Artemis.Core
|
||||
internal PropertyEntity Entity { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Initialize(RenderProfileElement profileElement, LayerPropertyGroup group, PropertyEntity entity, bool fromStorage, PropertyDescriptionAttribute description, string path)
|
||||
public void Initialize(RenderProfileElement profileElement, LayerPropertyGroup group, PropertyEntity entity, bool fromStorage, PropertyDescriptionAttribute description)
|
||||
{
|
||||
if (_disposed)
|
||||
throw new ObjectDisposedException("LayerProperty");
|
||||
|
||||
if (description.Identifier == null)
|
||||
throw new ArtemisCoreException("Can't initialize a property group without an identifier");
|
||||
|
||||
_isInitialized = true;
|
||||
|
||||
ProfileElement = profileElement ?? throw new ArgumentNullException(nameof(profileElement));
|
||||
LayerPropertyGroup = group ?? throw new ArgumentNullException(nameof(group));
|
||||
Path = path;
|
||||
Entity = entity ?? throw new ArgumentNullException(nameof(entity));
|
||||
PropertyDescription = description ?? throw new ArgumentNullException(nameof(description));
|
||||
IsLoadedFromStorage = fromStorage;
|
||||
@@ -475,6 +476,9 @@ namespace Artemis.Core
|
||||
if (PropertyDescription.DisableKeyframes)
|
||||
KeyframesSupported = false;
|
||||
|
||||
// Create the path to this property by walking up the tree
|
||||
Path = LayerPropertyGroup.Path + "." + description.Identifier;
|
||||
|
||||
OnInitialize();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user