mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
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:
1 parent
4f66d09755
commit
51a21b7a8a
29 files changed
+417
-303
No files matched your search
@@ -8,15 +8,16 @@ namespace Artemis.Core.Services.Interfaces
|
||||
public interface ILayerService : IArtemisService
|
||||
{
|
||||
/// <summary>
|
||||
/// Instantiates and adds the <see cref="LayerBrush" /> described by the provided
|
||||
/// <see cref="LayerBrushDescriptor" /> to the provided <see cref="Layer" />.
|
||||
/// Instantiates and adds the <see cref="LayerBrush" /> described by the provided <see cref="LayerBrushDescriptor" />
|
||||
/// to the <see cref="Layer" />.
|
||||
/// </summary>
|
||||
/// <param name="layer">The layer to add the new layer element to</param>
|
||||
/// <param name="layer">The layer to instantiate the brush for</param>
|
||||
/// <returns></returns>
|
||||
LayerBrush InstantiateLayerBrush(Layer layer);
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates and adds a compatible <see cref="KeyframeEngine" /> to the provided <see cref="LayerProperty{T}" />
|
||||
/// Instantiates and adds a compatible <see cref="KeyframeEngine" /> to the provided <see cref="LayerProperty{T}" />.
|
||||
/// If the property already has a compatible keyframe engine, nothing happens.
|
||||
/// </summary>
|
||||
/// <param name="layerProperty">The layer property to apply the keyframe engine to.</param>
|
||||
/// <returns>The resulting keyframe engine, if a compatible engine was found.</returns>
|
||||
@@ -24,6 +25,7 @@ namespace Artemis.Core.Services.Interfaces
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates and adds a compatible <see cref="KeyframeEngine" /> to the provided <see cref="BaseLayerProperty" />.
|
||||
/// If the property already has a compatible keyframe engine, nothing happens.
|
||||
/// </summary>
|
||||
/// <param name="layerProperty">The layer property to apply the keyframe engine to.</param>
|
||||
/// <returns>The resulting keyframe engine, if a compatible engine was found.</returns>
|
||||
|
||||
@@ -46,10 +46,13 @@ namespace Artemis.Core.Services
|
||||
new ConstructorArgument("layer", layer),
|
||||
new ConstructorArgument("descriptor", descriptor)
|
||||
};
|
||||
var layerElement = (LayerBrush) _kernel.Get(descriptor.LayerBrushType, arguments);
|
||||
layer.LayerBrush = layerElement;
|
||||
var layerBrush = (LayerBrush) _kernel.Get(descriptor.LayerBrushType, arguments);
|
||||
// Set the layer service after the brush was created to avoid constructor clutter, SetLayerService will play catch-up for us.
|
||||
// If layer brush implementations need the LayerService they can inject it themselves, but don't require it by default
|
||||
layerBrush.SetLayerService(this);
|
||||
layer.LayerBrush = layerBrush;
|
||||
|
||||
return layerElement;
|
||||
return layerBrush;
|
||||
}
|
||||
|
||||
public KeyframeEngine InstantiateKeyframeEngine<T>(LayerProperty<T> layerProperty)
|
||||
@@ -59,6 +62,9 @@ namespace Artemis.Core.Services
|
||||
|
||||
public KeyframeEngine InstantiateKeyframeEngine(BaseLayerProperty layerProperty)
|
||||
{
|
||||
if (layerProperty.KeyframeEngine != null && layerProperty.KeyframeEngine.CompatibleTypes.Contains(layerProperty.Type))
|
||||
return layerProperty.KeyframeEngine;
|
||||
|
||||
// This creates an instance of each keyframe engine, which is pretty cheap since all the expensive stuff is done during
|
||||
// Initialize() call but it's not ideal
|
||||
var keyframeEngines = _kernel.Get<List<KeyframeEngine>>();
|
||||
|
||||
Reference in new issue
Block a user