mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Basic implementation of a few editor tools
This commit is contained in:
1 parent
580db3185e
commit
8539f05d90
26 files changed
+634
-174
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Models.Profile.LayerShapes;
|
||||
using Artemis.Core.Models.Surface;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using SkiaSharp;
|
||||
@@ -72,6 +73,7 @@ namespace Artemis.Core.Models.Profile
|
||||
public Layer AddLayer(string name)
|
||||
{
|
||||
var layer = new Layer(Profile, this, name) {Order = Children.LastOrDefault()?.Order ?? 1};
|
||||
layer.LayerShape = new Fill(layer);
|
||||
AddChild(layer);
|
||||
return layer;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,8 @@ namespace Artemis.Core.Models.Profile
|
||||
set
|
||||
{
|
||||
_layerShape = value;
|
||||
_layerShape.CalculateRenderProperties();
|
||||
if (Path != null)
|
||||
_layerShape.CalculateRenderProperties();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,15 +147,18 @@ namespace Artemis.Core.Models.Profile
|
||||
LayerEntity.Condition.Clear();
|
||||
|
||||
// Brush
|
||||
LayerEntity.BrushEntity = new BrushEntity
|
||||
if (LayerBrush != null)
|
||||
{
|
||||
BrushPluginGuid = LayerBrush.Descriptor.LayerBrushProvider.PluginInfo.Guid,
|
||||
BrushType = LayerBrush.GetType().Name,
|
||||
Configuration = JsonConvert.SerializeObject(LayerBrush.Settings)
|
||||
};
|
||||
LayerEntity.BrushEntity = new BrushEntity
|
||||
{
|
||||
BrushPluginGuid = LayerBrush.Descriptor.LayerBrushProvider.PluginInfo.Guid,
|
||||
BrushType = LayerBrush.GetType().Name,
|
||||
Configuration = JsonConvert.SerializeObject(LayerBrush.Settings)
|
||||
};
|
||||
}
|
||||
|
||||
// Shape
|
||||
LayerShape.ApplyToEntity();
|
||||
LayerShape?.ApplyToEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -67,6 +67,11 @@ namespace Artemis.Core.Models.Profile
|
||||
}
|
||||
}
|
||||
|
||||
public Folder GetRootFolder()
|
||||
{
|
||||
return (Folder) Children.Single();
|
||||
}
|
||||
|
||||
internal override void ApplyToEntity()
|
||||
{
|
||||
ProfileEntity.Id = EntityId;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using AppDomainToolkit;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.Core.Exceptions;
|
||||
@@ -215,8 +216,19 @@ namespace Artemis.Core.Services
|
||||
}
|
||||
|
||||
// Get the Plugin implementation from the main assembly and if there is only one, instantiate it
|
||||
var mainAssembly = pluginInfo.Context.Domain.GetAssemblies().First(a => a.Location == mainFile);
|
||||
var pluginTypes = mainAssembly.GetTypes().Where(t => typeof(Plugin).IsAssignableFrom(t)).ToList();
|
||||
List<Type> pluginTypes;
|
||||
var mainAssembly = pluginInfo.Context.Domain.GetAssemblies().FirstOrDefault(a => a.Location == mainFile);
|
||||
if (mainAssembly == null)
|
||||
throw new ArtemisPluginException(pluginInfo, "Found no supported assembly in the plugins main file");
|
||||
try
|
||||
{
|
||||
pluginTypes = mainAssembly.GetTypes().Where(t => typeof(Plugin).IsAssignableFrom(t)).ToList();
|
||||
}
|
||||
catch (ReflectionTypeLoadException e)
|
||||
{
|
||||
throw new ArtemisPluginException(pluginInfo, "Failed to initialize the plugin assembly", new AggregateException(e.LoaderExceptions));
|
||||
}
|
||||
|
||||
if (pluginTypes.Count > 1)
|
||||
throw new ArtemisPluginException(pluginInfo, $"Plugin contains {pluginTypes.Count} implementations of Plugin, only 1 allowed");
|
||||
if (pluginTypes.Count == 0)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.Core.Plugins.Models;
|
||||
using Artemis.Core.RGB.NET;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using RGB.NET.Brushes;
|
||||
using RGB.NET.Brushes.Gradients;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Groups;
|
||||
using Serilog;
|
||||
@@ -30,7 +32,7 @@ namespace Artemis.Core.Services
|
||||
_targetFrameRateSetting = settingsService.GetSetting("Core.TargetFrameRate", 25);
|
||||
|
||||
Surface = RGBSurface.Instance;
|
||||
|
||||
|
||||
// Let's throw these for now
|
||||
Surface.Exception += SurfaceOnException;
|
||||
_renderScaleSetting.SettingChanged += RenderScaleSettingOnSettingChanged;
|
||||
@@ -104,7 +106,7 @@ namespace Artemis.Core.Services
|
||||
{
|
||||
// Apply the application wide brush and decorator
|
||||
BitmapBrush = new BitmapBrush(new Scale(_renderScaleSetting.Value));
|
||||
_surfaceLedGroup = new ListLedGroup(Surface.Leds) { Brush = BitmapBrush };
|
||||
_surfaceLedGroup = new ListLedGroup(Surface.Leds) {Brush = BitmapBrush};
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -115,11 +117,11 @@ namespace Artemis.Core.Services
|
||||
|
||||
// Apply the application wide brush and decorator
|
||||
BitmapBrush.Scale = new Scale(_renderScaleSetting.Value);
|
||||
_surfaceLedGroup = new ListLedGroup(Surface.Leds) { Brush = BitmapBrush };
|
||||
_surfaceLedGroup = new ListLedGroup(Surface.Leds) {Brush = BitmapBrush};
|
||||
}
|
||||
|
||||
lock (BitmapBrush)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user