mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
UI - Updated Stylet
Keyframes - Finished copy/paste implementation
This commit is contained in:
1 parent
0fd30aef2d
commit
dd73c1e4c9
14 files changed
+177
-64
No files matched your search
@@ -16,10 +16,15 @@ namespace Artemis.Core
|
||||
/// <summary>
|
||||
/// Gets the description attribute applied to this property
|
||||
/// </summary>
|
||||
public PropertyDescriptionAttribute PropertyDescription { get; }
|
||||
PropertyDescriptionAttribute PropertyDescription { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique path of the property on the layer
|
||||
/// The parent group of this layer property, set after construction
|
||||
/// </summary>
|
||||
LayerPropertyGroup LayerPropertyGroup { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique path of the property on the layer
|
||||
/// </summary>
|
||||
public string Path { get; }
|
||||
|
||||
@@ -30,7 +35,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, string path);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list off all data binding registrations
|
||||
@@ -38,7 +43,14 @@ namespace Artemis.Core
|
||||
List<IDataBindingRegistration> GetAllDataBindingRegistrations();
|
||||
|
||||
/// <summary>
|
||||
/// Updates the layer properties internal state
|
||||
/// Attempts to load and add the provided keyframe entity to the layer property
|
||||
/// </summary>
|
||||
/// <param name="keyframeEntity">The entity representing the keyframe to add</param>
|
||||
/// <returns>If succeeded the resulting keyframe, otherwise <see langword="null" /></returns>
|
||||
ILayerPropertyKeyframe? AddKeyframeEntity(KeyframeEntity keyframeEntity);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the layer properties internal state
|
||||
/// </summary>
|
||||
/// <param name="timeline">The timeline to apply to the property</param>
|
||||
void Update(Timeline timeline);
|
||||
|
||||
@@ -118,9 +118,7 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public RenderProfileElement ProfileElement { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The parent group of this layer property, set after construction
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public LayerPropertyGroup LayerPropertyGroup { get; internal set; }
|
||||
|
||||
#endregion
|
||||
@@ -282,6 +280,22 @@ namespace Artemis.Core
|
||||
OnKeyframeAdded();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ILayerPropertyKeyframe? AddKeyframeEntity(KeyframeEntity keyframeEntity)
|
||||
{
|
||||
if (keyframeEntity.Position > ProfileElement.Timeline.Length)
|
||||
return null;
|
||||
T value = CoreJson.DeserializeObject<T>(keyframeEntity.Value);
|
||||
if (value == null)
|
||||
return null;
|
||||
|
||||
LayerPropertyKeyframe<T> keyframe = new LayerPropertyKeyframe<T>(
|
||||
CoreJson.DeserializeObject<T>(keyframeEntity.Value)!, keyframeEntity.Position, (Easings.Functions) keyframeEntity.EasingFunction, this
|
||||
);
|
||||
AddKeyframe(keyframe);
|
||||
return keyframe;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a keyframe from the layer property
|
||||
/// </summary>
|
||||
@@ -508,6 +522,7 @@ namespace Artemis.Core
|
||||
if (!IsLoadedFromStorage)
|
||||
ApplyDefaultValue(null);
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Entity.Value != null)
|
||||
@@ -517,6 +532,7 @@ namespace Artemis.Core
|
||||
{
|
||||
// ignored for now
|
||||
}
|
||||
}
|
||||
|
||||
CurrentValue = BaseValue;
|
||||
KeyframesEnabled = Entity.KeyframesEnabled;
|
||||
@@ -524,12 +540,8 @@ namespace Artemis.Core
|
||||
_keyframes.Clear();
|
||||
try
|
||||
{
|
||||
_keyframes.AddRange(Entity.KeyframeEntities
|
||||
.Where(k => k.Position <= ProfileElement.Timeline.Length)
|
||||
.Select(k => new LayerPropertyKeyframe<T>(
|
||||
CoreJson.DeserializeObject<T>(k.Value)!, k.Position, (Easings.Functions) k.EasingFunction, this
|
||||
))
|
||||
);
|
||||
foreach (KeyframeEntity keyframeEntity in Entity.KeyframeEntities.Where(k => k.Position <= ProfileElement.Timeline.Length))
|
||||
AddKeyframeEntity(keyframeEntity);
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user