mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Nuget - Updated packages
Brush properties - Added default values Brush properties - Removed option to always auto-expand groups Layer properties - Remember expanded/collapsed groups Storage - Added migration system Storage - Added migration that removes profiles made in the old layer properties format Layer timeline - Added back zoom functionality
This commit is contained in:
parent
221c8bc7e7
commit
dd000e7bed
@ -21,11 +21,11 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Ben.Demystifier" Version="0.1.6" />
|
||||
<PackageReference Include="Castle.Core" Version="4.4.0" />
|
||||
<PackageReference Include="Castle.Core" Version="4.4.1" />
|
||||
<PackageReference Include="FastMember" Version="1.5.0" />
|
||||
<PackageReference Include="HidSharp" Version="2.1.0" />
|
||||
<PackageReference Include="LiteDB" Version="5.0.7" />
|
||||
<PackageReference Include="McMaster.NETCore.Plugins" Version="1.2.0" />
|
||||
<PackageReference Include="LiteDB" Version="5.0.8" />
|
||||
<PackageReference Include="McMaster.NETCore.Plugins" Version="1.3.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Ninject" Version="3.3.4" />
|
||||
<PackageReference Include="Ninject.Extensions.ChildKernel" Version="3.3.0" />
|
||||
@ -35,8 +35,8 @@
|
||||
<PackageReference Include="Serilog.Enrichers.Demystify" Version="1.0.0-dev-00019" />
|
||||
<PackageReference Include="Serilog.Sinks.Debug" Version="1.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
|
||||
<PackageReference Include="SkiaSharp" Version="1.68.2-preview.29" />
|
||||
<PackageReference Include="Stylet" Version="1.3.1" />
|
||||
<PackageReference Include="SkiaSharp" Version="1.68.3" />
|
||||
<PackageReference Include="Stylet" Version="1.3.2" />
|
||||
<PackageReference Include="System.Buffers" Version="4.5.0" />
|
||||
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
|
||||
<PackageReference Include="System.Reflection.Metadata" Version="1.8.0" />
|
||||
|
||||
@ -65,15 +65,19 @@ namespace Artemis.Core.Models.Profile.Colors
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [PH] Looping through HSV, adds 8 rainbow colors
|
||||
/// Gets a new ColorGradient with colors looping through the HSV-spectrum
|
||||
/// </summary>
|
||||
public void MakeFabulous()
|
||||
/// <returns></returns>
|
||||
public static ColorGradient GetUnicornBarf()
|
||||
{
|
||||
var gradient = new ColorGradient();
|
||||
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));
|
||||
gradient.Stops.Add(new ColorGradientStop(color, 0.125f * i));
|
||||
}
|
||||
|
||||
return gradient;
|
||||
}
|
||||
|
||||
#region PropertyChanged
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Media.Animation;
|
||||
using Artemis.Core.Extensions;
|
||||
using Artemis.Core.Models.Profile.LayerProperties;
|
||||
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
||||
@ -22,6 +21,7 @@ namespace Artemis.Core.Models.Profile
|
||||
/// </summary>
|
||||
public sealed class Layer : ProfileElement
|
||||
{
|
||||
private readonly List<string> _expandedPropertyGroups;
|
||||
private LayerShape _layerShape;
|
||||
private List<ArtemisLed> _leds;
|
||||
private SKPath _path;
|
||||
@ -38,6 +38,8 @@ namespace Artemis.Core.Models.Profile
|
||||
Transform = new LayerTransformProperties {IsCorePropertyGroup = true};
|
||||
|
||||
_leds = new List<ArtemisLed>();
|
||||
_expandedPropertyGroups = new List<string>();
|
||||
|
||||
General.PropertyGroupInitialized += GeneralOnPropertyGroupInitialized;
|
||||
}
|
||||
|
||||
@ -54,6 +56,9 @@ namespace Artemis.Core.Models.Profile
|
||||
Transform = new LayerTransformProperties {IsCorePropertyGroup = true};
|
||||
|
||||
_leds = new List<ArtemisLed>();
|
||||
_expandedPropertyGroups = new List<string>();
|
||||
_expandedPropertyGroups.AddRange(layerEntity.ExpandedPropertyGroups);
|
||||
|
||||
General.PropertyGroupInitialized += GeneralOnPropertyGroupInitialized;
|
||||
}
|
||||
|
||||
@ -99,10 +104,10 @@ namespace Artemis.Core.Models.Profile
|
||||
}
|
||||
}
|
||||
|
||||
[PropertyGroupDescription(Name = "General", Description = "A collection of general properties", ExpandByDefault = true)]
|
||||
[PropertyGroupDescription(Name = "General", Description = "A collection of general properties")]
|
||||
public LayerGeneralProperties General { get; set; }
|
||||
|
||||
[PropertyGroupDescription(Name = "Transform", Description = "A collection of transformation properties", ExpandByDefault = true)]
|
||||
[PropertyGroupDescription(Name = "Transform", Description = "A collection of transformation properties")]
|
||||
public LayerTransformProperties Transform { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@ -115,6 +120,19 @@ namespace Artemis.Core.Models.Profile
|
||||
return $"[Layer] {nameof(Name)}: {Name}, {nameof(Order)}: {Order}";
|
||||
}
|
||||
|
||||
public bool IsPropertyGroupExpanded(LayerPropertyGroup layerPropertyGroup)
|
||||
{
|
||||
return _expandedPropertyGroups.Contains(layerPropertyGroup.Path);
|
||||
}
|
||||
|
||||
public void SetPropertyGroupExpanded(LayerPropertyGroup layerPropertyGroup, bool expanded)
|
||||
{
|
||||
if (!expanded && IsPropertyGroupExpanded(layerPropertyGroup))
|
||||
_expandedPropertyGroups.Remove(layerPropertyGroup.Path);
|
||||
else if (expanded && !IsPropertyGroupExpanded(layerPropertyGroup))
|
||||
_expandedPropertyGroups.Add(layerPropertyGroup.Path);
|
||||
}
|
||||
|
||||
#region Storage
|
||||
|
||||
internal override void ApplyToEntity()
|
||||
@ -125,6 +143,8 @@ namespace Artemis.Core.Models.Profile
|
||||
LayerEntity.Order = Order;
|
||||
LayerEntity.Name = Name;
|
||||
LayerEntity.ProfileId = Profile.EntityId;
|
||||
LayerEntity.ExpandedPropertyGroups.Clear();
|
||||
LayerEntity.ExpandedPropertyGroups.AddRange(_expandedPropertyGroups);
|
||||
|
||||
General.ApplyToEntity();
|
||||
Transform.ApplyToEntity();
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using Artemis.Core.Models.Profile.LayerProperties;
|
||||
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
||||
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
||||
using Artemis.Core.Models.Profile.LayerProperties.Types;
|
||||
using SkiaSharp;
|
||||
|
||||
@ -19,17 +18,15 @@ namespace Artemis.Core.Models.Profile
|
||||
[PropertyDescription(Name = "Brush type", Description = "The type of brush to use for this layer")]
|
||||
public LayerBrushReferenceLayerProperty BrushReference { get; set; }
|
||||
|
||||
protected override void PopulateDefaults()
|
||||
{
|
||||
ShapeType.DefaultValue = LayerShapeType.Rectangle;
|
||||
FillType.DefaultValue = LayerFillType.Stretch;
|
||||
BlendMode.DefaultValue = SKBlendMode.SrcOver;
|
||||
}
|
||||
|
||||
protected override void OnPropertiesInitialized()
|
||||
{
|
||||
// Populate defaults
|
||||
if (!ShapeType.IsLoadedFromStorage)
|
||||
ShapeType.BaseValue = LayerShapeType.Rectangle;
|
||||
if (!FillType.IsLoadedFromStorage)
|
||||
FillType.BaseValue = LayerFillType.Stretch;
|
||||
if (!BlendMode.IsLoadedFromStorage)
|
||||
BlendMode.BaseValue = SKBlendMode.SrcOver;
|
||||
|
||||
// TODO: SpoinkyNL 28-4-2020: Select preferred default brush type with a fallback to the first available
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -141,5 +141,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public abstract void ApplyDefaultValue();
|
||||
}
|
||||
}
|
||||
@ -55,6 +55,12 @@ namespace Artemis.Core.Models.Profile.LayerProperties
|
||||
internal set => _currentValue = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the default value of this layer property. If set, this value is automatically applied if the property has no
|
||||
/// value in storage
|
||||
/// </summary>
|
||||
public T DefaultValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a read-only list of all the keyframes on this layer property
|
||||
/// </summary>
|
||||
@ -275,5 +281,10 @@ namespace Artemis.Core.Models.Profile.LayerProperties
|
||||
EasingFunction = (int) k.EasingFunction
|
||||
}));
|
||||
}
|
||||
|
||||
public override void ApplyDefaultValue()
|
||||
{
|
||||
CurrentValue = DefaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.Models.Profile.Colors;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
|
||||
namespace Artemis.Core.Models.Profile.LayerProperties.Types
|
||||
{
|
||||
@ -11,6 +12,18 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Types
|
||||
KeyframesSupported = false;
|
||||
}
|
||||
|
||||
internal override void ApplyToLayerProperty(PropertyEntity entity, LayerPropertyGroup layerPropertyGroup, bool fromStorage)
|
||||
{
|
||||
base.ApplyToLayerProperty(entity, layerPropertyGroup, fromStorage);
|
||||
|
||||
// Don't allow color gradients to be null
|
||||
if (BaseValue == null)
|
||||
{
|
||||
BaseValue = DefaultValue ?? new ColorGradient();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased)
|
||||
{
|
||||
throw new ArtemisCoreException("Color Gradients do not support keyframes.");
|
||||
|
||||
@ -13,11 +13,11 @@ using Artemis.Storage.Entities.Profile;
|
||||
|
||||
namespace Artemis.Core.Models.Profile
|
||||
{
|
||||
public class LayerPropertyGroup
|
||||
public abstract class LayerPropertyGroup
|
||||
{
|
||||
private ReadOnlyCollection<BaseLayerProperty> _allLayerProperties;
|
||||
private readonly List<BaseLayerProperty> _layerProperties;
|
||||
private readonly List<LayerPropertyGroup> _layerPropertyGroups;
|
||||
private ReadOnlyCollection<BaseLayerProperty> _allLayerProperties;
|
||||
|
||||
protected LayerPropertyGroup()
|
||||
{
|
||||
@ -30,6 +30,11 @@ namespace Artemis.Core.Models.Profile
|
||||
/// </summary>
|
||||
public Layer Layer { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The path of this property group
|
||||
/// </summary>
|
||||
public string Path { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// The parent group of this layer property group, set after construction
|
||||
/// </summary>
|
||||
@ -61,10 +66,39 @@ namespace Artemis.Core.Models.Profile
|
||||
public ReadOnlyCollection<LayerPropertyGroup> LayerPropertyGroups => _layerPropertyGroups.AsReadOnly();
|
||||
|
||||
/// <summary>
|
||||
/// Called when all layer properties in this property group have been initialized
|
||||
/// Recursively gets all layer properties on this group and any subgroups
|
||||
/// </summary>
|
||||
protected virtual void OnPropertiesInitialized()
|
||||
/// <returns></returns>
|
||||
public IReadOnlyCollection<BaseLayerProperty> GetAllLayerProperties()
|
||||
{
|
||||
if (!PropertiesInitialized)
|
||||
return new List<BaseLayerProperty>();
|
||||
if (_allLayerProperties != null)
|
||||
return _allLayerProperties;
|
||||
|
||||
var result = new List<BaseLayerProperty>(LayerProperties);
|
||||
foreach (var layerPropertyGroup in LayerPropertyGroups)
|
||||
result.AddRange(layerPropertyGroup.GetAllLayerProperties());
|
||||
|
||||
_allLayerProperties = result.AsReadOnly();
|
||||
return _allLayerProperties;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called before properties are fully initialized to allow you to populate
|
||||
/// <see cref="LayerProperty{T}.DefaultValue" /> on the properties you want
|
||||
/// </summary>
|
||||
protected abstract void PopulateDefaults();
|
||||
|
||||
/// <summary>
|
||||
/// Called when all layer properties in this property group have been initialized, you may access all properties on the
|
||||
/// group here
|
||||
/// </summary>
|
||||
protected abstract void OnPropertiesInitialized();
|
||||
|
||||
protected virtual void OnPropertyGroupInitialized()
|
||||
{
|
||||
PropertyGroupInitialized?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
internal void InitializeProperties(ILayerService layerService, Layer layer, [NotNull] string path)
|
||||
@ -76,6 +110,7 @@ namespace Artemis.Core.Models.Profile
|
||||
throw new ArtemisCoreException("Layer property group already initialized, wut");
|
||||
|
||||
Layer = layer;
|
||||
Path = path.TrimEnd('.');
|
||||
|
||||
// Get all properties with a PropertyDescriptionAttribute
|
||||
foreach (var propertyInfo in GetType().GetProperties())
|
||||
@ -110,9 +145,12 @@ namespace Artemis.Core.Models.Profile
|
||||
}
|
||||
}
|
||||
|
||||
PopulateDefaults();
|
||||
foreach (var layerProperty in _layerProperties.Where(p => !p.IsLoadedFromStorage))
|
||||
layerProperty.ApplyDefaultValue();
|
||||
|
||||
OnPropertiesInitialized();
|
||||
PropertiesInitialized = true;
|
||||
|
||||
OnPropertyGroupInitialized();
|
||||
}
|
||||
|
||||
@ -152,25 +190,6 @@ namespace Artemis.Core.Models.Profile
|
||||
OnPropertyGroupOverriding(new PropertyGroupUpdatingEventArgs(overrideTime));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recursively gets all layer properties on this group and any subgroups
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IReadOnlyCollection<BaseLayerProperty> GetAllLayerProperties()
|
||||
{
|
||||
if (!PropertiesInitialized)
|
||||
return new List<BaseLayerProperty>();
|
||||
if (_allLayerProperties != null)
|
||||
return _allLayerProperties;
|
||||
|
||||
var result = new List<BaseLayerProperty>(LayerProperties);
|
||||
foreach (var layerPropertyGroup in LayerPropertyGroups)
|
||||
result.AddRange(layerPropertyGroup.GetAllLayerProperties());
|
||||
|
||||
_allLayerProperties = result.AsReadOnly();
|
||||
return _allLayerProperties;
|
||||
}
|
||||
|
||||
private void InitializeProperty(Layer layer, string path, BaseLayerProperty instance)
|
||||
{
|
||||
var pluginGuid = IsCorePropertyGroup || instance.IsCoreProperty ? Constants.CorePluginInfo.Guid : layer.LayerBrush.PluginInfo.Guid;
|
||||
@ -203,10 +222,5 @@ namespace Artemis.Core.Models.Profile
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected virtual void OnPropertyGroupInitialized()
|
||||
{
|
||||
PropertyGroupInitialized?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,4 @@
|
||||
using Artemis.Core.Models.Profile.LayerProperties;
|
||||
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
||||
using Artemis.Core.Models.Profile.LayerProperties.Attributes;
|
||||
using Artemis.Core.Models.Profile.LayerProperties.Types;
|
||||
using SkiaSharp;
|
||||
|
||||
@ -22,13 +21,14 @@ namespace Artemis.Core.Models.Profile
|
||||
[PropertyDescription(Description = "The opacity of the shape", InputAffix = "%", MinInputValue = 0f, MaxInputValue = 100f)]
|
||||
public FloatLayerProperty Opacity { get; set; }
|
||||
|
||||
protected override void PopulateDefaults()
|
||||
{
|
||||
Scale.DefaultValue = new SKSize(100, 100);
|
||||
Opacity.DefaultValue = 100;
|
||||
}
|
||||
|
||||
protected override void OnPropertiesInitialized()
|
||||
{
|
||||
// Populate defaults
|
||||
if (!Scale.IsLoadedFromStorage)
|
||||
Scale.BaseValue = new SKSize(100, 100);
|
||||
if (!Opacity.IsLoadedFromStorage)
|
||||
Opacity.BaseValue = 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -131,5 +131,10 @@ namespace Artemis.Core.Models.Profile
|
||||
/// Applies the profile element's properties to the underlying storage entity
|
||||
/// </summary>
|
||||
internal abstract void ApplyToEntity();
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{nameof(EntityId)}: {EntityId}, {nameof(Order)}: {Order}, {nameof(Name)}: {Name}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,8 @@
|
||||
using Artemis.Core.Exceptions;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Storage;
|
||||
using Artemis.Storage.Migrations.Interfaces;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
using LiteDB;
|
||||
using Ninject.Activation;
|
||||
@ -60,6 +62,18 @@ namespace Artemis.Core.Ninject
|
||||
}
|
||||
}).InSingletonScope();
|
||||
|
||||
Kernel.Bind<StorageMigrationService>().ToSelf().InSingletonScope();
|
||||
|
||||
// Bind all migrations as singletons
|
||||
Kernel.Bind(x =>
|
||||
{
|
||||
x.FromAssemblyContaining<IStorageMigration>()
|
||||
.SelectAllClasses()
|
||||
.InheritedFrom<IStorageMigration>()
|
||||
.BindAllInterfaces()
|
||||
.Configure(c => c.InSingletonScope());
|
||||
});
|
||||
|
||||
// Bind all repositories as singletons
|
||||
Kernel.Bind(x =>
|
||||
{
|
||||
|
||||
@ -9,6 +9,8 @@ using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Core.Services.Storage.Interfaces;
|
||||
using Artemis.Storage;
|
||||
using Artemis.Storage.Migrations.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
using RGB.NET.Core;
|
||||
using Serilog;
|
||||
@ -30,8 +32,9 @@ namespace Artemis.Core.Services
|
||||
private List<Module> _modules;
|
||||
private PluginSetting<LogEventLevel> _loggingLevel;
|
||||
|
||||
internal CoreService(ILogger logger, ISettingsService settingsService, IPluginService pluginService, IRgbService rgbService,
|
||||
ISurfaceService surfaceService, IProfileService profileService)
|
||||
// ReSharper disable once UnusedParameter.Local - Storage migration service is injected early to ensure it runs before anything else
|
||||
internal CoreService(ILogger logger, StorageMigrationService _, ISettingsService settingsService, IPluginService pluginService,
|
||||
IRgbService rgbService, ISurfaceService surfaceService, IProfileService profileService)
|
||||
{
|
||||
_logger = logger;
|
||||
_pluginService = pluginService;
|
||||
@ -48,6 +51,7 @@ namespace Artemis.Core.Services
|
||||
_pluginService.PluginEnabled += (sender, args) => _modules = _pluginService.GetPluginsOfType<Module>();
|
||||
_pluginService.PluginDisabled += (sender, args) => _modules = _pluginService.GetPluginsOfType<Module>();
|
||||
|
||||
|
||||
ConfigureJsonConvert();
|
||||
}
|
||||
|
||||
|
||||
@ -100,11 +100,13 @@ namespace Artemis.Core.Services.Storage
|
||||
|
||||
public void DeleteProfile(Profile profile)
|
||||
{
|
||||
_logger.Debug("Removing profile " + profile);
|
||||
_profileRepository.Remove(profile.ProfileEntity);
|
||||
}
|
||||
|
||||
public void UpdateProfile(Profile profile, bool includeChildren)
|
||||
{
|
||||
_logger.Debug("Updating profile " + profile);
|
||||
var memento = JsonConvert.SerializeObject(profile.ProfileEntity);
|
||||
profile.RedoStack.Clear();
|
||||
profile.UndoStack.Push(memento);
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
<LangVersion>7</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LiteDB" Version="5.0.7" />
|
||||
<PackageReference Include="LiteDB" Version="5.0.8" />
|
||||
<PackageReference Include="Serilog" Version="2.9.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -11,6 +11,7 @@ namespace Artemis.Storage.Entities.Profile
|
||||
Leds = new List<LedEntity>();
|
||||
PropertyEntities = new List<PropertyEntity>();
|
||||
Condition = new List<ProfileConditionEntity>();
|
||||
ExpandedPropertyGroups = new List<string>();
|
||||
}
|
||||
|
||||
public Guid Id { get; set; }
|
||||
@ -22,6 +23,7 @@ namespace Artemis.Storage.Entities.Profile
|
||||
public List<LedEntity> Leds { get; set; }
|
||||
public List<PropertyEntity> PropertyEntities { get; set; }
|
||||
public List<ProfileConditionEntity> Condition { get; set; }
|
||||
public List<string> ExpandedPropertyGroups { get; set; }
|
||||
|
||||
[BsonRef("ProfileEntity")]
|
||||
public ProfileEntity Profile { get; set; }
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Artemis.Storage.Migrations.Interfaces;
|
||||
using LiteDB;
|
||||
|
||||
namespace Artemis.Storage.Migrations
|
||||
{
|
||||
public class AttributeBasedPropertiesMigration : IStorageMigration
|
||||
{
|
||||
public int UserVersion => 1;
|
||||
public void Apply(LiteRepository repository)
|
||||
{
|
||||
if (repository.Database.CollectionExists("ProfileEntity"))
|
||||
repository.Database.DropCollection("ProfileEntity");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
using LiteDB;
|
||||
|
||||
namespace Artemis.Storage.Migrations.Interfaces
|
||||
{
|
||||
public interface IStorageMigration
|
||||
{
|
||||
int UserVersion { get; }
|
||||
void Apply(LiteRepository repository);
|
||||
}
|
||||
}
|
||||
38
src/Artemis.Storage/StorageMigrationService.cs
Normal file
38
src/Artemis.Storage/StorageMigrationService.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Storage.Migrations.Interfaces;
|
||||
using LiteDB;
|
||||
using Serilog;
|
||||
|
||||
namespace Artemis.Storage
|
||||
{
|
||||
public class StorageMigrationService
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly LiteRepository _repository;
|
||||
private readonly List<IStorageMigration> _migrations;
|
||||
|
||||
public StorageMigrationService(ILogger logger, LiteRepository repository, List<IStorageMigration> migrations)
|
||||
{
|
||||
_logger = logger;
|
||||
_repository = repository;
|
||||
_migrations = migrations;
|
||||
|
||||
ApplyPendingMigrations();
|
||||
}
|
||||
|
||||
public void ApplyPendingMigrations()
|
||||
{
|
||||
foreach (var storageMigration in _migrations.OrderBy(m => m.UserVersion))
|
||||
{
|
||||
if (_repository.Database.UserVersion >= storageMigration.UserVersion)
|
||||
continue;
|
||||
|
||||
_logger.Information("Applying storage migration {storageMigration} to update DB from v{oldVersion} to v{newVersion}",
|
||||
storageMigration.GetType().Name, _repository.Database.UserVersion, storageMigration.UserVersion);
|
||||
storageMigration.Apply(_repository);
|
||||
_repository.Database.UserVersion = storageMigration.UserVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -20,15 +20,15 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AvalonEdit" Version="6.0.1" />
|
||||
<PackageReference Include="Humanizer.Core" Version="2.7.9" />
|
||||
<PackageReference Include="MaterialDesignExtensions" Version="3.0.0" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="3.1.0" />
|
||||
<PackageReference Include="Humanizer.Core" Version="2.8.11" />
|
||||
<PackageReference Include="MaterialDesignExtensions" Version="3.1.0" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="3.1.3" />
|
||||
<PackageReference Include="Ninject" Version="3.3.4" />
|
||||
<PackageReference Include="Ninject.Extensions.Conventions" Version="3.3.0" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="3.2.8" />
|
||||
<PackageReference Include="SkiaSharp" Version="1.68.2-preview.29" />
|
||||
<PackageReference Include="SkiaSharp.Views.WPF" Version="1.68.2-preview.29" />
|
||||
<PackageReference Include="Stylet" Version="1.3.1" />
|
||||
<PackageReference Include="SkiaSharp" Version="1.68.3" />
|
||||
<PackageReference Include="SkiaSharp.Views.WPF" Version="1.68.3" />
|
||||
<PackageReference Include="Stylet" Version="1.3.2" />
|
||||
<PackageReference Include="System.Buffers" Version="4.5.0" />
|
||||
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" />
|
||||
|
||||
@ -115,21 +115,21 @@
|
||||
<Resource Include="Resources\Cursors\aero_rotate.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Castle.Core" Version="4.4.0" />
|
||||
<PackageReference Include="Castle.Core" Version="4.4.1" />
|
||||
<PackageReference Include="FluentValidation" Version="8.6.2" />
|
||||
<PackageReference Include="gong-wpf-dragdrop" Version="2.2.0" />
|
||||
<PackageReference Include="Hardcodet.NotifyIcon.Wpf.NetCore" Version="1.0.10" />
|
||||
<PackageReference Include="Humanizer.Core" Version="2.7.9" />
|
||||
<PackageReference Include="MaterialDesignExtensions" Version="3.0.0" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="3.1.0" />
|
||||
<PackageReference Include="Humanizer.Core" Version="2.8.11" />
|
||||
<PackageReference Include="MaterialDesignExtensions" Version="3.1.0" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="3.1.3" />
|
||||
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.19" />
|
||||
<PackageReference Include="Ninject" Version="3.3.4" />
|
||||
<PackageReference Include="Ninject.Extensions.Conventions" Version="3.3.0" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="3.2.8" />
|
||||
<PackageReference Include="Serilog" Version="2.9.0" />
|
||||
<PackageReference Include="SkiaSharp.Views.WPF" Version="1.68.2-preview.29" />
|
||||
<PackageReference Include="Stylet" Version="1.3.1" />
|
||||
<PackageReference Include="SkiaSharp.Views.WPF" Version="1.68.3" />
|
||||
<PackageReference Include="Stylet" Version="1.3.2" />
|
||||
<PackageReference Include="System.Buffers" Version="4.5.0" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
|
||||
|
||||
@ -12,7 +12,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract
|
||||
Children = new List<LayerPropertyBaseViewModel>();
|
||||
}
|
||||
|
||||
public bool IsExpanded { get; set; }
|
||||
public virtual bool IsExpanded { get; set; }
|
||||
public abstract bool IsVisible { get; }
|
||||
|
||||
public List<LayerPropertyBaseViewModel> Children { get; set; }
|
||||
|
||||
@ -160,7 +160,7 @@
|
||||
<!-- Time -->
|
||||
<timeline:PropertyTimelineHeader Margin="0 25 0 0"
|
||||
Fill="{DynamicResource MaterialDesignBody}"
|
||||
PixelsPerSecond="{Binding PixelsPerSecond}"
|
||||
PixelsPerSecond="{Binding ProfileEditorService.PixelsPerSecond}"
|
||||
HorizontalOffset="{Binding ContentHorizontalOffset, ElementName=TimelineHeaderScrollViewer}"
|
||||
VisibleWidth="{Binding ActualWidth, ElementName=TimelineHeaderScrollViewer}"
|
||||
Width="{Binding ActualWidth, ElementName=PropertyTimeLine}" />
|
||||
@ -198,13 +198,12 @@
|
||||
Background="{DynamicResource MaterialDesignCardBackground}">
|
||||
<!-- Zoom control -->
|
||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding PixelsPerSecond}" VerticalAlignment="Center" />
|
||||
<Slider Orientation="Horizontal"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="10"
|
||||
Minimum="31"
|
||||
Maximum="350"
|
||||
Value="{Binding PixelsPerSecond}"
|
||||
Value="{Binding ProfileEditorService.PixelsPerSecond}"
|
||||
Width="319" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
@ -54,6 +54,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
||||
|
||||
ProfileEditorService.ProfileElementSelected += ProfileEditorServiceOnProfileElementSelected;
|
||||
ProfileEditorService.CurrentTimeChanged += ProfileEditorServiceOnCurrentTimeChanged;
|
||||
ProfileEditorService.PixelsPerSecondChanged += ProfileEditorServiceOnPixelsPerSecondChanged;
|
||||
|
||||
base.OnInitialActivate();
|
||||
}
|
||||
@ -62,6 +63,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
||||
{
|
||||
ProfileEditorService.ProfileElementSelected -= ProfileEditorServiceOnProfileElementSelected;
|
||||
ProfileEditorService.CurrentTimeChanged -= ProfileEditorServiceOnCurrentTimeChanged;
|
||||
ProfileEditorService.PixelsPerSecondChanged -= ProfileEditorServiceOnPixelsPerSecondChanged;
|
||||
|
||||
base.OnClose();
|
||||
}
|
||||
@ -83,6 +85,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
||||
NotifyOfPropertyChange(() => TimeCaretPosition);
|
||||
}
|
||||
|
||||
private void ProfileEditorServiceOnPixelsPerSecondChanged(object? sender, EventArgs e)
|
||||
{
|
||||
NotifyOfPropertyChange(nameof(TimeCaretPosition));
|
||||
}
|
||||
|
||||
#region View model managament
|
||||
|
||||
private void PopulateProperties(ProfileElement profileElement)
|
||||
|
||||
@ -18,7 +18,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
||||
|
||||
LayerPropertyGroup = layerPropertyGroup;
|
||||
PropertyGroupDescription = propertyGroupDescription;
|
||||
IsExpanded = PropertyGroupDescription.ExpandByDefault;
|
||||
|
||||
TreePropertyGroupViewModel = new TreePropertyGroupViewModel(this);
|
||||
TimelinePropertyGroupViewModel = new TimelinePropertyGroupViewModel(this);
|
||||
@ -26,6 +25,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
||||
PopulateChildren();
|
||||
}
|
||||
|
||||
public override bool IsExpanded
|
||||
{
|
||||
get => LayerPropertyGroup.Layer.IsPropertyGroupExpanded(LayerPropertyGroup);
|
||||
set => LayerPropertyGroup.Layer.SetPropertyGroupExpanded(LayerPropertyGroup, value);
|
||||
}
|
||||
|
||||
public override bool IsVisible => !LayerPropertyGroup.IsHidden;
|
||||
|
||||
public IProfileEditorService ProfileEditorService { get; }
|
||||
|
||||
@ -19,6 +19,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
||||
LayerPropertyViewModel.LayerProperty.KeyframeAdded += LayerPropertyOnKeyframeModified;
|
||||
LayerPropertyViewModel.LayerProperty.KeyframeRemoved += LayerPropertyOnKeyframeModified;
|
||||
LayerPropertyViewModel.LayerProperty.KeyframesToggled += LayerPropertyOnKeyframeModified;
|
||||
_profileEditorService.PixelsPerSecondChanged += ProfileEditorServiceOnPixelsPerSecondChanged;
|
||||
}
|
||||
|
||||
private void LayerPropertyOnKeyframeModified(object sender, EventArgs e)
|
||||
@ -26,6 +27,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
||||
UpdateKeyframes();
|
||||
}
|
||||
|
||||
private void ProfileEditorServiceOnPixelsPerSecondChanged(object? sender, EventArgs e)
|
||||
{
|
||||
foreach (var timelineKeyframeViewModel in TimelineKeyframeViewModels)
|
||||
timelineKeyframeViewModel.Update(_profileEditorService.PixelsPerSecond);
|
||||
}
|
||||
|
||||
public LayerPropertyViewModel<T> LayerPropertyViewModel { get; }
|
||||
|
||||
public override void UpdateKeyframes()
|
||||
@ -55,6 +62,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
_profileEditorService.PixelsPerSecondChanged -= ProfileEditorServiceOnPixelsPerSecondChanged;
|
||||
LayerPropertyViewModel.LayerProperty.KeyframeAdded -= LayerPropertyOnKeyframeModified;
|
||||
LayerPropertyViewModel.LayerProperty.KeyframeRemoved -= LayerPropertyOnKeyframeModified;
|
||||
LayerPropertyViewModel.LayerProperty.KeyframesToggled -= LayerPropertyOnKeyframeModified;
|
||||
|
||||
@ -82,6 +82,8 @@
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<TreeView ItemsSource="{Binding LayerPropertyGroups}"
|
||||
VirtualizingStackPanel.IsVirtualizing="True"
|
||||
VirtualizingStackPanel.VirtualizationMode="Recycling"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
Background="{DynamicResource MaterialDesignToolBarBackground}"
|
||||
PreviewMouseWheel="{s:Action PropertyTreePreviewMouseWheel}"
|
||||
|
||||
@ -17,9 +17,9 @@
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid Width="{Binding Device.RgbDevice.ActualSize.Width}" Height="{Binding Device.RgbDevice.ActualSize.Height}">
|
||||
<Grid.LayoutTransform>
|
||||
<Grid.RenderTransform>
|
||||
<RotateTransform Angle="{Binding Device.Rotation}" />
|
||||
</Grid.LayoutTransform>
|
||||
</Grid.RenderTransform>
|
||||
|
||||
<!-- Device image with fallback -->
|
||||
<Image VerticalAlignment="Stretch"
|
||||
|
||||
@ -22,9 +22,9 @@
|
||||
<Grid>
|
||||
<!-- Content -->
|
||||
<Grid Width="{Binding Device.RgbDevice.ActualSize.Width}" Height="{Binding Device.RgbDevice.ActualSize.Height}">
|
||||
<Grid.LayoutTransform>
|
||||
<Grid.RenderTransform>
|
||||
<RotateTransform Angle="{Binding Device.Rotation}" />
|
||||
</Grid.LayoutTransform>
|
||||
</Grid.RenderTransform>
|
||||
|
||||
<controls:DeviceVisualizer Device="{Binding Device}"/>
|
||||
|
||||
|
||||
@ -78,7 +78,6 @@ namespace Artemis.UI.Services
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public LayerPropertyBaseViewModel CreateLayerPropertyViewModel(BaseLayerProperty baseLayerProperty, PropertyDescriptionAttribute propertyDescription)
|
||||
{
|
||||
// Go through the pain of instantiating a generic type VM now via reflection to make things a lot simpler down the line
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MaterialDesignThemes" Version="3.1.0" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="3.1.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Artemis.Core\Artemis.Core.csproj">
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||
|
||||
namespace Artemis.Plugins.Devices.DMX.ViewModels
|
||||
@ -11,7 +8,6 @@ namespace Artemis.Plugins.Devices.DMX.ViewModels
|
||||
public DMXConfigurationViewModel(Plugin plugin) : base(plugin)
|
||||
{
|
||||
var dmxInstance = RGB.NET.Devices.DMX.DMXDeviceProvider.Instance;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@ -2,8 +2,6 @@
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Roccat;
|
||||
|
||||
namespace Artemis.Plugins.Devices.Roccat
|
||||
{
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.IO;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using RGB.NET.Core;
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MaterialDesignThemes" Version="3.1.0" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="3.1.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Artemis.Core\Artemis.Core.csproj">
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@ -14,7 +14,6 @@ namespace Artemis.Plugins.Devices.WS281X
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
public class WS281XDeviceProvider : DeviceProvider
|
||||
{
|
||||
public PluginSettings Settings { get; }
|
||||
private readonly IRgbService _rgbService;
|
||||
|
||||
public WS281XDeviceProvider(PluginInfo pluginInfo, IRgbService rgbService, PluginSettings settings) : base(pluginInfo, RGB.NET.Devices.WS281X.WS281XDeviceProvider.Instance)
|
||||
@ -24,6 +23,8 @@ namespace Artemis.Plugins.Devices.WS281X
|
||||
HasConfigurationViewModel = true;
|
||||
}
|
||||
|
||||
public PluginSettings Settings { get; }
|
||||
|
||||
public override void EnablePlugin()
|
||||
{
|
||||
var definitions = Settings.GetSetting<List<DeviceDefinition>>("DeviceDefinitions");
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SkiaSharp" Version="1.68.2-preview.29" />
|
||||
<PackageReference Include="SkiaSharp" Version="1.68.3" />
|
||||
<PackageReference Include="System.Buffers" Version="4.5.0" />
|
||||
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" />
|
||||
|
||||
@ -19,19 +19,15 @@ namespace Artemis.Plugins.LayerBrushes.Color
|
||||
[PropertyDescription(Description = "The gradient of the brush")]
|
||||
public ColorGradientLayerProperty Gradient { get; set; }
|
||||
|
||||
protected override void OnPropertiesInitialized()
|
||||
protected override void PopulateDefaults()
|
||||
{
|
||||
// Populate defaults
|
||||
if (!GradientType.IsLoadedFromStorage)
|
||||
GradientType.BaseValue = LayerBrushes.Color.GradientType.Solid;
|
||||
if (!Color.IsLoadedFromStorage)
|
||||
Color.BaseValue = new SKColor(255, 0, 0);
|
||||
if (!Gradient.IsLoadedFromStorage)
|
||||
{
|
||||
Gradient.BaseValue = new ColorGradient();
|
||||
Gradient.BaseValue.MakeFabulous();
|
||||
GradientType.DefaultValue = LayerBrushes.Color.GradientType.Solid;
|
||||
Color.DefaultValue = new SKColor(255, 0, 0);
|
||||
Gradient.DefaultValue = ColorGradient.GetUnicornBarf();
|
||||
}
|
||||
|
||||
protected override void OnPropertiesInitialized()
|
||||
{
|
||||
GradientType.BaseValueChanged += GradientTypeOnBaseValueChanged;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@ -23,8 +23,8 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SkiaSharp" Version="1.68.2-preview.29" />
|
||||
<PackageReference Include="Stylet" Version="1.3.1" />
|
||||
<PackageReference Include="SkiaSharp" Version="1.68.3" />
|
||||
<PackageReference Include="Stylet" Version="1.3.2" />
|
||||
<PackageReference Include="System.Buffers" Version="4.5.0" />
|
||||
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" />
|
||||
|
||||
@ -34,26 +34,18 @@ namespace Artemis.Plugins.LayerBrushes.Noise
|
||||
[PropertyDescription(Description = "The speed at which the noise moves", MinInputValue = 0f, MaxInputValue = 64f)]
|
||||
public FloatLayerProperty AnimationSpeed { get; set; }
|
||||
|
||||
protected override void OnPropertiesInitialized()
|
||||
protected override void PopulateDefaults()
|
||||
{
|
||||
// Populate defaults
|
||||
if (!MainColor.IsLoadedFromStorage)
|
||||
MainColor.BaseValue = new SKColor(255, 0, 0);
|
||||
if (!SecondaryColor.IsLoadedFromStorage)
|
||||
SecondaryColor.BaseValue = new SKColor(0, 0, 255);
|
||||
if (!GradientColor.IsLoadedFromStorage)
|
||||
{
|
||||
GradientColor.BaseValue = new ColorGradient();
|
||||
GradientColor.BaseValue.MakeFabulous();
|
||||
MainColor.DefaultValue = new SKColor(255, 0, 0);
|
||||
SecondaryColor.DefaultValue = new SKColor(0, 0, 255);
|
||||
GradientColor.DefaultValue = ColorGradient.GetUnicornBarf();
|
||||
Scale.DefaultValue = new SKSize(100, 100);
|
||||
Hardness.DefaultValue = 500f;
|
||||
AnimationSpeed.DefaultValue = 25f;
|
||||
}
|
||||
|
||||
if (!Scale.IsLoadedFromStorage)
|
||||
Scale.BaseValue = new SKSize(100, 100);
|
||||
if (!Hardness.IsLoadedFromStorage)
|
||||
Hardness.BaseValue = 500f;
|
||||
if (!AnimationSpeed.IsLoadedFromStorage)
|
||||
AnimationSpeed.BaseValue = 25f;
|
||||
|
||||
protected override void OnPropertiesInitialized()
|
||||
{
|
||||
ColorType.BaseValueChanged += ColorTypeOnBaseValueChanged;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
@ -23,8 +23,8 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SkiaSharp" Version="1.68.2-preview.29" />
|
||||
<PackageReference Include="Stylet" Version="1.3.1" />
|
||||
<PackageReference Include="SkiaSharp" Version="1.68.3" />
|
||||
<PackageReference Include="Stylet" Version="1.3.2" />
|
||||
<PackageReference Include="System.Buffers" Version="4.5.0" />
|
||||
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" />
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Abstract.DataModels;
|
||||
using Artemis.Core.Plugins.Abstract.DataModels.Attributes;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.Plugins.Modules.General
|
||||
{
|
||||
@ -24,14 +23,14 @@ namespace Artemis.Plugins.Modules.General
|
||||
|
||||
public class PlayerInfo : DataModel
|
||||
{
|
||||
public PlayerInfo(Module module) : base(module)
|
||||
{
|
||||
}
|
||||
|
||||
[DataModelProperty(Name = "A test string", Description = "This is a test string that's not of any use outside testing!")]
|
||||
public string TestString { get; set; }
|
||||
|
||||
[DataModelProperty(Name = "A test boolean", Description = "This is a test boolean that's not of any use outside testing!")]
|
||||
public bool TestBoolean { get; set; }
|
||||
|
||||
public PlayerInfo(Module module) : base(module)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user