1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Layer brushes & effects - Fix custom icon paths

This commit is contained in:
Robert 2021-04-12 23:36:35 +02:00
parent 8d75d0dd8c
commit 70bf8824db
4 changed files with 12 additions and 3 deletions

View File

@ -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);

View File

@ -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
/// <param name="displayName">The name to display in the UI</param>
/// <param name="description">The description to display in the UI</param>
/// <param name="icon">
/// The Material icon to display in the UI, a full reference can be found
/// <see href="https://materialdesignicons.com">here</see>
/// The Material icon to display in the UI, a full reference can be found <see href="https://materialdesignicons.com">here</see>.
/// <para>May also be a path to an SVG file relative to the directory of the plugin.</para>
/// </param>
protected void RegisterLayerEffectDescriptor<T>(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);

View File

@ -108,6 +108,8 @@
</Grid.Style>
<shared:ArtemisIcon Grid.Column="0"
Icon="{Binding LayerPropertyGroup.LayerBrush.Descriptor.Icon}"
Width="16"
Height="16"
Margin="0 5 5 0" />
<TextBlock Grid.Column="1"
ToolTip="{Binding LayerPropertyGroup.LayerBrush.Descriptor.Description}"
@ -156,6 +158,8 @@
Grid.Column="0"
Cursor="SizeNS"
Icon="{Binding LayerPropertyGroup.LayerEffect.Descriptor.Icon}"
Width="16"
Height="16"
Margin="0 5 5 0"
Background="Transparent" />
<TextBlock Grid.Column="1" ToolTip="{Binding LayerPropertyGroup.LayerEffect.Descriptor.Description}" Margin="0 5 0 0">

View File

@ -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)
{