Datamodels - A few small fixes to fix errors during startup

Layer properties - Reimplemented property tree
Stylet - Add support for binding views to generic VMs
This commit is contained in:
SpoinkyNL committed 2020-05-17 18:54:15 +02:00
1 parent e036cbbfe4
commit 7b238e241e
22 files changed
+207 -42

No files matched your search

+2 -2
View File
@@ -125,7 +125,7 @@ namespace Artemis.Core.Models.Profile
General.ApplyToEntity();
Transform.ApplyToEntity();
LayerBrush.BaseProperties.ApplyToEntity();
LayerBrush?.BaseProperties.ApplyToEntity();
// LEDs
LayerEntity.Leds.Clear();
@@ -212,7 +212,7 @@ namespace Artemis.Core.Models.Profile
{
General.Override(timeOverride);
Transform.Override(timeOverride);
LayerBrush.BaseProperties.Override(timeOverride);
LayerBrush?.BaseProperties.Override(timeOverride);
}
/// <inheritdoc />
@@ -13,6 +13,11 @@ namespace Artemis.Core.Models.Profile.LayerProperties
{
}
/// <summary>
/// The parent group of this layer property, set after construction
/// </summary>
public LayerPropertyGroup Parent { get; internal set; }
/// <summary>
/// Gets whether keyframes are supported on this property
/// </summary>
@@ -23,6 +23,11 @@ namespace Artemis.Core.Models.Profile
_layerPropertyGroups = new List<LayerPropertyGroup>();
}
/// <summary>
/// The parent group of this layer property group, set after construction
/// </summary>
public LayerPropertyGroup Parent { get; internal set; }
/// <summary>
/// Gets whether this property group's properties are all initialized
/// </summary>
@@ -67,10 +72,11 @@ namespace Artemis.Core.Models.Profile
var propertyDescription = Attribute.GetCustomAttribute(propertyInfo, typeof(PropertyDescriptionAttribute));
if (propertyDescription != null)
{
if (!typeof(LayerProperty<>).IsAssignableFrom(propertyInfo.PropertyType))
if (!typeof(BaseLayerProperty).IsAssignableFrom(propertyInfo.PropertyType))
throw new ArtemisPluginException("Layer property with PropertyDescription attribute must be of type LayerProperty");
var instance = (BaseLayerProperty) Activator.CreateInstance(propertyInfo.PropertyType);
var instance = (BaseLayerProperty) Activator.CreateInstance(propertyInfo.PropertyType, true);
instance.Parent = this;
InitializeProperty(layer, path, instance);
propertyInfo.SetValue(this, instance);
_layerProperties.Add(instance);
@@ -84,6 +90,7 @@ namespace Artemis.Core.Models.Profile
throw new ArtemisPluginException("Layer property with PropertyGroupDescription attribute must be of type LayerPropertyGroup");
var instance = (LayerPropertyGroup) Activator.CreateInstance(propertyInfo.PropertyType);
instance.Parent = this;
instance.InitializeProperties(layerService, layer, $"{path}{propertyInfo.Name}.");
propertyInfo.SetValue(this, instance);
_layerPropertyGroups.Add(instance);