mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Profiles - Added module activation requirements
Editor - Refactored tools and selected keyframes management Timeline - Added keyframe duplicating, copying and pasting Windows UI - Added logging of fatal exceptions
This commit is contained in:
1 parent
d563d17270
commit
dd40bdd544
31 files changed
+719
-178
No files matched your search
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
|
||||
@@ -79,11 +78,11 @@ namespace Artemis.Core
|
||||
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
|
||||
/// Attempts to create a keyframe for this property from the provided entity
|
||||
/// </summary>
|
||||
/// <param name="keyframeEntity">The entity representing the keyframe to add</param>
|
||||
/// <param name="keyframeEntity">The entity representing the keyframe to create</param>
|
||||
/// <returns>If succeeded the resulting keyframe, otherwise <see langword="null" /></returns>
|
||||
ILayerPropertyKeyframe? AddKeyframeEntity(KeyframeEntity keyframeEntity);
|
||||
ILayerPropertyKeyframe? CreateKeyframeFromEntity(KeyframeEntity keyframeEntity);
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the property value with the default value
|
||||
|
||||
@@ -32,5 +32,12 @@ namespace Artemis.Core
|
||||
/// Removes the keyframe from the layer property
|
||||
/// </summary>
|
||||
void Remove();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a copy of this keyframe.
|
||||
/// <para>Note: The copied keyframe is not added to the layer property.</para>
|
||||
/// </summary>
|
||||
/// <returns>The resulting copy</returns>
|
||||
ILayerPropertyKeyframe CreateCopy();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@@ -326,19 +324,24 @@ namespace Artemis.Core
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ILayerPropertyKeyframe? AddKeyframeEntity(KeyframeEntity keyframeEntity)
|
||||
public ILayerPropertyKeyframe? CreateKeyframeFromEntity(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(
|
||||
CoreJson.DeserializeObject<T>(keyframeEntity.Value)!, keyframeEntity.Position, (Easings.Functions) keyframeEntity.EasingFunction, this
|
||||
);
|
||||
AddKeyframe(keyframe);
|
||||
return keyframe;
|
||||
try
|
||||
{
|
||||
T? value = CoreJson.DeserializeObject<T>(keyframeEntity.Value);
|
||||
if (value == null)
|
||||
return null;
|
||||
|
||||
LayerPropertyKeyframe<T> keyframe = new(value, keyframeEntity.Position, (Easings.Functions) keyframeEntity.EasingFunction, this);
|
||||
return keyframe;
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -514,7 +517,7 @@ namespace Artemis.Core
|
||||
|
||||
// Create the path to this property by walking up the tree
|
||||
Path = LayerPropertyGroup.Path + "." + description.Identifier;
|
||||
|
||||
|
||||
OnInitialize();
|
||||
}
|
||||
|
||||
@@ -547,7 +550,7 @@ namespace Artemis.Core
|
||||
try
|
||||
{
|
||||
foreach (KeyframeEntity keyframeEntity in Entity.KeyframeEntities.Where(k => k.Position <= ProfileElement.Timeline.Length))
|
||||
AddKeyframeEntity(keyframeEntity);
|
||||
CreateKeyframeFromEntity(keyframeEntity);
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
|
||||
@@ -80,5 +80,11 @@ namespace Artemis.Core
|
||||
{
|
||||
LayerProperty.RemoveKeyframe(this);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ILayerPropertyKeyframe CreateCopy()
|
||||
{
|
||||
return new LayerPropertyKeyframe<T>(Value, Position, EasingFunction, LayerProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -241,7 +241,9 @@ namespace Artemis.Core
|
||||
|
||||
Icon.Load();
|
||||
|
||||
ActivationCondition.LoadFromEntity(Entity.ActivationCondition);
|
||||
if (Entity.ActivationCondition != null)
|
||||
ActivationCondition.LoadFromEntity(Entity.ActivationCondition);
|
||||
|
||||
EnableHotkey = Entity.EnableHotkey != null ? new Hotkey(Entity.EnableHotkey) : null;
|
||||
DisableHotkey = Entity.DisableHotkey != null ? new Hotkey(Entity.DisableHotkey) : null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user