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

Added keyframe support to the default value

This commit is contained in:
Diogo Trindade 2020-11-20 21:47:34 +00:00
parent f637c131c4
commit d21c7dffc2
2 changed files with 5 additions and 6 deletions

View File

@ -203,15 +203,14 @@ namespace Artemis.Core
/// <summary>
/// Overrides the property value with the default value
/// </summary>
public void ApplyDefaultValue()
public void ApplyDefaultValue(TimeSpan? time)
{
if (_disposed)
throw new ObjectDisposedException("LayerProperty");
string json = JsonConvert.SerializeObject(DefaultValue, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All });
BaseValue = JsonConvert.DeserializeObject<T>(json);
CurrentValue = JsonConvert.DeserializeObject<T>(json);
SetCurrentValue(JsonConvert.DeserializeObject<T>(json), time);
}
private void ReapplyUpdate()
@ -508,7 +507,7 @@ namespace Artemis.Core
throw new ArtemisCoreException("Layer property is not yet initialized");
if (!IsLoadedFromStorage)
ApplyDefaultValue();
ApplyDefaultValue(null);
else
try
{

View File

@ -51,7 +51,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
public void ResetToDefault()
{
LayerProperty.ApplyDefaultValue();
LayerProperty.ApplyDefaultValue(_profileEditorService.CurrentTime);
_profileEditorService.UpdateSelectedProfileElement();
}