diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/ILayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/ILayerProperty.cs
index 512b63213..c586fd548 100644
--- a/src/Artemis.Core/Models/Profile/LayerProperties/ILayerProperty.cs
+++ b/src/Artemis.Core/Models/Profile/LayerProperties/ILayerProperty.cs
@@ -16,10 +16,15 @@ namespace Artemis.Core
///
/// Gets the description attribute applied to this property
///
- public PropertyDescriptionAttribute PropertyDescription { get; }
+ PropertyDescriptionAttribute PropertyDescription { get; }
///
- /// Gets the unique path of the property on the layer
+ /// The parent group of this layer property, set after construction
+ ///
+ LayerPropertyGroup LayerPropertyGroup { get; }
+
+ ///
+ /// Gets the unique path of the property on the layer
///
public string Path { get; }
@@ -30,7 +35,7 @@ namespace Artemis.Core
///
///
///
- void Initialize(RenderProfileElement profileElement, LayerPropertyGroup @group, PropertyEntity entity, bool fromStorage, PropertyDescriptionAttribute description, string path);
+ void Initialize(RenderProfileElement profileElement, LayerPropertyGroup group, PropertyEntity entity, bool fromStorage, PropertyDescriptionAttribute description, string path);
///
/// Returns a list off all data binding registrations
@@ -38,7 +43,14 @@ namespace Artemis.Core
List GetAllDataBindingRegistrations();
///
- /// Updates the layer properties internal state
+ /// Attempts to load and add the provided keyframe entity to the layer property
+ ///
+ /// The entity representing the keyframe to add
+ /// If succeeded the resulting keyframe, otherwise
+ ILayerPropertyKeyframe? AddKeyframeEntity(KeyframeEntity keyframeEntity);
+
+ ///
+ /// Updates the layer properties internal state
///
/// The timeline to apply to the property
void Update(Timeline timeline);
diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
index 9d8330785..c72c89f82 100644
--- a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
+++ b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
@@ -118,9 +118,7 @@ namespace Artemis.Core
///
public RenderProfileElement ProfileElement { get; internal set; }
- ///
- /// The parent group of this layer property, set after construction
- ///
+ ///
public LayerPropertyGroup LayerPropertyGroup { get; internal set; }
#endregion
@@ -282,6 +280,22 @@ namespace Artemis.Core
OnKeyframeAdded();
}
+ ///
+ public ILayerPropertyKeyframe? AddKeyframeEntity(KeyframeEntity keyframeEntity)
+ {
+ if (keyframeEntity.Position > ProfileElement.Timeline.Length)
+ return null;
+ T value = CoreJson.DeserializeObject(keyframeEntity.Value);
+ if (value == null)
+ return null;
+
+ LayerPropertyKeyframe keyframe = new LayerPropertyKeyframe(
+ CoreJson.DeserializeObject(keyframeEntity.Value)!, keyframeEntity.Position, (Easings.Functions) keyframeEntity.EasingFunction, this
+ );
+ AddKeyframe(keyframe);
+ return keyframe;
+ }
+
///
/// Removes a keyframe from the layer property
///
@@ -508,6 +522,7 @@ namespace Artemis.Core
if (!IsLoadedFromStorage)
ApplyDefaultValue(null);
else
+ {
try
{
if (Entity.Value != null)
@@ -517,6 +532,7 @@ namespace Artemis.Core
{
// ignored for now
}
+ }
CurrentValue = BaseValue;
KeyframesEnabled = Entity.KeyframesEnabled;
@@ -524,12 +540,8 @@ namespace Artemis.Core
_keyframes.Clear();
try
{
- _keyframes.AddRange(Entity.KeyframeEntities
- .Where(k => k.Position <= ProfileElement.Timeline.Length)
- .Select(k => new LayerPropertyKeyframe(
- CoreJson.DeserializeObject(k.Value)!, k.Position, (Easings.Functions) k.EasingFunction, this
- ))
- );
+ foreach (KeyframeEntity keyframeEntity in Entity.KeyframeEntities.Where(k => k.Position <= ProfileElement.Timeline.Length))
+ AddKeyframeEntity(keyframeEntity);
}
catch (JsonException)
{
diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
index 03d21fda6..f92e6bb8f 100644
--- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
+++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
@@ -43,7 +43,7 @@
-
+
diff --git a/src/Artemis.UI.Shared/packages.lock.json b/src/Artemis.UI.Shared/packages.lock.json
index eaa3f5270..a25ff9ed5 100644
--- a/src/Artemis.UI.Shared/packages.lock.json
+++ b/src/Artemis.UI.Shared/packages.lock.json
@@ -85,9 +85,9 @@
},
"Stylet": {
"type": "Direct",
- "requested": "[1.3.4, )",
- "resolved": "1.3.4",
- "contentHash": "bCEdA+AIi+TM9SQQGLYMsFRIfzZcDUDg2Mznyr72kOkcC/cdBj01/jel4/v2aoKwbFcxVjiqmpgnbsFgMEZ4zQ==",
+ "requested": "[1.3.5, )",
+ "resolved": "1.3.5",
+ "contentHash": "9vjjaTgf5sZAGHnxQWIslD32MG5gXj7ANgS+w965L5Eh//UC3qwZDrEf226Pf+v1P/ldAJDpUySnOyGlb3TSSw==",
"dependencies": {
"System.Drawing.Common": "4.6.0"
}
diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj
index 00b623a35..032a4ac72 100644
--- a/src/Artemis.UI/Artemis.UI.csproj
+++ b/src/Artemis.UI/Artemis.UI.csproj
@@ -145,7 +145,7 @@
-
+
diff --git a/src/Artemis.UI/Behaviors/TreeViewSelectionBehavior.cs b/src/Artemis.UI/Behaviors/TreeViewSelectionBehavior.cs
index b01c00e4b..fd3c1f42d 100644
--- a/src/Artemis.UI/Behaviors/TreeViewSelectionBehavior.cs
+++ b/src/Artemis.UI/Behaviors/TreeViewSelectionBehavior.cs
@@ -1,6 +1,7 @@
using System.Collections.Specialized;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Input;
using Microsoft.Xaml.Behaviors;
namespace Artemis.UI.Behaviors
@@ -105,7 +106,8 @@ namespace Artemis.UI.Behaviors
{
item.IsSelected = true;
// Focus the newly selected item as if was clicked
- item.Focus();
+ if (FocusManager.GetIsFocusScope(item))
+ item.Focus();
if (ExpandSelected)
item.IsExpanded = true;
}
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml
index 053ab91d9..aeabbaf8b 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertiesView.xaml
@@ -199,6 +199,12 @@
+
+
+
+
+
+
@@ -206,7 +212,11 @@
-
+