Added keyframe support to the default value

This commit is contained in:
Diogo Trindade committed 2020-11-20 22:27:36 +00:00
1 parent f637c131c4
commit d21c7dffc2
2 files changed
+5 -6

No files matched your search

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