Layer brushes - Make enable-disable process consistent with plugins

This commit is contained in:
SpoinkyNL committed 2020-06-07 15:00:40 +02:00
1 parent 6327107277
commit 33bb3ffa6c
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);
}
}
+3 -14
View File
@@ -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);
}
}
}