diff --git a/src/Artemis.Core/Models/Profile/Layer.cs b/src/Artemis.Core/Models/Profile/Layer.cs
index f328c2336..ed449c1aa 100644
--- a/src/Artemis.Core/Models/Profile/Layer.cs
+++ b/src/Artemis.Core/Models/Profile/Layer.cs
@@ -7,8 +7,8 @@ using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
using Artemis.Core.Models.Profile.LayerShapes;
using Artemis.Core.Models.Surface;
-using Artemis.Core.Plugins.LayerBrush;
using Artemis.Core.Plugins.LayerBrush.Abstract;
+using Artemis.Core.Plugins.LayerEffect.Abstract;
using Artemis.Core.Services;
using Artemis.Core.Services.Interfaces;
using Artemis.Storage.Entities.Profile;
diff --git a/src/Artemis.UI/PropertyInput/BrushPropertyInputView.xaml b/src/Artemis.UI/PropertyInput/BrushPropertyInputView.xaml
index fda36c166..62c395871 100644
--- a/src/Artemis.UI/PropertyInput/BrushPropertyInputView.xaml
+++ b/src/Artemis.UI/PropertyInput/BrushPropertyInputView.xaml
@@ -5,21 +5,53 @@
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:layerBrush="clr-namespace:Artemis.Core.Plugins.LayerBrush;assembly=Artemis.Core"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignInstance {x:Type propertyInput:BrushPropertyInputViewModel}}">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ItemsSource="{Binding Path=Descriptors}"
+ SelectedValue="{Binding Path=SelectedDescriptor}"
+ ItemTemplate="{StaticResource DescriptorTemplate}" />
\ No newline at end of file
diff --git a/src/Artemis.UI/PropertyInput/BrushPropertyInputViewModel.cs b/src/Artemis.UI/PropertyInput/BrushPropertyInputViewModel.cs
index 6fa40eae7..b5784fafb 100644
--- a/src/Artemis.UI/PropertyInput/BrushPropertyInputViewModel.cs
+++ b/src/Artemis.UI/PropertyInput/BrushPropertyInputViewModel.cs
@@ -8,8 +8,6 @@ using Artemis.Core.Plugins.LayerBrush;
using Artemis.Core.Services.Interfaces;
using Artemis.UI.Shared.PropertyInput;
using Artemis.UI.Shared.Services.Interfaces;
-using Artemis.UI.Shared.Utilities;
-using Stylet;
namespace Artemis.UI.PropertyInput
{
@@ -23,37 +21,32 @@ namespace Artemis.UI.PropertyInput
{
_layerService = layerService;
_pluginService = pluginService;
- ComboboxValues = new BindableCollection();
- _pluginService.PluginLoaded += PluginServiceOnPluginLoaded;
+ _pluginService.PluginEnabled += PluginServiceOnPluginLoaded;
+ _pluginService.PluginDisabled += PluginServiceOnPluginLoaded;
UpdateEnumValues();
}
- public BindableCollection ComboboxValues { get; }
+ public List Descriptors { get; set; }
+
+ public LayerBrushDescriptor SelectedDescriptor
+ {
+ get => Descriptors.FirstOrDefault(d => d.LayerBrushProvider.PluginInfo.Guid == InputValue?.BrushPluginGuid && d.LayerBrushType.Name == InputValue?.BrushType);
+ set => SetBrushByDescriptor(value);
+ }
public void UpdateEnumValues()
{
var layerBrushProviders = _pluginService.GetPluginsOfType();
- var descriptors = layerBrushProviders.SelectMany(l => l.LayerBrushDescriptors).ToList();
-
- var enumValues = new List();
- foreach (var layerBrushDescriptor in descriptors)
- {
- var brushName = layerBrushDescriptor.LayerBrushType.Name;
- var brushGuid = layerBrushDescriptor.LayerBrushProvider.PluginInfo.Guid;
- if (InputValue != null && InputValue.BrushType == brushName && InputValue.BrushPluginGuid == brushGuid)
- enumValues.Add(new ValueDescription {Description = layerBrushDescriptor.DisplayName, Value = InputValue});
- else
- enumValues.Add(new ValueDescription {Description = layerBrushDescriptor.DisplayName, Value = new LayerBrushReference {BrushType = brushName, BrushPluginGuid = brushGuid}});
- }
-
- ComboboxValues.Clear();
- ComboboxValues.AddRange(enumValues);
+ Descriptors = layerBrushProviders.SelectMany(l => l.LayerBrushDescriptors).ToList();
+ NotifyOfPropertyChange(nameof(SelectedDescriptor));
}
+
public override void Dispose()
{
- _pluginService.PluginLoaded -= PluginServiceOnPluginLoaded;
+ _pluginService.PluginEnabled -= PluginServiceOnPluginLoaded;
+ _pluginService.PluginDisabled -= PluginServiceOnPluginLoaded;
base.Dispose();
}
@@ -62,6 +55,11 @@ namespace Artemis.UI.PropertyInput
_layerService.InstantiateLayerBrush(LayerProperty.Layer);
}
+ private void SetBrushByDescriptor(LayerBrushDescriptor value)
+ {
+ InputValue = new LayerBrushReference {BrushPluginGuid = value.LayerBrushProvider.PluginInfo.Guid, BrushType = value.LayerBrushType.Name};
+ }
+
private void PluginServiceOnPluginLoaded(object sender, PluginEventArgs e)
{
UpdateEnumValues();
diff --git a/src/Artemis.UI/PropertyInput/EnumPropertyInputView.xaml b/src/Artemis.UI/PropertyInput/EnumPropertyInputView.xaml
index 92b18d134..5bd5961c1 100644
--- a/src/Artemis.UI/PropertyInput/EnumPropertyInputView.xaml
+++ b/src/Artemis.UI/PropertyInput/EnumPropertyInputView.xaml
@@ -12,6 +12,7 @@
Margin="0 2"
Padding="0 -1"
Height="15"
+ materialDesign:ComboBoxAssist.ClassicMode="True"
materialDesign:ValidationAssist.UsePopup="True"
HorizontalAlignment="Left"
ItemsSource="{Binding Path=EnumValues}"
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/LayerView.xaml b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/LayerView.xaml
index 2315ed732..bfba28b80 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/LayerView.xaml
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/LayerView.xaml
@@ -26,8 +26,14 @@
-
-
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/LayerViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/LayerViewModel.cs
index 6c693318d..4aa6ad26b 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/LayerViewModel.cs
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/LayerViewModel.cs
@@ -19,6 +19,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem
{
}
+ public Layer Layer => ProfileElement as Layer;
+ public bool ShowIcons => Layer?.LayerBrush != null;
public override bool SupportsChildren => false;
+
}
}
\ No newline at end of file
diff --git a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrushProvider.cs b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrushProvider.cs
index 760c3e6cd..814843b31 100644
--- a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrushProvider.cs
+++ b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrushProvider.cs
@@ -6,7 +6,7 @@ namespace Artemis.Plugins.LayerBrushes.Color
{
public override void EnablePlugin()
{
- AddLayerBrushDescriptor("Color", "A color with an (optional) gradient", "Brush");
+ AddLayerBrushDescriptor("Color", "A brush supporting solid colors and multiple types of gradients", "Brush");
}
public override void DisablePlugin()