Data bindings - Added binding apply logic to the layer properties

Data bindings - Expanded to support inner layer properties
This commit is contained in:
Robert committed 2020-09-02 16:54:30 +02:00
1 parent 99522f052f
commit 1a8df1647b
12 files changed
+191 -29

No files matched your search

@@ -178,12 +178,6 @@ namespace Artemis.Core
return typeof(T);
}
/// <inheritdoc />
public override List<PropertyInfo> GetDataBindingProperties()
{
return new List<PropertyInfo> {GetType().GetProperty(nameof(CurrentValue))};
}
/// <summary>
/// Called every update (if keyframes are both supported and enabled) to determine the new <see cref="CurrentValue" />
/// based on the provided progress
@@ -234,6 +228,7 @@ namespace Artemis.Core
_keyframes = _keyframes.OrderBy(k => k.Position).ToList();
}
internal override void ApplyToLayerProperty(PropertyEntity entity, LayerPropertyGroup layerPropertyGroup, bool fromStorage)
{
// Doubt this will happen but let's make sure
@@ -289,5 +284,23 @@ namespace Artemis.Core
EasingFunction = (int) k.EasingFunction
}));
}
#region Data bindings
/// <inheritdoc />
public override List<PropertyInfo> GetDataBindingProperties()
{
return new List<PropertyInfo> {GetType().GetProperty(nameof(CurrentValue))};
}
/// <inheritdoc />
protected override void ApplyDataBinding(DataBinding dataBinding)
{
// The default implementation only supports simple types
if (dataBinding.TargetProperty.DeclaringType == GetType())
CurrentValue = (T) dataBinding.GetValue(CurrentValue);
}
#endregion
}
}