Noise brush - Added option to map noise to a gradient

Color brush - Only show gradient/color option when applicable
Gradient picker - Design tweaks
This commit is contained in:
SpoinkyNL committed 2020-04-17 19:16:53 +02:00
1 parent 5dea0b25e5
commit a8912076d3
10 files changed
+201 -82

No files matched your search

@@ -69,6 +69,18 @@ namespace Artemis.Core.Models.Profile
(byte) ((position - before.Position) * (after.Color.Alpha - before.Color.Alpha) / (after.Position - before.Position) + before.Color.Alpha)
);
}
/// <summary>
/// [PH] Looping through HSV, adds 8 rainbow colors
/// </summary>
public void MakeFabulous()
{
for (var i = 0; i < 9; i++)
{
var color = i != 8 ? SKColor.FromHsv(i * 32, 100, 100) : SKColor.FromHsv(0, 100, 100);
Stops.Add(new ColorGradientStop(color, 0.125f * i));
}
}
}
public class ColorGradientStop : INotifyPropertyChanged
+17 -2
View File
@@ -1,4 +1,5 @@
using System.IO;
using System;
using System.IO;
using Artemis.Core.Exceptions;
using Artemis.Core.Models.Profile.KeyframeEngines;
using Artemis.Core.Plugins.Models;
@@ -45,7 +46,21 @@ namespace Artemis.Core.Ninject
if (!Directory.Exists(Constants.DataFolder))
Directory.CreateDirectory(Constants.DataFolder);
return new LiteRepository(Constants.ConnectionString);
try
{
return new LiteRepository(Constants.ConnectionString);
}
catch (LiteException e)
{
// I don't like this way of error reporting, now I need to use reflection if I want a meaningful error code
if (e.ErrorCode != LiteException.INVALID_DATABASE)
throw new ArtemisCoreException($"LiteDB threw error code {e.ErrorCode}. See inner exception for more details", e);
// If the DB is invalid it's probably LiteDB v4 (TODO: we'll have to do something better later)
File.Delete($"{Constants.DataFolder}\\database.db");
return new LiteRepository(Constants.ConnectionString);
}
}).InSingletonScope();
// Bind all repositories as singletons
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.Core.Services.Interfaces;
@@ -76,15 +77,31 @@ namespace Artemis.Core.Plugins.LayerBrush
/// <returns>The layer property</returns>
protected LayerProperty<T> RegisterLayerProperty<T>(string id, string name, string description, T defaultValue = default)
{
var property = new LayerProperty<T>(
Layer, Descriptor.LayerBrushProvider.PluginInfo, Layer.Properties.BrushReference.Parent, id, name, description
) {Value = defaultValue};
var property = new LayerProperty<T>(Layer, Descriptor.LayerBrushProvider.PluginInfo, Layer.Properties.BrushReference.Parent, id, name, description)
{
Value = defaultValue
};
Layer.Properties.RegisterLayerProperty(property);
// It's fine if this is null, it'll be picked up by SetLayerService later
_layerService?.InstantiateKeyframeEngine(property);
return property;
}
/// <summary>
/// Allows you to remove layer properties previously added by using <see cref="RegisterLayerProperty{T}(BaseLayerProperty,string,string,string,T)" />.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="layerProperty"></param>
protected void UnRegisterLayerProperty<T>(LayerProperty<T> layerProperty)
{
if (layerProperty == null)
return;
if (Layer.Properties.Any(p => p == layerProperty))
Layer.Properties.RemoveLayerProperty(layerProperty);
}
internal void SetLayerService(ILayerService layerService)
{
_layerService = layerService;