From 70bf8824dbd64a22d16956476ddd3dda2235b0b8 Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 12 Apr 2021 23:36:35 +0200 Subject: [PATCH] Layer brushes & effects - Fix custom icon paths --- .../Plugins/LayerBrushes/LayerBrushProvider.cs | 2 ++ .../Plugins/LayerEffects/LayerEffectProvider.cs | 7 +++++-- .../ProfileEditor/LayerProperties/Tree/TreeGroupView.xaml | 4 ++++ .../Settings/Tabs/Plugins/PluginSettingsViewModel.cs | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Artemis.Core/Plugins/LayerBrushes/LayerBrushProvider.cs b/src/Artemis.Core/Plugins/LayerBrushes/LayerBrushProvider.cs index d99011fe3..c2cea1742 100644 --- a/src/Artemis.Core/Plugins/LayerBrushes/LayerBrushProvider.cs +++ b/src/Artemis.Core/Plugins/LayerBrushes/LayerBrushProvider.cs @@ -41,6 +41,8 @@ namespace Artemis.Core.LayerBrushes if (!IsEnabled) throw new ArtemisPluginException(Plugin, "Can only add a layer brush descriptor when the plugin is enabled"); + if (icon.ToLower().EndsWith(".svg")) + icon = Plugin.ResolveRelativePath(icon); LayerBrushDescriptor descriptor = new(displayName, description, icon, typeof(T), this); _layerBrushDescriptors.Add(descriptor); LayerBrushStore.Add(descriptor); diff --git a/src/Artemis.Core/Plugins/LayerEffects/LayerEffectProvider.cs b/src/Artemis.Core/Plugins/LayerEffects/LayerEffectProvider.cs index 28eadf5c9..b457bb90e 100644 --- a/src/Artemis.Core/Plugins/LayerEffects/LayerEffectProvider.cs +++ b/src/Artemis.Core/Plugins/LayerEffects/LayerEffectProvider.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.IO; namespace Artemis.Core.LayerEffects { @@ -33,14 +34,16 @@ namespace Artemis.Core.LayerEffects /// The name to display in the UI /// The description to display in the UI /// - /// The Material icon to display in the UI, a full reference can be found - /// here + /// The Material icon to display in the UI, a full reference can be found here. + /// May also be a path to an SVG file relative to the directory of the plugin. /// protected void RegisterLayerEffectDescriptor(string displayName, string description, string icon) where T : BaseLayerEffect { if (!IsEnabled) throw new ArtemisPluginFeatureException(this, "Can only add a layer effect descriptor when the plugin is enabled"); + if (icon.ToLower().EndsWith(".svg")) + icon = Plugin.ResolveRelativePath(icon); LayerEffectDescriptor descriptor = new(displayName, description, icon, typeof(T), this); _layerEffectDescriptors.Add(descriptor); LayerEffectStore.Add(descriptor); diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeGroupView.xaml b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeGroupView.xaml index 3ac1166d2..e80ebe39e 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeGroupView.xaml +++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeGroupView.xaml @@ -108,6 +108,8 @@ diff --git a/src/Artemis.UI/Screens/Settings/Tabs/Plugins/PluginSettingsViewModel.cs b/src/Artemis.UI/Screens/Settings/Tabs/Plugins/PluginSettingsViewModel.cs index 2eaa95dd0..fca3bb96e 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/Plugins/PluginSettingsViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/Plugins/PluginSettingsViewModel.cs @@ -171,7 +171,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins try { - await Task.Run(() => _pluginManagementService.EnablePlugin(Plugin, true)); + await Task.Run(() => _pluginManagementService.EnablePlugin(Plugin, true, true)); } catch (Exception e) {