mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Layer brushes - Make enable-disable process consistent with plugins
This commit is contained in:
1 parent
a1c2e4ad5a
commit
ee37c3b836
37 files changed
+325
-128
No files matched your search
@@ -22,11 +22,5 @@ namespace Artemis.Core.Services.Interfaces
|
||||
/// <param name="layer">The layer to instantiate the brush for</param>
|
||||
/// <returns></returns>
|
||||
BaseLayerBrush InstantiateLayerBrush(Layer layer);
|
||||
|
||||
/// <summary>
|
||||
/// Removes the layer brush from the provided layer and disposes it
|
||||
/// </summary>
|
||||
/// <param name="layer"></param>
|
||||
void RemoveLayerBrush(Layer layer);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.LayerBrush;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Ninject;
|
||||
@@ -40,8 +41,8 @@ namespace Artemis.Core.Services
|
||||
|
||||
public BaseLayerBrush InstantiateLayerBrush(Layer layer)
|
||||
{
|
||||
RemoveLayerBrush(layer);
|
||||
|
||||
layer.DeactivateLayerBrush();
|
||||
|
||||
var descriptorReference = layer.General.BrushReference?.CurrentValue;
|
||||
if (descriptorReference == null)
|
||||
return null;
|
||||
@@ -66,17 +67,5 @@ namespace Artemis.Core.Services
|
||||
layer.OnLayerBrushUpdated();
|
||||
return layer.LayerBrush;
|
||||
}
|
||||
|
||||
public void RemoveLayerBrush(Layer layer)
|
||||
{
|
||||
if (layer.LayerBrush == null)
|
||||
return;
|
||||
|
||||
var brush = layer.LayerBrush;
|
||||
layer.LayerBrush = null;
|
||||
brush.Dispose();
|
||||
|
||||
layer.LayerEntity.PropertyEntities.RemoveAll(p => p.PluginGuid == brush.PluginInfo.Guid);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user