mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Layers - Seperated activation and removal of layers/effects
Effects - Added effects UI, order is still a bit messed up and reordering is missed Effects - Added renaming of effects on the layer
This commit is contained in:
parent
f917728ac8
commit
b2ab142dbd
@ -26,6 +26,10 @@
|
|||||||
<PackageReference Include="Ben.Demystifier" Version="0.1.6" />
|
<PackageReference Include="Ben.Demystifier" Version="0.1.6" />
|
||||||
<PackageReference Include="Castle.Core" Version="4.4.1" />
|
<PackageReference Include="Castle.Core" Version="4.4.1" />
|
||||||
<PackageReference Include="FastMember" Version="1.5.0" />
|
<PackageReference Include="FastMember" Version="1.5.0" />
|
||||||
|
<PackageReference Include="Fody" Version="6.2.0">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="HidSharp" Version="2.1.0" />
|
<PackageReference Include="HidSharp" Version="2.1.0" />
|
||||||
<PackageReference Include="LiteDB" Version="5.0.8" />
|
<PackageReference Include="LiteDB" Version="5.0.8" />
|
||||||
<PackageReference Include="McMaster.NETCore.Plugins" Version="1.3.0" />
|
<PackageReference Include="McMaster.NETCore.Plugins" Version="1.3.0" />
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Artemis.Core.Models.Profile.LayerShapes;
|
using Artemis.Core.Plugins.LayerEffect.Abstract;
|
||||||
using Artemis.Storage.Entities.Profile;
|
using Artemis.Storage.Entities.Profile;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
|
|
||||||
@ -8,6 +10,8 @@ namespace Artemis.Core.Models.Profile
|
|||||||
{
|
{
|
||||||
public sealed class Folder : ProfileElement
|
public sealed class Folder : ProfileElement
|
||||||
{
|
{
|
||||||
|
private readonly List<BaseLayerEffect> _layerEffects;
|
||||||
|
|
||||||
public Folder(Profile profile, ProfileElement parent, string name)
|
public Folder(Profile profile, ProfileElement parent, string name)
|
||||||
{
|
{
|
||||||
FolderEntity = new FolderEntity();
|
FolderEntity = new FolderEntity();
|
||||||
@ -16,6 +20,7 @@ namespace Artemis.Core.Models.Profile
|
|||||||
Profile = profile;
|
Profile = profile;
|
||||||
Parent = parent;
|
Parent = parent;
|
||||||
Name = name;
|
Name = name;
|
||||||
|
_layerEffects = new List<BaseLayerEffect>();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Folder(Profile profile, ProfileElement parent, FolderEntity folderEntity)
|
internal Folder(Profile profile, ProfileElement parent, FolderEntity folderEntity)
|
||||||
@ -27,6 +32,7 @@ namespace Artemis.Core.Models.Profile
|
|||||||
Parent = parent;
|
Parent = parent;
|
||||||
Name = folderEntity.Name;
|
Name = folderEntity.Name;
|
||||||
Order = folderEntity.Order;
|
Order = folderEntity.Order;
|
||||||
|
_layerEffects = new List<BaseLayerEffect>();
|
||||||
|
|
||||||
// TODO: Load conditions
|
// TODO: Load conditions
|
||||||
|
|
||||||
@ -45,6 +51,11 @@ namespace Artemis.Core.Models.Profile
|
|||||||
|
|
||||||
internal FolderEntity FolderEntity { get; set; }
|
internal FolderEntity FolderEntity { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a read-only collection of the layer effects on this layer
|
||||||
|
/// </summary>
|
||||||
|
public ReadOnlyCollection<BaseLayerEffect> LayerEffects => _layerEffects.AsReadOnly();
|
||||||
|
|
||||||
public override void Update(double deltaTime)
|
public override void Update(double deltaTime)
|
||||||
{
|
{
|
||||||
// Iterate the children in reverse because that's how they must be rendered too
|
// Iterate the children in reverse because that's how they must be rendered too
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Artemis.Core.Annotations;
|
||||||
using Artemis.Core.Extensions;
|
using Artemis.Core.Extensions;
|
||||||
using Artemis.Core.Models.Profile.LayerProperties;
|
using Artemis.Core.Models.Profile.LayerProperties;
|
||||||
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
||||||
@ -23,6 +24,7 @@ namespace Artemis.Core.Models.Profile
|
|||||||
public sealed class Layer : ProfileElement
|
public sealed class Layer : ProfileElement
|
||||||
{
|
{
|
||||||
private readonly List<string> _expandedPropertyGroups;
|
private readonly List<string> _expandedPropertyGroups;
|
||||||
|
private readonly List<BaseLayerEffect> _layerEffects;
|
||||||
private LayerShape _layerShape;
|
private LayerShape _layerShape;
|
||||||
private List<ArtemisLed> _leds;
|
private List<ArtemisLed> _leds;
|
||||||
private SKPath _path;
|
private SKPath _path;
|
||||||
@ -38,6 +40,7 @@ namespace Artemis.Core.Models.Profile
|
|||||||
General = new LayerGeneralProperties {IsCorePropertyGroup = true};
|
General = new LayerGeneralProperties {IsCorePropertyGroup = true};
|
||||||
Transform = new LayerTransformProperties {IsCorePropertyGroup = true};
|
Transform = new LayerTransformProperties {IsCorePropertyGroup = true};
|
||||||
|
|
||||||
|
_layerEffects = new List<BaseLayerEffect>();
|
||||||
_leds = new List<ArtemisLed>();
|
_leds = new List<ArtemisLed>();
|
||||||
_expandedPropertyGroups = new List<string>();
|
_expandedPropertyGroups = new List<string>();
|
||||||
|
|
||||||
@ -56,6 +59,7 @@ namespace Artemis.Core.Models.Profile
|
|||||||
General = new LayerGeneralProperties {IsCorePropertyGroup = true};
|
General = new LayerGeneralProperties {IsCorePropertyGroup = true};
|
||||||
Transform = new LayerTransformProperties {IsCorePropertyGroup = true};
|
Transform = new LayerTransformProperties {IsCorePropertyGroup = true};
|
||||||
|
|
||||||
|
_layerEffects = new List<BaseLayerEffect>();
|
||||||
_leds = new List<ArtemisLed>();
|
_leds = new List<ArtemisLed>();
|
||||||
_expandedPropertyGroups = new List<string>();
|
_expandedPropertyGroups = new List<string>();
|
||||||
_expandedPropertyGroups.AddRange(layerEntity.ExpandedPropertyGroups);
|
_expandedPropertyGroups.AddRange(layerEntity.ExpandedPropertyGroups);
|
||||||
@ -65,6 +69,11 @@ namespace Artemis.Core.Models.Profile
|
|||||||
|
|
||||||
internal LayerEntity LayerEntity { get; set; }
|
internal LayerEntity LayerEntity { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a read-only collection of the layer effects on this layer
|
||||||
|
/// </summary>
|
||||||
|
public ReadOnlyCollection<BaseLayerEffect> LayerEffects => _layerEffects.AsReadOnly();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A collection of all the LEDs this layer is assigned to.
|
/// A collection of all the LEDs this layer is assigned to.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -116,11 +125,6 @@ namespace Artemis.Core.Models.Profile
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public BaseLayerBrush LayerBrush { get; internal set; }
|
public BaseLayerBrush LayerBrush { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The layer effect that will apply pre- and/or post-processing to the layer
|
|
||||||
/// </summary>
|
|
||||||
public BaseLayerEffect LayerEffect { get; set; }
|
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return $"[Layer] {nameof(Name)}: {Name}, {nameof(Order)}: {Order}";
|
return $"[Layer] {nameof(Name)}: {Name}, {nameof(Order)}: {Order}";
|
||||||
@ -155,7 +159,22 @@ namespace Artemis.Core.Models.Profile
|
|||||||
General.ApplyToEntity();
|
General.ApplyToEntity();
|
||||||
Transform.ApplyToEntity();
|
Transform.ApplyToEntity();
|
||||||
LayerBrush?.BaseProperties.ApplyToEntity();
|
LayerBrush?.BaseProperties.ApplyToEntity();
|
||||||
LayerEffect?.BaseProperties.ApplyToEntity();
|
|
||||||
|
// Effects
|
||||||
|
LayerEntity.LayerEffects.Clear();
|
||||||
|
foreach (var layerEffect in LayerEffects)
|
||||||
|
{
|
||||||
|
var layerEffectEntity = new LayerEffectEntity()
|
||||||
|
{
|
||||||
|
PluginGuid = layerEffect.PluginInfo.Guid,
|
||||||
|
EffectType = layerEffect.GetType().Name,
|
||||||
|
Name = layerEffect.Name,
|
||||||
|
HasBeenRenamed = layerEffect.HasBeenRenamed,
|
||||||
|
Order = layerEffect.Order
|
||||||
|
};
|
||||||
|
LayerEntity.LayerEffects.Add(layerEffectEntity);
|
||||||
|
layerEffect.BaseProperties.ApplyToEntity();
|
||||||
|
}
|
||||||
|
|
||||||
// LEDs
|
// LEDs
|
||||||
LayerEntity.Leds.Clear();
|
LayerEntity.Leds.Clear();
|
||||||
@ -226,18 +245,21 @@ namespace Artemis.Core.Models.Profile
|
|||||||
General.Override(TimeSpan.Zero);
|
General.Override(TimeSpan.Zero);
|
||||||
Transform.Override(TimeSpan.Zero);
|
Transform.Override(TimeSpan.Zero);
|
||||||
LayerBrush.BaseProperties.Override(TimeSpan.Zero);
|
LayerBrush.BaseProperties.Override(TimeSpan.Zero);
|
||||||
LayerEffect?.BaseProperties?.Override(TimeSpan.Zero);
|
foreach (var baseLayerEffect in LayerEffects)
|
||||||
|
baseLayerEffect.BaseProperties?.Override(TimeSpan.Zero);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
General.Update(deltaTime);
|
General.Update(deltaTime);
|
||||||
Transform.Update(deltaTime);
|
Transform.Update(deltaTime);
|
||||||
LayerBrush.BaseProperties.Update(deltaTime);
|
LayerBrush.BaseProperties.Update(deltaTime);
|
||||||
LayerEffect?.BaseProperties?.Update(deltaTime);
|
foreach (var baseLayerEffect in LayerEffects)
|
||||||
|
baseLayerEffect.BaseProperties?.Update(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerBrush.Update(deltaTime);
|
LayerBrush.Update(deltaTime);
|
||||||
LayerEffect?.Update(deltaTime);
|
foreach (var baseLayerEffect in LayerEffects)
|
||||||
|
baseLayerEffect.Update(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OverrideProgress(TimeSpan timeOverride)
|
public void OverrideProgress(TimeSpan timeOverride)
|
||||||
@ -245,7 +267,8 @@ namespace Artemis.Core.Models.Profile
|
|||||||
General.Override(timeOverride);
|
General.Override(timeOverride);
|
||||||
Transform.Override(timeOverride);
|
Transform.Override(timeOverride);
|
||||||
LayerBrush?.BaseProperties?.Override(timeOverride);
|
LayerBrush?.BaseProperties?.Override(timeOverride);
|
||||||
LayerEffect?.BaseProperties?.Override(timeOverride);
|
foreach (var baseLayerEffect in LayerEffects)
|
||||||
|
baseLayerEffect.BaseProperties?.Override(timeOverride);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -266,7 +289,8 @@ namespace Artemis.Core.Models.Profile
|
|||||||
paint.BlendMode = General.BlendMode.CurrentValue;
|
paint.BlendMode = General.BlendMode.CurrentValue;
|
||||||
paint.Color = new SKColor(0, 0, 0, (byte) (Transform.Opacity.CurrentValue * 2.55f));
|
paint.Color = new SKColor(0, 0, 0, (byte) (Transform.Opacity.CurrentValue * 2.55f));
|
||||||
|
|
||||||
LayerEffect?.PreProcess(canvas, canvasInfo, Path, paint);
|
foreach (var baseLayerEffect in LayerEffects)
|
||||||
|
baseLayerEffect.PreProcess(canvas, canvasInfo, Path, paint);
|
||||||
|
|
||||||
if (!LayerBrush.SupportsTransformation)
|
if (!LayerBrush.SupportsTransformation)
|
||||||
SimpleRender(canvas, canvasInfo, paint);
|
SimpleRender(canvas, canvasInfo, paint);
|
||||||
@ -275,7 +299,8 @@ namespace Artemis.Core.Models.Profile
|
|||||||
else if (General.FillType.CurrentValue == LayerFillType.Clip)
|
else if (General.FillType.CurrentValue == LayerFillType.Clip)
|
||||||
ClipRender(canvas, canvasInfo, paint);
|
ClipRender(canvas, canvasInfo, paint);
|
||||||
|
|
||||||
LayerEffect?.PostProcess(canvas, canvasInfo, Path, paint);
|
foreach (var baseLayerEffect in LayerEffects)
|
||||||
|
baseLayerEffect.PostProcess(canvas, canvasInfo, Path, paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.Restore();
|
canvas.Restore();
|
||||||
@ -382,6 +407,10 @@ namespace Artemis.Core.Models.Profile
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Effect management
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region LED management
|
#region LED management
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -423,36 +452,6 @@ namespace Artemis.Core.Models.Profile
|
|||||||
CalculateRenderProperties();
|
CalculateRenderProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Deactivate()
|
|
||||||
{
|
|
||||||
DeactivateLayerBrush();
|
|
||||||
DeactivateLayerEffect();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void DeactivateLayerBrush()
|
|
||||||
{
|
|
||||||
if (LayerBrush == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var brush = LayerBrush;
|
|
||||||
LayerBrush = null;
|
|
||||||
brush.Dispose();
|
|
||||||
|
|
||||||
LayerEntity.PropertyEntities.RemoveAll(p => p.PluginGuid == brush.PluginInfo.Guid && p.Path.StartsWith("LayerBrush."));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void DeactivateLayerEffect()
|
|
||||||
{
|
|
||||||
if (LayerEffect == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var effect = LayerEffect;
|
|
||||||
LayerEffect = null;
|
|
||||||
effect.Dispose();
|
|
||||||
|
|
||||||
LayerEntity.PropertyEntities.RemoveAll(p => p.PluginGuid == effect.PluginInfo.Guid && p.Path.StartsWith("LayerEffect."));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void PopulateLeds(ArtemisSurface surface)
|
internal void PopulateLeds(ArtemisSurface surface)
|
||||||
{
|
{
|
||||||
var leds = new List<ArtemisLed>();
|
var leds = new List<ArtemisLed>();
|
||||||
@ -473,12 +472,80 @@ namespace Artemis.Core.Models.Profile
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Activation
|
||||||
|
|
||||||
|
internal void Deactivate()
|
||||||
|
{
|
||||||
|
DeactivateLayerBrush();
|
||||||
|
var layerEffects = new List<BaseLayerEffect>(LayerEffects);
|
||||||
|
foreach (var baseLayerEffect in layerEffects)
|
||||||
|
DeactivateLayerEffect(baseLayerEffect);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeactivateLayerBrush()
|
||||||
|
{
|
||||||
|
if (LayerBrush == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var brush = LayerBrush;
|
||||||
|
LayerBrush = null;
|
||||||
|
brush.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeactivateLayerEffect([NotNull] BaseLayerEffect effect)
|
||||||
|
{
|
||||||
|
if (effect == null) throw new ArgumentNullException(nameof(effect));
|
||||||
|
|
||||||
|
// Remove the effect from the layer and dispose it
|
||||||
|
_layerEffects.Remove(effect);
|
||||||
|
effect.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void RemoveLayerBrush()
|
||||||
|
{
|
||||||
|
if (LayerBrush == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var brush = LayerBrush;
|
||||||
|
DeactivateLayerBrush();
|
||||||
|
LayerEntity.PropertyEntities.RemoveAll(p => p.PluginGuid == brush.PluginInfo.Guid && p.Path.StartsWith("LayerBrush."));
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void RemoveLayerEffect([NotNull] BaseLayerEffect effect)
|
||||||
|
{
|
||||||
|
if (effect == null) throw new ArgumentNullException(nameof(effect));
|
||||||
|
|
||||||
|
DeactivateLayerEffect(effect);
|
||||||
|
|
||||||
|
// Clean up properties
|
||||||
|
LayerEntity.PropertyEntities.RemoveAll(p => p.PluginGuid == effect.PluginInfo.Guid && p.Path.StartsWith(effect.PropertyRootPath));
|
||||||
|
|
||||||
|
// Update the order on the remaining effects
|
||||||
|
var index = 0;
|
||||||
|
foreach (var baseLayerEffect in LayerEffects.OrderBy(e => e.Order))
|
||||||
|
{
|
||||||
|
baseLayerEffect.UpdateOrder(index + 1);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
OnLayerEffectsUpdated();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void AddLayerEffect([NotNull] BaseLayerEffect effect)
|
||||||
|
{
|
||||||
|
if (effect == null) throw new ArgumentNullException(nameof(effect));
|
||||||
|
_layerEffects.Add(effect);
|
||||||
|
OnLayerEffectsUpdated();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Events
|
#region Events
|
||||||
|
|
||||||
public event EventHandler RenderPropertiesUpdated;
|
public event EventHandler RenderPropertiesUpdated;
|
||||||
public event EventHandler ShapePropertiesUpdated;
|
public event EventHandler ShapePropertiesUpdated;
|
||||||
public event EventHandler LayerBrushUpdated;
|
public event EventHandler LayerBrushUpdated;
|
||||||
public event EventHandler LayerEffectUpdated;
|
public event EventHandler LayerEffectsUpdated;
|
||||||
|
|
||||||
private void OnRenderPropertiesUpdated()
|
private void OnRenderPropertiesUpdated()
|
||||||
{
|
{
|
||||||
@ -495,9 +562,9 @@ namespace Artemis.Core.Models.Profile
|
|||||||
LayerBrushUpdated?.Invoke(this, EventArgs.Empty);
|
LayerBrushUpdated?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OnLayerEffectUpdated()
|
internal void OnLayerEffectsUpdated()
|
||||||
{
|
{
|
||||||
LayerEffectUpdated?.Invoke(this, EventArgs.Empty);
|
LayerEffectsUpdated?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -1,21 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Artemis.Core.Plugins.LayerEffect;
|
|
||||||
|
|
||||||
namespace Artemis.Core.Models.Profile
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A reference to a <see cref="LayerEffectDescriptor" />
|
|
||||||
/// </summary>
|
|
||||||
public class LayerEffectReference
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The GUID of the plugin the effect descriptor resides in
|
|
||||||
/// </summary>
|
|
||||||
public Guid EffectPluginGuid { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The full type name of the effect descriptor
|
|
||||||
/// </summary>
|
|
||||||
public string EffectType { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -17,10 +17,7 @@ namespace Artemis.Core.Models.Profile
|
|||||||
|
|
||||||
[PropertyDescription(Name = "Brush type", Description = "The type of brush to use for this layer")]
|
[PropertyDescription(Name = "Brush type", Description = "The type of brush to use for this layer")]
|
||||||
public LayerBrushReferenceLayerProperty BrushReference { get; set; }
|
public LayerBrushReferenceLayerProperty BrushReference { get; set; }
|
||||||
|
|
||||||
[PropertyDescription(Name = "Effect type", Description = "The type of effect to use for this layer")]
|
|
||||||
public LayerEffectReferenceLayerProperty EffectReference { get; set; }
|
|
||||||
|
|
||||||
protected override void PopulateDefaults()
|
protected override void PopulateDefaults()
|
||||||
{
|
{
|
||||||
ShapeType.DefaultValue = LayerShapeType.Rectangle;
|
ShapeType.DefaultValue = LayerShapeType.Rectangle;
|
||||||
|
|||||||
@ -1,22 +0,0 @@
|
|||||||
using Artemis.Core.Exceptions;
|
|
||||||
|
|
||||||
namespace Artemis.Core.Models.Profile.LayerProperties.Types
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A special layer property used to configure the selected layer effect
|
|
||||||
/// </summary>
|
|
||||||
public class LayerEffectReferenceLayerProperty : LayerProperty<LayerEffectReference>
|
|
||||||
{
|
|
||||||
internal LayerEffectReferenceLayerProperty()
|
|
||||||
{
|
|
||||||
KeyframesSupported = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
|
|
||||||
{
|
|
||||||
throw new ArtemisCoreException("Layer effect references do not support keyframes.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator LayerEffectReference(LayerEffectReferenceLayerProperty p) => p.CurrentValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -233,7 +233,14 @@ namespace Artemis.Core.Models.Profile
|
|||||||
|
|
||||||
private void InitializeProperty(Layer layer, string path, BaseLayerProperty instance)
|
private void InitializeProperty(Layer layer, string path, BaseLayerProperty instance)
|
||||||
{
|
{
|
||||||
var pluginGuid = IsCorePropertyGroup || instance.IsCoreProperty ? Constants.CorePluginInfo.Guid : layer.LayerBrush.PluginInfo.Guid;
|
Guid pluginGuid;
|
||||||
|
if (IsCorePropertyGroup || instance.IsCoreProperty)
|
||||||
|
pluginGuid = Constants.CorePluginInfo.Guid;
|
||||||
|
else if (instance.Parent.LayerBrush != null)
|
||||||
|
pluginGuid = instance.Parent.LayerBrush.PluginInfo.Guid;
|
||||||
|
else
|
||||||
|
pluginGuid = instance.Parent.LayerEffect.PluginInfo.Guid;
|
||||||
|
|
||||||
var entity = layer.LayerEntity.PropertyEntities.FirstOrDefault(p => p.PluginGuid == pluginGuid && p.Path == path);
|
var entity = layer.LayerEntity.PropertyEntities.FirstOrDefault(p => p.PluginGuid == pluginGuid && p.Path == path);
|
||||||
var fromStorage = true;
|
var fromStorage = true;
|
||||||
if (entity == null)
|
if (entity == null)
|
||||||
@ -273,5 +280,20 @@ namespace Artemis.Core.Models.Profile
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public void UpdateOrder(int oldOrder)
|
||||||
|
{
|
||||||
|
// Expanded state is tied to the path so save it before changing the path
|
||||||
|
var expanded = Layer.IsPropertyGroupExpanded(this);
|
||||||
|
Layer.SetPropertyGroupExpanded(this, false);
|
||||||
|
|
||||||
|
Path = Path.Replace($"LayerEffect.{oldOrder}.", $"LayerEffect.{LayerEffect.Order}.");
|
||||||
|
// Restore the expanded state with the new path
|
||||||
|
Layer.SetPropertyGroupExpanded(this, expanded);
|
||||||
|
|
||||||
|
// Update children
|
||||||
|
foreach (var layerPropertyGroup in LayerPropertyGroups)
|
||||||
|
layerPropertyGroup.UpdateOrder(oldOrder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using Artemis.Core.Plugins.Exceptions;
|
using Artemis.Core.Plugins.Exceptions;
|
||||||
using Artemis.Core.Plugins.LayerBrush;
|
using Artemis.Core.Plugins.LayerBrush;
|
||||||
@ -17,6 +18,7 @@ namespace Artemis.Core.Plugins.Abstract
|
|||||||
protected LayerBrushProvider()
|
protected LayerBrushProvider()
|
||||||
{
|
{
|
||||||
_layerBrushDescriptors = new List<LayerBrushDescriptor>();
|
_layerBrushDescriptors = new List<LayerBrushDescriptor>();
|
||||||
|
PluginDisabled += OnPluginDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -42,5 +44,10 @@ namespace Artemis.Core.Plugins.Abstract
|
|||||||
|
|
||||||
_layerBrushDescriptors.Add(new LayerBrushDescriptor(displayName, description, icon, typeof(T), this));
|
_layerBrushDescriptors.Add(new LayerBrushDescriptor(displayName, description, icon, typeof(T), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPluginDisabled(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_layerBrushDescriptors.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using Artemis.Core.Plugins.Exceptions;
|
using Artemis.Core.Plugins.Exceptions;
|
||||||
using Artemis.Core.Plugins.LayerEffect;
|
using Artemis.Core.Plugins.LayerEffect;
|
||||||
@ -17,6 +18,7 @@ namespace Artemis.Core.Plugins.Abstract
|
|||||||
protected LayerEffectProvider()
|
protected LayerEffectProvider()
|
||||||
{
|
{
|
||||||
_layerEffectDescriptors = new List<LayerEffectDescriptor>();
|
_layerEffectDescriptors = new List<LayerEffectDescriptor>();
|
||||||
|
PluginDisabled += OnPluginDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -42,5 +44,10 @@ namespace Artemis.Core.Plugins.Abstract
|
|||||||
|
|
||||||
_layerEffectDescriptors.Add(new LayerEffectDescriptor(displayName, description, icon, typeof(T), this));
|
_layerEffectDescriptors.Add(new LayerEffectDescriptor(displayName, description, icon, typeof(T), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPluginDisabled(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_layerEffectDescriptors.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4,13 +4,14 @@ using Artemis.Core.Plugins.Exceptions;
|
|||||||
using Artemis.Core.Plugins.Models;
|
using Artemis.Core.Plugins.Models;
|
||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Services.Interfaces;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
|
using Stylet;
|
||||||
|
|
||||||
namespace Artemis.Core.Plugins.LayerBrush.Abstract
|
namespace Artemis.Core.Plugins.LayerBrush.Abstract
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For internal use only, please use <see cref="LayerBrush{T}" /> or <see cref="RgbNetLayerBrush{T}" /> or instead
|
/// For internal use only, please use <see cref="LayerBrush{T}" /> or <see cref="RgbNetLayerBrush{T}" /> or instead
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class BaseLayerBrush : IDisposable
|
public abstract class BaseLayerBrush : PropertyChangedBase, IDisposable
|
||||||
{
|
{
|
||||||
private bool _supportsTransformation = true;
|
private bool _supportsTransformation = true;
|
||||||
|
|
||||||
@ -48,7 +49,7 @@ namespace Artemis.Core.Plugins.LayerBrush.Abstract
|
|||||||
get => _supportsTransformation;
|
get => _supportsTransformation;
|
||||||
protected set
|
protected set
|
||||||
{
|
{
|
||||||
if (BrushType == LayerBrushType.RgbNet)
|
if (value && BrushType == LayerBrushType.RgbNet)
|
||||||
throw new ArtemisPluginException(PluginInfo, "An RGB.NET brush cannot support transformation");
|
throw new ArtemisPluginException(PluginInfo, "An RGB.NET brush cannot support transformation");
|
||||||
_supportsTransformation = value;
|
_supportsTransformation = value;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,13 +3,14 @@ using Artemis.Core.Models.Profile;
|
|||||||
using Artemis.Core.Plugins.Models;
|
using Artemis.Core.Plugins.Models;
|
||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Services.Interfaces;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
|
using Stylet;
|
||||||
|
|
||||||
namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For internal use only, please use <see cref="LayerEffect" /> instead
|
/// For internal use only, please use <see cref="LayerEffect" /> instead
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class BaseLayerEffect : IDisposable
|
public abstract class BaseLayerEffect : PropertyChangedBase, IDisposable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the layer this effect is applied to
|
/// Gets the layer this effect is applied to
|
||||||
@ -21,6 +22,22 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Folder Folder { get; internal set; }
|
public Folder Folder { get; internal set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name which appears in the editor
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets whether the effect has been renamed by the user, if true consider refraining from changing the name
|
||||||
|
/// programatically
|
||||||
|
/// </summary>
|
||||||
|
public bool HasBeenRenamed { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the order in which this effect appears in the update loop and editor
|
||||||
|
/// </summary>
|
||||||
|
public int Order { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the descriptor of this effect
|
/// Gets the descriptor of this effect
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -36,6 +53,8 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual LayerPropertyGroup BaseProperties => null;
|
public virtual LayerPropertyGroup BaseProperties => null;
|
||||||
|
|
||||||
|
internal string PropertyRootPath => $"LayerEffect.{Order}.{GetType().Name}.";
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
DisableLayerEffect();
|
DisableLayerEffect();
|
||||||
@ -67,6 +86,16 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint);
|
public abstract void PostProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint);
|
||||||
|
|
||||||
|
public void UpdateOrder(int newOrder)
|
||||||
|
{
|
||||||
|
if (newOrder == Order)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var oldOrder = Order;
|
||||||
|
Order = newOrder;
|
||||||
|
BaseProperties.UpdateOrder(oldOrder);
|
||||||
|
}
|
||||||
|
|
||||||
internal void InternalPreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
internal void InternalPreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||||
{
|
{
|
||||||
// Move the canvas to the top-left of the render path
|
// Move the canvas to the top-left of the render path
|
||||||
|
|||||||
@ -39,7 +39,7 @@ namespace Artemis.Core.Plugins.LayerEffect.Abstract
|
|||||||
{
|
{
|
||||||
Properties = Activator.CreateInstance<T>();
|
Properties = Activator.CreateInstance<T>();
|
||||||
Properties.LayerEffect = this;
|
Properties.LayerEffect = this;
|
||||||
Properties.InitializeProperties(layerService, Layer, "LayerEffect.");
|
Properties.InitializeProperties(layerService, Layer, PropertyRootPath);
|
||||||
PropertiesInitialized = true;
|
PropertiesInitialized = true;
|
||||||
|
|
||||||
EnableLayerEffect();
|
EnableLayerEffect();
|
||||||
|
|||||||
@ -3,13 +3,14 @@ using Artemis.Core.Plugins.LayerBrush;
|
|||||||
using Artemis.Core.Plugins.LayerBrush.Abstract;
|
using Artemis.Core.Plugins.LayerBrush.Abstract;
|
||||||
using Artemis.Core.Plugins.LayerEffect;
|
using Artemis.Core.Plugins.LayerEffect;
|
||||||
using Artemis.Core.Plugins.LayerEffect.Abstract;
|
using Artemis.Core.Plugins.LayerEffect.Abstract;
|
||||||
|
using Artemis.Storage.Entities.Profile;
|
||||||
|
|
||||||
namespace Artemis.Core.Services.Interfaces
|
namespace Artemis.Core.Services.Interfaces
|
||||||
{
|
{
|
||||||
public interface ILayerService : IArtemisService
|
public interface ILayerService : IArtemisService
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new layer
|
/// Creates a new layer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="profile"></param>
|
/// <param name="profile"></param>
|
||||||
/// <param name="parent"></param>
|
/// <param name="parent"></param>
|
||||||
@ -28,11 +29,20 @@ namespace Artemis.Core.Services.Interfaces
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Instantiates and adds the <see cref="BaseLayerEffect" /> described by the provided
|
/// Instantiates and adds the <see cref="BaseLayerEffect" /> described by the provided
|
||||||
/// <see cref="LayerEffectDescriptor" />
|
/// <see cref="LayerEffectDescriptor" /> to the <see cref="Layer" />.
|
||||||
/// to the <see cref="Layer" />.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="layer">The layer to instantiate the effect for</param>
|
/// <param name="layer">The layer to instantiate the effect for</param>
|
||||||
|
void InstantiateLayerEffects(Layer layer);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds the <see cref="BaseLayerEffect" /> described by the provided <see cref="LayerEffectDescriptor" /> to the
|
||||||
|
/// <see cref="Layer" />.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="layer">The layer to instantiate the effect for</param>
|
||||||
|
/// <param name="layerEffectDescriptor"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
BaseLayerEffect InstantiateLayerEffect(Layer layer);
|
BaseLayerEffect AddLayerEffect(Layer layer, LayerEffectDescriptor layerEffectDescriptor);
|
||||||
|
|
||||||
|
void RemoveLayerEffect(BaseLayerEffect layerEffect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,13 +1,17 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Windows.Documents;
|
||||||
using Artemis.Core.Exceptions;
|
using Artemis.Core.Exceptions;
|
||||||
using Artemis.Core.Models.Profile;
|
using Artemis.Core.Models.Profile;
|
||||||
using Artemis.Core.Plugins.Abstract;
|
using Artemis.Core.Plugins.Abstract;
|
||||||
using Artemis.Core.Plugins.LayerBrush;
|
using Artemis.Core.Plugins.LayerBrush;
|
||||||
using Artemis.Core.Plugins.LayerBrush.Abstract;
|
using Artemis.Core.Plugins.LayerBrush.Abstract;
|
||||||
|
using Artemis.Core.Plugins.LayerEffect;
|
||||||
using Artemis.Core.Plugins.LayerEffect.Abstract;
|
using Artemis.Core.Plugins.LayerEffect.Abstract;
|
||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Services.Interfaces;
|
||||||
|
using Artemis.Storage.Entities.Profile;
|
||||||
using Ninject;
|
using Ninject;
|
||||||
|
using Ninject.Injection;
|
||||||
using Ninject.Parameters;
|
using Ninject.Parameters;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
|
||||||
@ -37,14 +41,15 @@ namespace Artemis.Core.Services
|
|||||||
|
|
||||||
// With the properties loaded, the layer brush and effect can be instantiated
|
// With the properties loaded, the layer brush and effect can be instantiated
|
||||||
InstantiateLayerBrush(layer);
|
InstantiateLayerBrush(layer);
|
||||||
InstantiateLayerEffect(layer);
|
InstantiateLayerEffects(layer);
|
||||||
|
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseLayerBrush InstantiateLayerBrush(Layer layer)
|
public BaseLayerBrush InstantiateLayerBrush(Layer layer)
|
||||||
{
|
{
|
||||||
layer.DeactivateLayerBrush();
|
if (layer.LayerBrush != null)
|
||||||
|
throw new ArtemisCoreException("Layer already has an instantiated layer brush");
|
||||||
|
|
||||||
var descriptorReference = layer.General.BrushReference?.CurrentValue;
|
var descriptorReference = layer.General.BrushReference?.CurrentValue;
|
||||||
if (descriptorReference == null)
|
if (descriptorReference == null)
|
||||||
@ -58,46 +63,72 @@ namespace Artemis.Core.Services
|
|||||||
|
|
||||||
if (descriptor == null)
|
if (descriptor == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var brush = (BaseLayerBrush) _kernel.Get(descriptor.LayerBrushType);
|
var brush = (BaseLayerBrush) _kernel.Get(descriptor.LayerBrushType);
|
||||||
brush.Layer = layer;
|
brush.Layer = layer;
|
||||||
brush.Descriptor = descriptor;
|
brush.Descriptor = descriptor;
|
||||||
layer.LayerBrush = brush;
|
|
||||||
|
|
||||||
brush.Initialize(this);
|
brush.Initialize(this);
|
||||||
brush.Update(0);
|
brush.Update(0);
|
||||||
|
|
||||||
|
layer.LayerBrush = brush;
|
||||||
layer.OnLayerBrushUpdated();
|
layer.OnLayerBrushUpdated();
|
||||||
|
|
||||||
return brush;
|
return brush;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseLayerEffect InstantiateLayerEffect(Layer layer)
|
public void InstantiateLayerEffects(Layer layer)
|
||||||
{
|
{
|
||||||
layer.DeactivateLayerEffect();
|
if (layer.LayerEffects.Any())
|
||||||
|
throw new ArtemisCoreException("Layer already has instantiated layer effects");
|
||||||
|
|
||||||
var descriptorReference = layer.General.EffectReference?.CurrentValue;
|
foreach (var layerEntityLayerEffect in layer.LayerEntity.LayerEffects.OrderByDescending(e => e.Order))
|
||||||
if (descriptorReference == null)
|
{
|
||||||
return null;
|
// Get a matching descriptor
|
||||||
|
var layerEffectProviders = _pluginService.GetPluginsOfType<LayerEffectProvider>();
|
||||||
|
var descriptors = layerEffectProviders.SelectMany(l => l.LayerEffectDescriptors).ToList();
|
||||||
|
var descriptor = descriptors.FirstOrDefault(d => d.LayerEffectProvider.PluginInfo.Guid == layerEntityLayerEffect.PluginGuid &&
|
||||||
|
d.LayerEffectType.Name == layerEntityLayerEffect.EffectType);
|
||||||
|
|
||||||
// Get a matching descriptor
|
if (descriptor == null)
|
||||||
var layerEffectProviders = _pluginService.GetPluginsOfType<LayerEffectProvider>();
|
continue;
|
||||||
var descriptors = layerEffectProviders.SelectMany(l => l.LayerEffectDescriptors).ToList();
|
|
||||||
var descriptor = descriptors.FirstOrDefault(d => d.LayerEffectProvider.PluginInfo.Guid == descriptorReference.EffectPluginGuid &&
|
|
||||||
d.LayerEffectType.Name == descriptorReference.EffectType);
|
|
||||||
|
|
||||||
if (descriptor == null)
|
var effect = (BaseLayerEffect) _kernel.Get(descriptor.LayerEffectType);
|
||||||
return null;
|
effect.Layer = layer;
|
||||||
|
effect.Order = layerEntityLayerEffect.Order;
|
||||||
|
effect.Name = layerEntityLayerEffect.Name;
|
||||||
|
effect.Descriptor = descriptor;
|
||||||
|
effect.Initialize(this);
|
||||||
|
effect.Update(0);
|
||||||
|
|
||||||
var effect = (BaseLayerEffect)_kernel.Get(descriptor.LayerEffectType);
|
layer.AddLayerEffect(effect);
|
||||||
|
_logger.Debug("Added layer effect with root path {rootPath}", effect.PropertyRootPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
layer.OnLayerEffectsUpdated();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseLayerEffect AddLayerEffect(Layer layer, LayerEffectDescriptor layerEffectDescriptor)
|
||||||
|
{
|
||||||
|
var effect = (BaseLayerEffect) _kernel.Get(layerEffectDescriptor.LayerEffectType);
|
||||||
effect.Layer = layer;
|
effect.Layer = layer;
|
||||||
effect.Descriptor = descriptor;
|
effect.Order = layer.LayerEffects.Count + 1;
|
||||||
layer.LayerEffect = effect;
|
effect.Descriptor = layerEffectDescriptor;
|
||||||
|
|
||||||
effect.Initialize(this);
|
effect.Initialize(this);
|
||||||
effect.Update(0);
|
effect.Update(0);
|
||||||
layer.OnLayerEffectUpdated();
|
|
||||||
|
|
||||||
|
layer.AddLayerEffect(effect);
|
||||||
|
_logger.Debug("Added layer effect with root path {rootPath}", effect.PropertyRootPath);
|
||||||
|
|
||||||
|
layer.OnLayerEffectsUpdated();
|
||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RemoveLayerEffect(BaseLayerEffect layerEffect)
|
||||||
|
{
|
||||||
|
// // Make sure the group is collapsed or the effect that gets this effect's order gets expanded
|
||||||
|
// layerEffect.Layer.SetPropertyGroupExpanded(layerEffect.BaseProperties, false);
|
||||||
|
layerEffect.Layer.RemoveLayerEffect(layerEffect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,10 +179,8 @@ namespace Artemis.Core.Services.Storage
|
|||||||
// Only instantiate brushes for layers without an existing brush/effect instance
|
// Only instantiate brushes for layers without an existing brush/effect instance
|
||||||
foreach (var layer in profile.GetAllLayers())
|
foreach (var layer in profile.GetAllLayers())
|
||||||
{
|
{
|
||||||
if (layer.LayerBrush == null)
|
_layerService.InstantiateLayerBrush(layer);
|
||||||
_layerService.InstantiateLayerBrush(layer);
|
_layerService.InstantiateLayerEffects(layer);
|
||||||
if (layer.LayerEffect == null)
|
|
||||||
_layerService.InstantiateLayerEffect(layer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
13
src/Artemis.Storage/Entities/Profile/LayerEffectEntity.cs
Normal file
13
src/Artemis.Storage/Entities/Profile/LayerEffectEntity.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Artemis.Storage.Entities.Profile
|
||||||
|
{
|
||||||
|
public class LayerEffectEntity
|
||||||
|
{
|
||||||
|
public Guid PluginGuid { get; set; }
|
||||||
|
public string EffectType { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public bool HasBeenRenamed { get; set; }
|
||||||
|
public int Order { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -12,6 +12,7 @@ namespace Artemis.Storage.Entities.Profile
|
|||||||
Leds = new List<LedEntity>();
|
Leds = new List<LedEntity>();
|
||||||
PropertyEntities = new List<PropertyEntity>();
|
PropertyEntities = new List<PropertyEntity>();
|
||||||
Condition = new List<ProfileConditionEntity>();
|
Condition = new List<ProfileConditionEntity>();
|
||||||
|
LayerEffects = new List<LayerEffectEntity>();
|
||||||
ExpandedPropertyGroups = new List<string>();
|
ExpandedPropertyGroups = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,6 +25,7 @@ namespace Artemis.Storage.Entities.Profile
|
|||||||
public List<LedEntity> Leds { get; set; }
|
public List<LedEntity> Leds { get; set; }
|
||||||
public List<PropertyEntity> PropertyEntities { get; set; }
|
public List<PropertyEntity> PropertyEntities { get; set; }
|
||||||
public List<ProfileConditionEntity> Condition { get; set; }
|
public List<ProfileConditionEntity> Condition { get; set; }
|
||||||
|
public List<LayerEffectEntity> LayerEffects { get; set; }
|
||||||
public List<string> ExpandedPropertyGroups { get; set; }
|
public List<string> ExpandedPropertyGroups { get; set; }
|
||||||
|
|
||||||
[BsonRef("ProfileEntity")]
|
[BsonRef("ProfileEntity")]
|
||||||
@ -31,4 +33,6 @@ namespace Artemis.Storage.Entities.Profile
|
|||||||
|
|
||||||
public Guid ProfileId { get; set; }
|
public Guid ProfileId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -20,6 +20,10 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AvalonEdit" Version="6.0.1" />
|
<PackageReference Include="AvalonEdit" Version="6.0.1" />
|
||||||
|
<PackageReference Include="Fody" Version="6.2.0">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Humanizer.Core" Version="2.8.11" />
|
<PackageReference Include="Humanizer.Core" Version="2.8.11" />
|
||||||
<PackageReference Include="MaterialDesignExtensions" Version="3.1.0" />
|
<PackageReference Include="MaterialDesignExtensions" Version="3.1.0" />
|
||||||
<PackageReference Include="MaterialDesignThemes" Version="3.1.3" />
|
<PackageReference Include="MaterialDesignThemes" Version="3.1.3" />
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
<Product>Artemis</Product>
|
<Product>Artemis</Product>
|
||||||
<NeutralLanguage>en-US</NeutralLanguage>
|
<NeutralLanguage>en-US</NeutralLanguage>
|
||||||
<Description>Adds third-party support for RGB keyboards to games.</Description>
|
<Description>Adds third-party support for RGB keyboards to games.</Description>
|
||||||
<Copyright>Copyright © Robert Beekman - 2019</Copyright>
|
<Copyright>Copyright © Robert Beekman - 2020</Copyright>
|
||||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||||
<FileVersion>2.0.0.0</FileVersion>
|
<FileVersion>2.0.0.0</FileVersion>
|
||||||
<Prefer32Bit>true</Prefer32Bit>
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
@ -117,6 +117,10 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Castle.Core" Version="4.4.1" />
|
<PackageReference Include="Castle.Core" Version="4.4.1" />
|
||||||
<PackageReference Include="FluentValidation" Version="8.6.2" />
|
<PackageReference Include="FluentValidation" Version="8.6.2" />
|
||||||
|
<PackageReference Include="Fody" Version="6.2.0">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="gong-wpf-dragdrop" Version="2.2.0" />
|
<PackageReference Include="gong-wpf-dragdrop" Version="2.2.0" />
|
||||||
<PackageReference Include="Hardcodet.NotifyIcon.Wpf.NetCore" Version="1.0.10" />
|
<PackageReference Include="Hardcodet.NotifyIcon.Wpf.NetCore" Version="1.0.10" />
|
||||||
<PackageReference Include="Humanizer.Core" Version="2.8.11" />
|
<PackageReference Include="Humanizer.Core" Version="2.8.11" />
|
||||||
|
|||||||
39
src/Artemis.UI/Behaviors/MouseBehaviour.cs
Normal file
39
src/Artemis.UI/Behaviors/MouseBehaviour.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace Artemis.UI.Behaviors
|
||||||
|
{
|
||||||
|
public class MouseBehaviour
|
||||||
|
{
|
||||||
|
public static readonly DependencyProperty MouseUpCommandProperty =
|
||||||
|
DependencyProperty.RegisterAttached("MouseUpCommand", typeof(ICommand),
|
||||||
|
typeof(MouseBehaviour), new FrameworkPropertyMetadata(
|
||||||
|
MouseUpCommandChanged));
|
||||||
|
|
||||||
|
public static void SetMouseUpCommand(UIElement element, ICommand value)
|
||||||
|
{
|
||||||
|
element.SetValue(MouseUpCommandProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ICommand GetMouseUpCommand(UIElement element)
|
||||||
|
{
|
||||||
|
return (ICommand) element.GetValue(MouseUpCommandProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void MouseUpCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var element = (FrameworkElement) d;
|
||||||
|
|
||||||
|
element.MouseUp += element_MouseUp;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void element_MouseUp(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
var element = (FrameworkElement) sender;
|
||||||
|
|
||||||
|
var command = GetMouseUpCommand(element);
|
||||||
|
|
||||||
|
command.Execute(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,11 +1,18 @@
|
|||||||
using Artemis.Core.Models.Profile;
|
using Artemis.Core.Models.Profile;
|
||||||
|
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
||||||
using Artemis.Core.Models.Surface;
|
using Artemis.Core.Models.Surface;
|
||||||
using Artemis.Core.Plugins.Abstract;
|
using Artemis.Core.Plugins.Abstract;
|
||||||
using Artemis.UI.Screens.Module;
|
using Artemis.UI.Screens.Module;
|
||||||
using Artemis.UI.Screens.Module.ProfileEditor;
|
using Artemis.UI.Screens.Module.ProfileEditor;
|
||||||
|
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties;
|
||||||
|
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract;
|
||||||
|
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.LayerEffects;
|
||||||
|
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline;
|
||||||
|
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree;
|
||||||
using Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem;
|
using Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem;
|
||||||
using Artemis.UI.Screens.Module.ProfileEditor.Visualization;
|
using Artemis.UI.Screens.Module.ProfileEditor.Visualization;
|
||||||
using Artemis.UI.Screens.Settings.Tabs.Devices;
|
using Artemis.UI.Screens.Settings.Tabs.Devices;
|
||||||
|
using Stylet;
|
||||||
|
|
||||||
namespace Artemis.UI.Ninject.Factories
|
namespace Artemis.UI.Ninject.Factories
|
||||||
{
|
{
|
||||||
@ -43,4 +50,14 @@ namespace Artemis.UI.Ninject.Factories
|
|||||||
{
|
{
|
||||||
ProfileLayerViewModel Create(Layer layer);
|
ProfileLayerViewModel Create(Layer layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface ILayerPropertyVmFactory : IVmFactory
|
||||||
|
{
|
||||||
|
LayerPropertyGroupViewModel LayerPropertyGroupViewModel(LayerPropertyGroup layerPropertyGroup, PropertyGroupDescriptionAttribute propertyGroupDescription);
|
||||||
|
TreeViewModel TreeViewModel(LayerPropertiesViewModel layerPropertiesViewModel, BindableCollection<LayerPropertyGroupViewModel> layerPropertyGroups);
|
||||||
|
EffectsViewModel EffectsViewModel(LayerPropertiesViewModel layerPropertiesViewModel);
|
||||||
|
TimelineViewModel TimelineViewModel(LayerPropertiesViewModel layerPropertiesViewModel, BindableCollection<LayerPropertyGroupViewModel> layerPropertyGroups);
|
||||||
|
TreePropertyGroupViewModel TreePropertyGroupViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel);
|
||||||
|
TimelinePropertyGroupViewModel TimelinePropertyGroupViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,57 +0,0 @@
|
|||||||
<UserControl x:Class="Artemis.UI.PropertyInput.EffectPropertyInputView"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
|
||||||
xmlns:propertyInput="clr-namespace:Artemis.UI.PropertyInput"
|
|
||||||
xmlns:layerEffect="clr-namespace:Artemis.Core.Plugins.LayerEffect;assembly=Artemis.Core"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
|
||||||
d:DataContext="{d:DesignInstance {x:Type propertyInput:EffectPropertyInputViewModel}}">
|
|
||||||
<UserControl.Resources>
|
|
||||||
<ControlTemplate x:Key="SimpleTemplate">
|
|
||||||
<StackPanel d:DataContext="{d:DesignInstance {x:Type layerEffect:LayerEffectDescriptor}}" Orientation="Horizontal">
|
|
||||||
<materialDesign:PackIcon Kind="{Binding Icon}" Height="13" Width="13" Margin="0 1 3 0" />
|
|
||||||
<TextBlock Text="{Binding DisplayName}" />
|
|
||||||
</StackPanel>
|
|
||||||
</ControlTemplate>
|
|
||||||
<ControlTemplate x:Key="ExtendedTemplate">
|
|
||||||
<Grid d:DataContext="{d:DesignInstance {x:Type layerEffect:LayerEffectDescriptor}}">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="Auto" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<materialDesign:PackIcon Grid.Row="0" Grid.RowSpan="2" Kind="{Binding Icon}" Height="20" Width="20" Margin="-5 -2 10 0" VerticalAlignment="Center"/>
|
|
||||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding DisplayName}" TextWrapping="Wrap" MaxWidth="350"/>
|
|
||||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Description}" TextWrapping="Wrap" MaxWidth="350" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" />
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
|
||||||
<DataTemplate x:Key="DescriptorTemplate">
|
|
||||||
<Control x:Name="TemplateControl" Focusable="False" Template="{StaticResource ExtendedTemplate}" />
|
|
||||||
<DataTemplate.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ComboBoxItem}}, Path=IsSelected}" Value="{x:Null}">
|
|
||||||
<Setter TargetName="TemplateControl" Property="Template" Value="{StaticResource SimpleTemplate}" />
|
|
||||||
</DataTrigger>
|
|
||||||
</DataTemplate.Triggers>
|
|
||||||
</DataTemplate>
|
|
||||||
</UserControl.Resources>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<TextBlock Width="10" Text="{Binding LayerProperty.PropertyDescription.InputPrefix}" />
|
|
||||||
<ComboBox Width="132"
|
|
||||||
Margin="0 2"
|
|
||||||
Padding="0 -1"
|
|
||||||
Height="15"
|
|
||||||
materialDesign:ComboBoxAssist.ClassicMode="True"
|
|
||||||
materialDesign:ValidationAssist.UsePopup="True"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
ItemsSource="{Binding Path=Descriptors}"
|
|
||||||
SelectedValue="{Binding Path=SelectedDescriptor}"
|
|
||||||
ItemTemplate="{StaticResource DescriptorTemplate}" />
|
|
||||||
<TextBlock Width="10" Text="{Binding LayerProperty.PropertyDescription.InputAffix}" />
|
|
||||||
</StackPanel>
|
|
||||||
</UserControl>
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Artemis.Core.Events;
|
|
||||||
using Artemis.Core.Models.Profile;
|
|
||||||
using Artemis.Core.Models.Profile.LayerProperties;
|
|
||||||
using Artemis.Core.Plugins.Abstract;
|
|
||||||
using Artemis.Core.Plugins.LayerEffect;
|
|
||||||
using Artemis.Core.Services.Interfaces;
|
|
||||||
using Artemis.UI.Shared.PropertyInput;
|
|
||||||
using Artemis.UI.Shared.Services.Interfaces;
|
|
||||||
|
|
||||||
namespace Artemis.UI.PropertyInput
|
|
||||||
{
|
|
||||||
public class EffectPropertyInputViewModel : PropertyInputViewModel<LayerEffectReference>
|
|
||||||
{
|
|
||||||
private readonly ILayerService _layerService;
|
|
||||||
private readonly IPluginService _pluginService;
|
|
||||||
|
|
||||||
public EffectPropertyInputViewModel(LayerProperty<LayerEffectReference> layerProperty, IProfileEditorService profileEditorService,
|
|
||||||
ILayerService layerService, IPluginService pluginService) : base(layerProperty, profileEditorService)
|
|
||||||
{
|
|
||||||
_layerService = layerService;
|
|
||||||
_pluginService = pluginService;
|
|
||||||
|
|
||||||
_pluginService.PluginEnabled += PluginServiceOnPluginLoaded;
|
|
||||||
_pluginService.PluginDisabled += PluginServiceOnPluginLoaded;
|
|
||||||
UpdateEnumValues();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<LayerEffectDescriptor> Descriptors { get; set; }
|
|
||||||
|
|
||||||
public LayerEffectDescriptor SelectedDescriptor
|
|
||||||
{
|
|
||||||
get => Descriptors.FirstOrDefault(d => d.LayerEffectProvider.PluginInfo.Guid == InputValue?.EffectPluginGuid && d.LayerEffectType.Name == InputValue?.EffectType);
|
|
||||||
set => SetEffectByDescriptor(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateEnumValues()
|
|
||||||
{
|
|
||||||
var layerEffectProviders = _pluginService.GetPluginsOfType<LayerEffectProvider>();
|
|
||||||
Descriptors = layerEffectProviders.SelectMany(l => l.LayerEffectDescriptors).ToList();
|
|
||||||
NotifyOfPropertyChange(nameof(SelectedDescriptor));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public override void Dispose()
|
|
||||||
{
|
|
||||||
_pluginService.PluginEnabled -= PluginServiceOnPluginLoaded;
|
|
||||||
_pluginService.PluginDisabled -= PluginServiceOnPluginLoaded;
|
|
||||||
base.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnInputValueApplied()
|
|
||||||
{
|
|
||||||
_layerService.InstantiateLayerEffect(LayerProperty.Layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetEffectByDescriptor(LayerEffectDescriptor value)
|
|
||||||
{
|
|
||||||
InputValue = new LayerEffectReference {EffectPluginGuid = value.LayerEffectProvider.PluginInfo.Guid, EffectType = value.LayerEffectType.Name};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PluginServiceOnPluginLoaded(object sender, PluginEventArgs e)
|
|
||||||
{
|
|
||||||
UpdateEnumValues();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
<UserControl x:Class="Artemis.UI.Screens.Module.ProfileEditor.Dialogs.ProfileElementRenameView"
|
<UserControl x:Class="Artemis.UI.Screens.Module.ProfileEditor.Dialogs.RenameView"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
@ -9,7 +9,8 @@
|
|||||||
d:DesignHeight="213.053" d:DesignWidth="254.425">
|
d:DesignHeight="213.053" d:DesignWidth="254.425">
|
||||||
<StackPanel Margin="16">
|
<StackPanel Margin="16">
|
||||||
<TextBlock Style="{StaticResource MaterialDesignHeadline6TextBlock}">
|
<TextBlock Style="{StaticResource MaterialDesignHeadline6TextBlock}">
|
||||||
Rename profile element
|
<Run Text="Rename"></Run>
|
||||||
|
<Run Text="{Binding Subject, Mode=OneWay}"></Run>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
<TextBox materialDesign:HintAssist.Hint="Element name"
|
<TextBox materialDesign:HintAssist.Hint="Element name"
|
||||||
@ -5,11 +5,11 @@ using System.Windows.Input;
|
|||||||
namespace Artemis.UI.Screens.Module.ProfileEditor.Dialogs
|
namespace Artemis.UI.Screens.Module.ProfileEditor.Dialogs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for ProfileElementRenameView.xaml
|
/// Interaction logic for RenameView.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ProfileElementRenameView : UserControl
|
public partial class RenameView : UserControl
|
||||||
{
|
{
|
||||||
public ProfileElementRenameView()
|
public RenameView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
@ -6,13 +6,15 @@ using Stylet;
|
|||||||
|
|
||||||
namespace Artemis.UI.Screens.Module.ProfileEditor.Dialogs
|
namespace Artemis.UI.Screens.Module.ProfileEditor.Dialogs
|
||||||
{
|
{
|
||||||
public class ProfileElementRenameViewModel : DialogViewModelBase
|
public class RenameViewModel : DialogViewModelBase
|
||||||
{
|
{
|
||||||
public ProfileElementRenameViewModel(IModelValidator<ProfileElementRenameViewModel> validator, ProfileElement profileElement) : base(validator)
|
public RenameViewModel(IModelValidator<RenameViewModel> validator, string subject, string currentName) : base(validator)
|
||||||
{
|
{
|
||||||
ElementName = profileElement.Name;
|
Subject = subject;
|
||||||
|
ElementName = currentName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Subject { get; }
|
||||||
public string ElementName { get; set; }
|
public string ElementName { get; set; }
|
||||||
|
|
||||||
public async Task Accept()
|
public async Task Accept()
|
||||||
@ -31,7 +33,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Dialogs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ProfileElementRenameViewModelValidator : AbstractValidator<ProfileElementRenameViewModel>
|
public class ProfileElementRenameViewModelValidator : AbstractValidator<RenameViewModel>
|
||||||
{
|
{
|
||||||
public ProfileElementRenameViewModelValidator()
|
public ProfileElementRenameViewModelValidator()
|
||||||
{
|
{
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
<UserControl x:Class="Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.LayerEffects.EffectsView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.LayerEffects"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:layerEffect="clr-namespace:Artemis.Core.Plugins.LayerEffect;assembly=Artemis.Core"
|
||||||
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
|
xmlns:behaviors="clr-namespace:Artemis.UI.Behaviors"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
|
d:DataContext="{d:DesignInstance local:EffectsViewModel}">
|
||||||
|
<Grid Background="{DynamicResource MaterialDesignCardBackground}">
|
||||||
|
|
||||||
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Top" Margin="16"
|
||||||
|
Visibility="{Binding HasLayerEffectDescriptors, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}}">
|
||||||
|
<materialDesign:PackIcon Kind="AutoAwesome" Width="80" Height="80" HorizontalAlignment="Center" />
|
||||||
|
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap" HorizontalAlignment="Center" Margin="0 15">
|
||||||
|
Looks like you have no effects installed or enabled!
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock Style="{StaticResource MaterialDesignCaptionTextBlock}" TextWrapping="Wrap" HorizontalAlignment="Center">
|
||||||
|
Effects will apply some sort of post- or pre-processing to layers or even entire folders. <LineBreak />
|
||||||
|
Think of things like blur, black & white but also audio visualization etc.
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
|
<ListBox ItemsSource="{Binding LayerEffectDescriptors}" SelectedItem="{Binding SelectedLayerEffectDescriptor}" HorizontalContentAlignment="Stretch"
|
||||||
|
Visibility="{Binding HasLayerEffectDescriptors, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type layerEffect:LayerEffectDescriptor}">
|
||||||
|
<Border Padding="8" BorderThickness="0 0 0 1" BorderBrush="{DynamicResource MaterialDesignDivider}" VerticalAlignment="Stretch"
|
||||||
|
behaviors:MouseBehaviour.MouseUpCommand="{x:Static materialDesign:Transitioner.MoveFirstCommand}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<materialDesign:PackIcon Kind="{Binding Icon}" Width="20" Height="20" VerticalAlignment="Center" />
|
||||||
|
<StackPanel Margin="8 0 0 0" Grid.Column="1" VerticalAlignment="Stretch">
|
||||||
|
<TextBlock FontWeight="Bold" Text="{Binding DisplayName}" />
|
||||||
|
<TextBlock Text="{Binding Description}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using Artemis.Core.Plugins.Abstract;
|
||||||
|
using Artemis.Core.Plugins.LayerEffect;
|
||||||
|
using Artemis.Core.Services.Interfaces;
|
||||||
|
using Stylet;
|
||||||
|
|
||||||
|
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.LayerEffects
|
||||||
|
{
|
||||||
|
public class EffectsViewModel : PropertyChangedBase
|
||||||
|
{
|
||||||
|
private readonly ILayerService _layerService;
|
||||||
|
private readonly IPluginService _pluginService;
|
||||||
|
|
||||||
|
public EffectsViewModel(LayerPropertiesViewModel layerPropertiesViewModel, IPluginService pluginService, ILayerService layerService)
|
||||||
|
{
|
||||||
|
_pluginService = pluginService;
|
||||||
|
_layerService = layerService;
|
||||||
|
LayerPropertiesViewModel = layerPropertiesViewModel;
|
||||||
|
LayerEffectDescriptors = new BindableCollection<LayerEffectDescriptor>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public LayerPropertiesViewModel LayerPropertiesViewModel { get; }
|
||||||
|
|
||||||
|
public BindableCollection<LayerEffectDescriptor> LayerEffectDescriptors { get; set; }
|
||||||
|
public bool HasLayerEffectDescriptors => LayerEffectDescriptors.Any();
|
||||||
|
|
||||||
|
public LayerEffectDescriptor SelectedLayerEffectDescriptor
|
||||||
|
{
|
||||||
|
get => null;
|
||||||
|
set => AddLayerEffect(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PopulateDescriptors()
|
||||||
|
{
|
||||||
|
var layerBrushProviders = _pluginService.GetPluginsOfType<LayerEffectProvider>();
|
||||||
|
|
||||||
|
if (LayerEffectDescriptors.Any())
|
||||||
|
LayerEffectDescriptors.Clear();
|
||||||
|
LayerEffectDescriptors.AddRange(layerBrushProviders.SelectMany(l => l.LayerEffectDescriptors));
|
||||||
|
|
||||||
|
NotifyOfPropertyChange(nameof(HasLayerEffectDescriptors));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddLayerEffect(LayerEffectDescriptor value)
|
||||||
|
{
|
||||||
|
if (LayerPropertiesViewModel.SelectedLayer != null && value != null)
|
||||||
|
_layerService.AddLayerEffect(LayerPropertiesViewModel.SelectedLayer, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,21 +1,21 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties"
|
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties"
|
||||||
xmlns:s="https://github.com/canton7/Stylet"
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
xmlns:timeline="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline"
|
xmlns:timeline="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
xmlns:behaviors="clr-namespace:Artemis.UI.Behaviors"
|
xmlns:behaviors="clr-namespace:Artemis.UI.Behaviors"
|
||||||
xmlns:Converters="clr-namespace:Artemis.UI.Converters" x:Class="Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.LayerPropertiesView"
|
xmlns:Converters="clr-namespace:Artemis.UI.Converters" x:Class="Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.LayerPropertiesView"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
d:DataContext="{d:DesignInstance {x:Type local:LayerPropertiesViewModel}}"
|
d:DataContext="{d:DesignInstance {x:Type local:LayerPropertiesViewModel}}"
|
||||||
behaviors:InputBindingBehavior.PropagateInputBindingsToWindow="True">
|
behaviors:InputBindingBehavior.PropagateInputBindingsToWindow="True">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<Converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter"/>
|
<Converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
|
||||||
<Style x:Key="SvStyle" TargetType="{x:Type ScrollViewer}">
|
<Style x:Key="SvStyle" TargetType="{x:Type ScrollViewer}">
|
||||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
@ -125,14 +125,24 @@
|
|||||||
|
|
||||||
<!-- Properties tree -->
|
<!-- Properties tree -->
|
||||||
<materialDesign:DialogHost Identifier="PropertyTreeDialogHost" DialogTheme="Inherit" CloseOnClickAway="True" Grid.Row="1">
|
<materialDesign:DialogHost Identifier="PropertyTreeDialogHost" DialogTheme="Inherit" CloseOnClickAway="True" Grid.Row="1">
|
||||||
<ScrollViewer x:Name="PropertyTreeScrollViewer"
|
<materialDesign:Transitioner SelectedIndex="{Binding PropertyTreeIndex}" DefaultTransitionOrigin="0.9, 1" AutoApplyTransitionOrigins="True">
|
||||||
HorizontalScrollBarVisibility="Hidden"
|
|
||||||
VerticalScrollBarVisibility="Hidden"
|
<ScrollViewer x:Name="PropertyTreeScrollViewer"
|
||||||
ScrollChanged="TimelineScrollChanged">
|
HorizontalScrollBarVisibility="Hidden"
|
||||||
<Border BorderThickness="0,0,1,0" BorderBrush="{DynamicResource MaterialDesignDivider}">
|
VerticalScrollBarVisibility="Hidden"
|
||||||
<ContentControl s:View.Model="{Binding TreeViewModel}" />
|
ScrollChanged="TimelineScrollChanged">
|
||||||
</Border>
|
<Border BorderThickness="0,0,1,0" BorderBrush="{DynamicResource MaterialDesignDivider}">
|
||||||
</ScrollViewer>
|
<ContentControl s:View.Model="{Binding TreeViewModel}" />
|
||||||
|
</Border>
|
||||||
|
</ScrollViewer>
|
||||||
|
|
||||||
|
<materialDesign:TransitionerSlide >
|
||||||
|
<materialDesign:TransitionerSlide.BackwardWipe>
|
||||||
|
<materialDesign:CircleWipe />
|
||||||
|
</materialDesign:TransitionerSlide.BackwardWipe>
|
||||||
|
<ContentControl s:View.Model="{Binding EffectsViewModel}" />
|
||||||
|
</materialDesign:TransitionerSlide>
|
||||||
|
</materialDesign:Transitioner>
|
||||||
</materialDesign:DialogHost>
|
</materialDesign:DialogHost>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
@ -206,10 +216,10 @@
|
|||||||
<Grid Grid.Column="0">
|
<Grid Grid.Column="0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<StackPanel Grid.Column="0"
|
<StackPanel Grid.Column="0"
|
||||||
Orientation="Horizontal"
|
Orientation="Horizontal"
|
||||||
Margin="6"
|
Margin="6"
|
||||||
Visibility="{Binding SelectedLayer, Converter={StaticResource NullToVisibilityConverter}}">
|
Visibility="{Binding SelectedLayer, Converter={StaticResource NullToVisibilityConverter}}">
|
||||||
<materialDesign:PackIcon Kind="Layers" Width="16" />
|
<materialDesign:PackIcon Kind="Layers" Width="16" />
|
||||||
@ -218,11 +228,11 @@
|
|||||||
Margin="5 0 0 0"
|
Margin="5 0 0 0"
|
||||||
ToolTip="{Binding SelectedLayer.LayerBrush.Descriptor.DisplayName, Mode=OneWay}"
|
ToolTip="{Binding SelectedLayer.LayerBrush.Descriptor.DisplayName, Mode=OneWay}"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Visibility="{Binding SelectedLayer.LayerBrush, Converter={StaticResource NullToVisibilityConverter}}"/>
|
Visibility="{Binding SelectedLayer.LayerBrush, Converter={StaticResource NullToVisibilityConverter}}" />
|
||||||
<TextBlock Text="{Binding SelectedLayer.Name}" Margin="5 0 0 0" />
|
<TextBlock Text="{Binding SelectedLayer.Name}" Margin="5 0 0 0" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Column="0"
|
<StackPanel Grid.Column="0"
|
||||||
Orientation="Horizontal"
|
Orientation="Horizontal"
|
||||||
Margin="6"
|
Margin="6"
|
||||||
Visibility="{Binding SelectedFolder, Converter={StaticResource NullToVisibilityConverter}}">
|
Visibility="{Binding SelectedFolder, Converter={StaticResource NullToVisibilityConverter}}">
|
||||||
<materialDesign:PackIcon Kind="Folder" Width="16" />
|
<materialDesign:PackIcon Kind="Folder" Width="16" />
|
||||||
@ -235,9 +245,11 @@
|
|||||||
Height="20"
|
Height="20"
|
||||||
Width="82"
|
Width="82"
|
||||||
ToolTip="Change the property's data binding"
|
ToolTip="Change the property's data binding"
|
||||||
|
VerticalAlignment="Center"
|
||||||
VerticalAlignment="Center">
|
Command="{s:Action ToggleAddEffect}">
|
||||||
<TextBlock FontSize="10"><Run Text="ADD EFFECT"/></TextBlock>
|
<TextBlock FontSize="10">
|
||||||
|
<Run Text="ADD EFFECT" />
|
||||||
|
</TextBlock>
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,8 @@ using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
|||||||
using Artemis.Core.Plugins.LayerBrush.Abstract;
|
using Artemis.Core.Plugins.LayerBrush.Abstract;
|
||||||
using Artemis.Core.Services;
|
using Artemis.Core.Services;
|
||||||
using Artemis.Core.Services.Interfaces;
|
using Artemis.Core.Services.Interfaces;
|
||||||
|
using Artemis.UI.Ninject.Factories;
|
||||||
|
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.LayerEffects;
|
||||||
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline;
|
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline;
|
||||||
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree;
|
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree;
|
||||||
using Artemis.UI.Shared.Events;
|
using Artemis.UI.Shared.Events;
|
||||||
@ -21,10 +23,15 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
{
|
{
|
||||||
public class LayerPropertiesViewModel : ProfileEditorPanelViewModel
|
public class LayerPropertiesViewModel : ProfileEditorPanelViewModel
|
||||||
{
|
{
|
||||||
|
private readonly ILayerPropertyVmFactory _layerPropertyVmFactory;
|
||||||
private LayerPropertyGroupViewModel _brushPropertyGroup;
|
private LayerPropertyGroupViewModel _brushPropertyGroup;
|
||||||
|
private DateTime _lastToggle;
|
||||||
|
|
||||||
public LayerPropertiesViewModel(IProfileEditorService profileEditorService, ICoreService coreService, ISettingsService settingsService)
|
public LayerPropertiesViewModel(IProfileEditorService profileEditorService, ICoreService coreService, ISettingsService settingsService,
|
||||||
|
ILayerPropertyVmFactory layerPropertyVmFactory)
|
||||||
{
|
{
|
||||||
|
_layerPropertyVmFactory = layerPropertyVmFactory;
|
||||||
|
|
||||||
ProfileEditorService = profileEditorService;
|
ProfileEditorService = profileEditorService;
|
||||||
CoreService = coreService;
|
CoreService = coreService;
|
||||||
SettingsService = settingsService;
|
SettingsService = settingsService;
|
||||||
@ -46,11 +53,13 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
set => ProfileEditorService.CurrentTime = TimeSpan.FromSeconds(value.Left / ProfileEditorService.PixelsPerSecond);
|
set => ProfileEditorService.CurrentTime = TimeSpan.FromSeconds(value.Left / ProfileEditorService.PixelsPerSecond);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int PropertyTreeIndex { get; set; }
|
||||||
public Layer SelectedLayer { get; set; }
|
public Layer SelectedLayer { get; set; }
|
||||||
public Folder SelectedFolder { get; set; }
|
public Folder SelectedFolder { get; set; }
|
||||||
|
|
||||||
public BindableCollection<LayerPropertyGroupViewModel> LayerPropertyGroups { get; set; }
|
public BindableCollection<LayerPropertyGroupViewModel> LayerPropertyGroups { get; set; }
|
||||||
public TreeViewModel TreeViewModel { get; set; }
|
public TreeViewModel TreeViewModel { get; set; }
|
||||||
|
public EffectsViewModel EffectsViewModel { get; set; }
|
||||||
public TimelineViewModel TimelineViewModel { get; set; }
|
public TimelineViewModel TimelineViewModel { get; set; }
|
||||||
|
|
||||||
protected override void OnInitialActivate()
|
protected override void OnInitialActivate()
|
||||||
@ -110,9 +119,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
{
|
{
|
||||||
SelectedFolder = null;
|
SelectedFolder = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectedLayer != null)
|
if (SelectedLayer != null)
|
||||||
{
|
{
|
||||||
SelectedLayer.LayerBrushUpdated -= SelectedLayerOnLayerBrushUpdated;
|
SelectedLayer.LayerBrushUpdated -= SelectedLayerOnLayerBrushUpdated;
|
||||||
|
SelectedLayer.LayerEffectsUpdated -= SelectedLayerOnLayerEffectsUpdated;
|
||||||
SelectedLayer = null;
|
SelectedLayer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +140,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
{
|
{
|
||||||
SelectedLayer = layer;
|
SelectedLayer = layer;
|
||||||
SelectedLayer.LayerBrushUpdated += SelectedLayerOnLayerBrushUpdated;
|
SelectedLayer.LayerBrushUpdated += SelectedLayerOnLayerBrushUpdated;
|
||||||
|
SelectedLayer.LayerEffectsUpdated += SelectedLayerOnLayerEffectsUpdated;
|
||||||
|
|
||||||
// Add the built-in root groups of the layer
|
// Add the built-in root groups of the layer
|
||||||
var generalAttribute = Attribute.GetCustomAttribute(
|
var generalAttribute = Attribute.GetCustomAttribute(
|
||||||
@ -139,16 +151,18 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
layer.GetType().GetProperty(nameof(layer.Transform)),
|
layer.GetType().GetProperty(nameof(layer.Transform)),
|
||||||
typeof(PropertyGroupDescriptionAttribute)
|
typeof(PropertyGroupDescriptionAttribute)
|
||||||
);
|
);
|
||||||
LayerPropertyGroups.Add(new LayerPropertyGroupViewModel(ProfileEditorService, layer.General, (PropertyGroupDescriptionAttribute) generalAttribute));
|
LayerPropertyGroups.Add(_layerPropertyVmFactory.LayerPropertyGroupViewModel(layer.General, (PropertyGroupDescriptionAttribute) generalAttribute));
|
||||||
LayerPropertyGroups.Add(new LayerPropertyGroupViewModel(ProfileEditorService, layer.Transform, (PropertyGroupDescriptionAttribute) transformAttribute));
|
LayerPropertyGroups.Add(_layerPropertyVmFactory.LayerPropertyGroupViewModel(layer.Transform, (PropertyGroupDescriptionAttribute) transformAttribute));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SelectedLayer = null;
|
SelectedLayer = null;
|
||||||
|
|
||||||
TreeViewModel = new TreeViewModel(this, LayerPropertyGroups);
|
TreeViewModel = _layerPropertyVmFactory.TreeViewModel(this, LayerPropertyGroups);
|
||||||
TimelineViewModel = new TimelineViewModel(this, LayerPropertyGroups);
|
EffectsViewModel = _layerPropertyVmFactory.EffectsViewModel(this);
|
||||||
|
TimelineViewModel = _layerPropertyVmFactory.TimelineViewModel(this, LayerPropertyGroups);
|
||||||
|
|
||||||
ApplyLayerBrush();
|
ApplyLayerBrush();
|
||||||
|
ApplyLayerEffects();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectedLayerOnLayerBrushUpdated(object sender, EventArgs e)
|
private void SelectedLayerOnLayerBrushUpdated(object sender, EventArgs e)
|
||||||
@ -156,6 +170,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
ApplyLayerBrush();
|
ApplyLayerBrush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SelectedLayerOnLayerEffectsUpdated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ApplyLayerEffects();
|
||||||
|
}
|
||||||
|
|
||||||
public void ApplyLayerBrush()
|
public void ApplyLayerBrush()
|
||||||
{
|
{
|
||||||
if (SelectedLayer == null)
|
if (SelectedLayer == null)
|
||||||
@ -183,13 +202,42 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
Name = SelectedLayer.LayerBrush.Descriptor.DisplayName,
|
Name = SelectedLayer.LayerBrush.Descriptor.DisplayName,
|
||||||
Description = SelectedLayer.LayerBrush.Descriptor.Description
|
Description = SelectedLayer.LayerBrush.Descriptor.Description
|
||||||
};
|
};
|
||||||
_brushPropertyGroup = new LayerPropertyGroupViewModel(ProfileEditorService, SelectedLayer.LayerBrush.BaseProperties, brushDescription);
|
_brushPropertyGroup = _layerPropertyVmFactory.LayerPropertyGroupViewModel(SelectedLayer.LayerBrush.BaseProperties, brushDescription);
|
||||||
LayerPropertyGroups.Add(_brushPropertyGroup);
|
LayerPropertyGroups.Add(_brushPropertyGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
TimelineViewModel.UpdateKeyframes();
|
TimelineViewModel.UpdateKeyframes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ApplyLayerEffects()
|
||||||
|
{
|
||||||
|
if (SelectedLayer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Remove VMs of effects no longer applied on the layer
|
||||||
|
var toRemove = LayerPropertyGroups.Where(l => l.LayerPropertyGroup.LayerEffect != null && !SelectedLayer.LayerEffects.Contains(l.LayerPropertyGroup.LayerEffect)).ToList();
|
||||||
|
LayerPropertyGroups.RemoveRange(toRemove);
|
||||||
|
foreach (var layerPropertyGroupViewModel in toRemove)
|
||||||
|
layerPropertyGroupViewModel.Dispose();
|
||||||
|
|
||||||
|
foreach (var layerEffect in SelectedLayer.LayerEffects)
|
||||||
|
{
|
||||||
|
if (LayerPropertyGroups.Any(l => l.LayerPropertyGroup.LayerEffect == layerEffect))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Add the rout group of the brush
|
||||||
|
// The root group of the brush has no attribute so let's pull one out of our sleeve
|
||||||
|
var brushDescription = new PropertyGroupDescriptionAttribute
|
||||||
|
{
|
||||||
|
Name = layerEffect.Descriptor.DisplayName,
|
||||||
|
Description = layerEffect.Descriptor.Description
|
||||||
|
};
|
||||||
|
LayerPropertyGroups.Add(_layerPropertyVmFactory.LayerPropertyGroupViewModel(layerEffect.BaseProperties, brushDescription));
|
||||||
|
}
|
||||||
|
|
||||||
|
TimelineViewModel.UpdateKeyframes();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Controls
|
#region Controls
|
||||||
@ -341,5 +389,20 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Effects
|
||||||
|
|
||||||
|
public void ToggleAddEffect()
|
||||||
|
{
|
||||||
|
if (DateTime.Now - _lastToggle < TimeSpan.FromMilliseconds(500))
|
||||||
|
return;
|
||||||
|
|
||||||
|
_lastToggle = DateTime.Now;
|
||||||
|
PropertyTreeIndex = PropertyTreeIndex == 0 ? 1 : 0;
|
||||||
|
if (PropertyTreeIndex == 1)
|
||||||
|
EffectsViewModel.PopulateDescriptors();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using Artemis.Core.Models.Profile;
|
using Artemis.Core.Models.Profile;
|
||||||
using Artemis.Core.Models.Profile.LayerProperties;
|
using Artemis.Core.Models.Profile.LayerProperties;
|
||||||
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
||||||
|
using Artemis.UI.Ninject.Factories;
|
||||||
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract;
|
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract;
|
||||||
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline;
|
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline;
|
||||||
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree;
|
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree;
|
||||||
@ -24,16 +25,19 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
public LayerPropertyGroupViewModel(IProfileEditorService profileEditorService, LayerPropertyGroup layerPropertyGroup,
|
private readonly ILayerPropertyVmFactory _layerPropertyVmFactory;
|
||||||
PropertyGroupDescriptionAttribute propertyGroupDescription)
|
|
||||||
|
public LayerPropertyGroupViewModel(LayerPropertyGroup layerPropertyGroup, PropertyGroupDescriptionAttribute propertyGroupDescription,
|
||||||
|
IProfileEditorService profileEditorService, ILayerPropertyVmFactory layerPropertyVmFactory)
|
||||||
{
|
{
|
||||||
|
_layerPropertyVmFactory = layerPropertyVmFactory;
|
||||||
ProfileEditorService = profileEditorService;
|
ProfileEditorService = profileEditorService;
|
||||||
|
|
||||||
LayerPropertyGroup = layerPropertyGroup;
|
LayerPropertyGroup = layerPropertyGroup;
|
||||||
PropertyGroupDescription = propertyGroupDescription;
|
PropertyGroupDescription = propertyGroupDescription;
|
||||||
|
|
||||||
TreePropertyGroupViewModel = new TreePropertyGroupViewModel(this);
|
TreePropertyGroupViewModel = _layerPropertyVmFactory.TreePropertyGroupViewModel(this);
|
||||||
TimelinePropertyGroupViewModel = new TimelinePropertyGroupViewModel(this);
|
TimelinePropertyGroupViewModel = _layerPropertyVmFactory.TimelinePropertyGroupViewModel(this);
|
||||||
|
|
||||||
LayerPropertyGroup.VisibilityChanged += LayerPropertyGroupOnVisibilityChanged;
|
LayerPropertyGroup.VisibilityChanged += LayerPropertyGroupOnVisibilityChanged;
|
||||||
PopulateChildren();
|
PopulateChildren();
|
||||||
@ -123,7 +127,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
|||||||
}
|
}
|
||||||
// Create VMs for child groups on this group, resulting in a nested structure
|
// Create VMs for child groups on this group, resulting in a nested structure
|
||||||
else if (groupAttribute != null && value is LayerPropertyGroup layerPropertyGroup)
|
else if (groupAttribute != null && value is LayerPropertyGroup layerPropertyGroup)
|
||||||
Children.Add(new LayerPropertyGroupViewModel(ProfileEditorService, layerPropertyGroup, groupAttribute));
|
Children.Add(_layerPropertyVmFactory.LayerPropertyGroupViewModel(layerPropertyGroup, groupAttribute));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ using Stylet;
|
|||||||
|
|
||||||
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
||||||
{
|
{
|
||||||
public class TimelineViewModel
|
public class TimelineViewModel : PropertyChangedBase
|
||||||
{
|
{
|
||||||
private readonly LayerPropertiesViewModel _layerPropertiesViewModel;
|
private readonly LayerPropertiesViewModel _layerPropertiesViewModel;
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
{
|
{
|
||||||
layerPropertyGroupViewModel.TimelinePropertyGroupViewModel.TimelineViewModel = this;
|
layerPropertyGroupViewModel.TimelinePropertyGroupViewModel.TimelineViewModel = this;
|
||||||
layerPropertyGroupViewModel.TimelinePropertyGroupViewModel.UpdateKeyframes();
|
layerPropertyGroupViewModel.TimelinePropertyGroupViewModel.UpdateKeyframes();
|
||||||
|
|
||||||
foreach (var layerPropertyBaseViewModel in layerPropertyGroupViewModel.GetAllChildren())
|
foreach (var layerPropertyBaseViewModel in layerPropertyGroupViewModel.GetAllChildren())
|
||||||
{
|
{
|
||||||
if (layerPropertyBaseViewModel is LayerPropertyViewModel layerPropertyViewModel)
|
if (layerPropertyBaseViewModel is LayerPropertyViewModel layerPropertyViewModel)
|
||||||
|
|||||||
@ -5,9 +5,14 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree"
|
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
|
xmlns:converters="clr-namespace:Artemis.UI.Converters"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DataContext="{d:DesignInstance local:TreePropertyGroupViewModel}"
|
d:DataContext="{d:DesignInstance local:TreePropertyGroupViewModel}"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
|
||||||
|
</UserControl.Resources>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<!-- Type: None -->
|
<!-- Type: None -->
|
||||||
<TextBlock
|
<TextBlock
|
||||||
@ -78,12 +83,15 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Type: LayerEffectRoot -->
|
<!-- Type: LayerEffectRoot -->
|
||||||
<Grid Height="22">
|
<Grid Height="24">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.Style>
|
<Grid.Style>
|
||||||
<Style TargetType="{x:Type Grid}">
|
<Style TargetType="{x:Type Grid}">
|
||||||
@ -96,24 +104,47 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Grid.Style>
|
</Grid.Style>
|
||||||
<materialDesign:PackIcon Grid.Column="0" Kind="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.Descriptor.Icon}" Margin="0 5 5 0" />
|
<materialDesign:PackIcon Grid.Column="0" Kind="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.Descriptor.Icon}" Margin="0 5 5 0" />
|
||||||
<TextBlock Grid.Column="1" ToolTip="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.Descriptor.Description}" Margin="0 5">
|
<TextBlock Grid.Column="1" ToolTip="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.Descriptor.Description}" Margin="0 5 0 0">
|
||||||
Effect - 
|
Effect
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<TextBlock Grid.Column="2"
|
<TextBlock Grid.Column="2"
|
||||||
|
ToolTip="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.Descriptor.Description}"
|
||||||
|
Margin="3 5">
|
||||||
|
-
|
||||||
|
</TextBlock>
|
||||||
|
|
||||||
|
<!-- Show either the descriptors display name or, if set, the effect name -->
|
||||||
|
<TextBlock Grid.Column="3"
|
||||||
Text="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.Descriptor.DisplayName}"
|
Text="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.Descriptor.DisplayName}"
|
||||||
ToolTip="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.Descriptor.Description}"
|
ToolTip="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.Descriptor.Description}"
|
||||||
Margin="0 5" />
|
Margin="0 5"
|
||||||
|
Visibility="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.Name, Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=Inverted}" />
|
||||||
|
<TextBlock Grid.Column="4"
|
||||||
|
Text="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.Name}"
|
||||||
|
ToolTip="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.Descriptor.Description}"
|
||||||
|
Margin="0 5"
|
||||||
|
Visibility="{Binding LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.Name, Converter={StaticResource NullToVisibilityConverter}}" />
|
||||||
|
|
||||||
<Button Grid.Column="3"
|
<Button Grid.Column="5"
|
||||||
Style="{StaticResource MaterialDesignOutlinedButton}"
|
Style="{StaticResource MaterialDesignIconButton}"
|
||||||
Margin="0 1"
|
ToolTip="Rename"
|
||||||
Padding="0"
|
Width="24"
|
||||||
Width="80"
|
Height="24"
|
||||||
Height="20"
|
VerticalAlignment="Center"
|
||||||
ToolTip="Change the property's data binding"
|
Command="{s:Action RenameEffect}">
|
||||||
VerticalAlignment="Center">
|
<materialDesign:PackIcon Kind="RenameBox" Height="16" Width="16" />
|
||||||
<TextBlock FontSize="10">DELETE EFFECT</TextBlock>
|
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<Button Grid.Column="6"
|
||||||
|
Style="{StaticResource MaterialDesignIconButton}"
|
||||||
|
ToolTip="Remove"
|
||||||
|
Width="24"
|
||||||
|
Height="24"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Command="{s:Action DeleteEffect}">
|
||||||
|
<materialDesign:PackIcon Kind="TrashCan" Height="16" Width="16" />
|
||||||
|
</Button>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -1,14 +1,50 @@
|
|||||||
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract;
|
using System.Collections.Generic;
|
||||||
|
using Artemis.Core.Services.Interfaces;
|
||||||
|
using Artemis.UI.Screens.Module.ProfileEditor.Dialogs;
|
||||||
|
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract;
|
||||||
|
using Artemis.UI.Shared.Services.Interfaces;
|
||||||
|
|
||||||
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree
|
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree
|
||||||
{
|
{
|
||||||
public class TreePropertyGroupViewModel
|
public class TreePropertyGroupViewModel
|
||||||
{
|
{
|
||||||
public TreePropertyGroupViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel)
|
private readonly IProfileEditorService _profileEditorService;
|
||||||
|
private readonly ILayerService _layerService;
|
||||||
|
private readonly IDialogService _dialogService;
|
||||||
|
|
||||||
|
public TreePropertyGroupViewModel(LayerPropertyBaseViewModel layerPropertyBaseViewModel,
|
||||||
|
IProfileEditorService profileEditorService, ILayerService layerService, IDialogService dialogService)
|
||||||
{
|
{
|
||||||
LayerPropertyGroupViewModel = (LayerPropertyGroupViewModel)layerPropertyBaseViewModel;
|
_profileEditorService = profileEditorService;
|
||||||
|
_layerService = layerService;
|
||||||
|
_dialogService = dialogService;
|
||||||
|
LayerPropertyGroupViewModel = (LayerPropertyGroupViewModel) layerPropertyBaseViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LayerPropertyGroupViewModel LayerPropertyGroupViewModel { get; }
|
public LayerPropertyGroupViewModel LayerPropertyGroupViewModel { get; }
|
||||||
|
|
||||||
|
public async void RenameEffect()
|
||||||
|
{
|
||||||
|
var result = await _dialogService.ShowDialogAt<RenameViewModel>(
|
||||||
|
"PropertyTreeDialogHost",
|
||||||
|
new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
{"subject", "effect"},
|
||||||
|
{"currentName", LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.Name}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (result is string newName)
|
||||||
|
{
|
||||||
|
LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.Name = newName;
|
||||||
|
LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect.HasBeenRenamed = true;
|
||||||
|
_profileEditorService.UpdateSelectedProfile(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteEffect()
|
||||||
|
{
|
||||||
|
_layerService.RemoveLayerEffect(LayerPropertyGroupViewModel.LayerPropertyGroup.LayerEffect);
|
||||||
|
_profileEditorService.UpdateSelectedProfile(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,12 +1,11 @@
|
|||||||
using System.Linq;
|
using System.Windows;
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Stylet;
|
using Stylet;
|
||||||
|
|
||||||
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree
|
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree
|
||||||
{
|
{
|
||||||
public class TreeViewModel
|
public class TreeViewModel : PropertyChangedBase
|
||||||
{
|
{
|
||||||
private readonly LayerPropertiesViewModel _layerPropertiesViewModel;
|
private readonly LayerPropertiesViewModel _layerPropertiesViewModel;
|
||||||
|
|
||||||
|
|||||||
@ -130,8 +130,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem
|
|||||||
// ReSharper disable once UnusedMember.Global - Called from view
|
// ReSharper disable once UnusedMember.Global - Called from view
|
||||||
public async Task RenameElement()
|
public async Task RenameElement()
|
||||||
{
|
{
|
||||||
var result = await _dialogService.ShowDialog<ProfileElementRenameViewModel>(
|
var result = await _dialogService.ShowDialog<RenameViewModel>(
|
||||||
new Dictionary<string, object> {{"profileElement", ProfileElement}}
|
new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
{"subject", ProfileElement is Folder ? "folder" : "layer"},
|
||||||
|
{"currentName", ProfileElement.Name}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
if (result is string newName)
|
if (result is string newName)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -30,7 +30,6 @@ namespace Artemis.UI.Services
|
|||||||
{
|
{
|
||||||
_profileEditorService.RegisterPropertyInput(Constants.CorePluginInfo, typeof(BrushPropertyInputViewModel));
|
_profileEditorService.RegisterPropertyInput(Constants.CorePluginInfo, typeof(BrushPropertyInputViewModel));
|
||||||
_profileEditorService.RegisterPropertyInput(Constants.CorePluginInfo, typeof(ColorGradientPropertyInputViewModel));
|
_profileEditorService.RegisterPropertyInput(Constants.CorePluginInfo, typeof(ColorGradientPropertyInputViewModel));
|
||||||
_profileEditorService.RegisterPropertyInput(Constants.CorePluginInfo, typeof(EffectPropertyInputViewModel));
|
|
||||||
_profileEditorService.RegisterPropertyInput(Constants.CorePluginInfo, typeof(FloatPropertyInputViewModel));
|
_profileEditorService.RegisterPropertyInput(Constants.CorePluginInfo, typeof(FloatPropertyInputViewModel));
|
||||||
_profileEditorService.RegisterPropertyInput(Constants.CorePluginInfo, typeof(IntPropertyInputViewModel));
|
_profileEditorService.RegisterPropertyInput(Constants.CorePluginInfo, typeof(IntPropertyInputViewModel));
|
||||||
_profileEditorService.RegisterPropertyInput(Constants.CorePluginInfo, typeof(SKColorPropertyInputViewModel));
|
_profileEditorService.RegisterPropertyInput(Constants.CorePluginInfo, typeof(SKColorPropertyInputViewModel));
|
||||||
|
|||||||
@ -37,7 +37,6 @@
|
|||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(BuildingInsideVisualStudio)' == 'true'">
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(BuildingInsideVisualStudio)' == 'true'">
|
||||||
<Exec
|
<Exec Command="echo Copying resources to plugin output directory
XCOPY "$(ProjectDir)Images" "$(TargetDir)Images" /s /q /i /y
XCOPY "$(ProjectDir)Layouts" "$(TargetDir)Layouts" /s /q /i /y
echo Copying plugin to Artemis.UI output directory
XCOPY "$(TargetDir.TrimEnd('\'))" "$(SolutionDir)\Artemis.UI\$(OutDir)Plugins\$(ProjectName)" /s /q /i /y" />
|
||||||
Command="echo Copying resources to plugin output directory
XCOPY "$(ProjectDir)Images" "$(TargetDir)Images" /s /q /i /y
XCOPY "$(ProjectDir)Layouts" "$(TargetDir)Layouts" /s /q /i /y
echo Copying plugin to Artemis.UI output directory
XCOPY "$(TargetDir.TrimEnd('\'))" "$(SolutionDir)\Artemis.UI\$(OutDir)Plugins\$(ProjectName)" /s /q /i /y" />
|
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using Artemis.Core.Plugins.LayerEffect.Abstract;
|
using System;
|
||||||
|
using Artemis.Core.Plugins.LayerEffect.Abstract;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace Artemis.Plugins.LayerEffects.Filter
|
namespace Artemis.Plugins.LayerEffects.Filter
|
||||||
@ -7,8 +8,15 @@ namespace Artemis.Plugins.LayerEffects.Filter
|
|||||||
{
|
{
|
||||||
public override void EnableLayerEffect()
|
public override void EnableLayerEffect()
|
||||||
{
|
{
|
||||||
|
Properties.BlurAmount.BaseValueChanged += BlurAmountOnBaseValueChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BlurAmountOnBaseValueChanged(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!HasBeenRenamed)
|
||||||
|
Name = "Blur";
|
||||||
|
}
|
||||||
|
|
||||||
public override void DisableLayerEffect()
|
public override void DisableLayerEffect()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -19,6 +27,7 @@ namespace Artemis.Plugins.LayerEffects.Filter
|
|||||||
|
|
||||||
public override void PreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
public override void PreProcess(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||||
{
|
{
|
||||||
|
|
||||||
paint.ImageFilter = SKImageFilter.CreateBlur(Properties.BlurAmount.CurrentValue.Width, Properties.BlurAmount.CurrentValue.Height, paint.ImageFilter);
|
paint.ImageFilter = SKImageFilter.CreateBlur(Properties.BlurAmount.CurrentValue.Width, Properties.BlurAmount.CurrentValue.Height, paint.ImageFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user