1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2026-01-02 10:43:31 +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> /// <summary>
/// Overrides the property value with the default value /// Overrides the property value with the default value
/// </summary> /// </summary>
public void ApplyDefaultValue() public void ApplyDefaultValue(TimeSpan? time)
{ {
if (_disposed) if (_disposed)
throw new ObjectDisposedException("LayerProperty"); throw new ObjectDisposedException("LayerProperty");
string json = JsonConvert.SerializeObject(DefaultValue, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All }); string json = JsonConvert.SerializeObject(DefaultValue, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All });
BaseValue = JsonConvert.DeserializeObject<T>(json); SetCurrentValue(JsonConvert.DeserializeObject<T>(json), time);
CurrentValue = JsonConvert.DeserializeObject<T>(json);
} }
private void ReapplyUpdate() private void ReapplyUpdate()
@ -508,7 +507,7 @@ namespace Artemis.Core
throw new ArtemisCoreException("Layer property is not yet initialized"); throw new ArtemisCoreException("Layer property is not yet initialized");
if (!IsLoadedFromStorage) if (!IsLoadedFromStorage)
ApplyDefaultValue(); ApplyDefaultValue(null);
else else
try try
{ {

View File

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