UI VM factories - Shortened names for readibility

Layer properties - Ensure only LayerBrushes can add properties and make sure that method instantiates a keyframe engine
Layer properties UI - Respond to properties being added/removed
This commit is contained in:
Robert committed 2020-02-12 21:18:00 +01:00
1 parent 4f66d09755
commit 51a21b7a8a
29 files changed
+417 -303

No files matched your search

@@ -1,12 +1,16 @@
using System;
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.Core.Services;
using Artemis.Core.Services.Interfaces;
using SkiaSharp;
namespace Artemis.Core.Plugins.LayerBrush
{
public abstract class LayerBrush : IDisposable
{
private ILayerService _layerService;
protected LayerBrush(Layer layer, LayerBrushDescriptor descriptor)
{
Layer = layer;
@@ -54,6 +58,8 @@ namespace Artemis.Core.Plugins.LayerBrush
{
var property = new LayerProperty<T>(Layer, Descriptor.LayerBrushProvider.PluginInfo, parent, id, name, description);
Layer.RegisterLayerProperty(property);
// It's fine if this is null, it'll be picked up by SetLayerService later
_layerService?.InstantiateKeyframeEngine(property);
return property;
}
@@ -68,9 +74,20 @@ namespace Artemis.Core.Plugins.LayerBrush
/// <returns>The layer property</returns>
protected LayerProperty<T> RegisterLayerProperty<T>(string id, string name, string description)
{
var property = new LayerProperty<T>(Layer, Descriptor.LayerBrushProvider.PluginInfo, Layer.BrushReferenceProperty.Parent, id, name, description);
var property = new LayerProperty<T>(
Layer, Descriptor.LayerBrushProvider.PluginInfo, Layer.BrushReferenceProperty.Parent, id, name, description
);
Layer.RegisterLayerProperty(property);
// It's fine if this is null, it'll be picked up by SetLayerService later
_layerService?.InstantiateKeyframeEngine(property);
return property;
}
internal void SetLayerService(ILayerService layerService)
{
_layerService = layerService;
foreach (var baseLayerProperty in Layer.Properties)
_layerService.InstantiateKeyframeEngine(baseLayerProperty);
}
}
}