From d21c7dffc22ed61e55857f9ff31db1343308d19a Mon Sep 17 00:00:00 2001 From: Diogo Trindade Date: Fri, 20 Nov 2020 21:47:34 +0000 Subject: [PATCH] Added keyframe support to the default value --- .../Models/Profile/LayerProperties/LayerProperty.cs | 9 ++++----- .../LayerProperties/Tree/TreePropertyViewModel.cs | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs index 74ad46048..2c658ccb2 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs @@ -203,15 +203,14 @@ namespace Artemis.Core /// /// Overrides the property value with the default value /// - 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(json); - CurrentValue = JsonConvert.DeserializeObject(json); + + SetCurrentValue(JsonConvert.DeserializeObject(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 { diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreePropertyViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreePropertyViewModel.cs index bde10777a..e6c2ec2c4 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreePropertyViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreePropertyViewModel.cs @@ -51,7 +51,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree public void ResetToDefault() { - LayerProperty.ApplyDefaultValue(); + LayerProperty.ApplyDefaultValue(_profileEditorService.CurrentTime); _profileEditorService.UpdateSelectedProfileElement(); }