1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Noise brush - Added default values

Color brush - Added default values
UI - Replaced OnActivate overrides in screens with the more appropriate OnInitialActivate
Tray icon - Fixed empty window appearing for half a second on startup
This commit is contained in:
SpoinkyNL 2020-02-23 22:28:56 +01:00
parent 3ec90766aa
commit 8b95243a7c
10 changed files with 54 additions and 45 deletions

View File

@ -500,10 +500,10 @@ namespace Artemis.Core.Models.Profile
private void CreateDefaultProperties()
{
// Shape
var shape = new LayerProperty<object>(this, "Core.Shape", "Shape", "A collection of basic shape properties.");
ShapeTypeProperty = new LayerProperty<LayerShapeType>(this, shape, "Core.ShapeType", "Shape type", "The type of shape to draw in this layer.") {CanUseKeyframes = false};
FillTypeProperty = new LayerProperty<LayerFillType>(this, shape, "Core.FillType", "Fill type", "How to make the shape adjust to scale changes.") {CanUseKeyframes = false};
BlendModeProperty = new LayerProperty<SKBlendMode>(this, shape, "Core.BlendMode", "Blend mode", "How to blend this layer into the resulting image.") {CanUseKeyframes = false};
var shape = new LayerProperty<object>(this, "Core.Shape", "Shape", "A collection of basic shape properties");
ShapeTypeProperty = new LayerProperty<LayerShapeType>(this, shape, "Core.ShapeType", "Shape type", "The type of shape to draw in this layer") {CanUseKeyframes = false};
FillTypeProperty = new LayerProperty<LayerFillType>(this, shape, "Core.FillType", "Fill type", "How to make the shape adjust to scale changes") {CanUseKeyframes = false};
BlendModeProperty = new LayerProperty<SKBlendMode>(this, shape, "Core.BlendMode", "Blend mode", "How to blend this layer into the resulting image") {CanUseKeyframes = false};
ShapeTypeProperty.Value = LayerShapeType.Rectangle;
FillTypeProperty.Value = LayerFillType.Stretch;
BlendModeProperty.Value = SKBlendMode.SrcOver;
@ -513,20 +513,20 @@ namespace Artemis.Core.Models.Profile
RegisterLayerProperty(shapeProperty);
// Brush
var brush = new LayerProperty<object>(this, "Core.Brush", "Brush", "A collection of properties that configure the selected brush.");
BrushReferenceProperty = new LayerProperty<LayerBrushReference>(this, brush, "Core.BrushReference", "Brush type", "The type of brush to use for this layer.") {CanUseKeyframes = false};
var brush = new LayerProperty<object>(this, "Core.Brush", "Brush", "A collection of properties that configure the selected brush");
BrushReferenceProperty = new LayerProperty<LayerBrushReference>(this, brush, "Core.BrushReference", "Brush type", "The type of brush to use for this layer") {CanUseKeyframes = false};
RegisterLayerProperty(brush);
foreach (var brushProperty in brush.Children)
RegisterLayerProperty(brushProperty);
// Transform
var transform = new LayerProperty<object>(this, "Core.Transform", "Transform", "A collection of transformation properties.") {ExpandByDefault = true};
AnchorPointProperty = new LayerProperty<SKPoint>(this, transform, "Core.AnchorPoint", "Anchor Point", "The point at which the shape is attached to its position.") {InputStepSize = 0.001f};
PositionProperty = new LayerProperty<SKPoint>(this, transform, "Core.Position", "Position", "The position of the shape.") {InputStepSize = 0.001f};
ScaleProperty = new LayerProperty<SKSize>(this, transform, "Core.Scale", "Scale", "The scale of the shape.") {InputAffix = "%", MinInputValue = 0f};
RotationProperty = new LayerProperty<float>(this, transform, "Core.Rotation", "Rotation", "The rotation of the shape in degrees.") {InputAffix = "°"};
OpacityProperty = new LayerProperty<float>(this, transform, "Core.Opacity", "Opacity", "The opacity of the shape.") {InputAffix = "%", MinInputValue = 0f, MaxInputValue = 100f};
var transform = new LayerProperty<object>(this, "Core.Transform", "Transform", "A collection of transformation properties") {ExpandByDefault = true};
AnchorPointProperty = new LayerProperty<SKPoint>(this, transform, "Core.AnchorPoint", "Anchor Point", "The point at which the shape is attached to its position") {InputStepSize = 0.001f};
PositionProperty = new LayerProperty<SKPoint>(this, transform, "Core.Position", "Position", "The position of the shape") {InputStepSize = 0.001f};
ScaleProperty = new LayerProperty<SKSize>(this, transform, "Core.Scale", "Scale", "The scale of the shape") {InputAffix = "%", MinInputValue = 0f};
RotationProperty = new LayerProperty<float>(this, transform, "Core.Rotation", "Rotation", "The rotation of the shape in degrees") {InputAffix = "°"};
OpacityProperty = new LayerProperty<float>(this, transform, "Core.Opacity", "Opacity", "The opacity of the shape") {InputAffix = "%", MinInputValue = 0f, MaxInputValue = 100f};
ScaleProperty.Value = new SKSize(100, 100);
OpacityProperty.Value = 100;

View File

@ -18,8 +18,8 @@ namespace Artemis.Plugins.LayerBrushes.Color
public ColorBrush(Layer layer, LayerBrushDescriptor descriptor) : base(layer, descriptor)
{
ColorProperty = RegisterLayerProperty<SKColor>("Brush.Color", "Color", "The color of the brush.");
GradientTypeProperty = RegisterLayerProperty<GradientType>("Brush.GradientType", "Gradient type", "The scale of the noise.");
ColorProperty = RegisterLayerProperty("Brush.Color", "Color", "The color of the brush", new SKColor(255,0,0));
GradientTypeProperty = RegisterLayerProperty<GradientType>("Brush.GradientType", "Gradient type", "The type of color brush to draw");
GradientTypeProperty.CanUseKeyframes = false;
_testColors = new List<SKColor>();

View File

@ -28,17 +28,17 @@ namespace Artemis.Plugins.LayerBrushes.Noise
_z = Rand.Next(0, 4096);
_noise = new OpenSimplexNoise(Rand.Next(0, 4096));
MainColorProperty = RegisterLayerProperty<SKColor>("Brush.MainColor", "Main color", "The main color of the noise.");
SecondaryColorProperty = RegisterLayerProperty<SKColor>("Brush.SecondaryColor", "Secondary color", "The secondary color of the noise.");
ScaleProperty = RegisterLayerProperty<SKSize>("Brush.Scale", "Scale", "The scale of the noise.");
MainColorProperty = RegisterLayerProperty("Brush.MainColor", "Main color", "The main color of the noise", new SKColor(255, 0, 0));
SecondaryColorProperty = RegisterLayerProperty("Brush.SecondaryColor", "Secondary color", "The secondary color of the noise", new SKColor(0, 0, 255));
ScaleProperty = RegisterLayerProperty("Brush.Scale", "Scale", "The scale of the noise.", new SKSize(100, 100));
ScaleProperty.MinInputValue = 0f;
HardnessProperty = RegisterLayerProperty<float>("Brush.Hardness", "Hardness", "The hardness of the noise, lower means there are gradients in the noise, higher means hard lines..");
HardnessProperty = RegisterLayerProperty("Brush.Hardness", "Hardness", "The hardness of the noise, lower means there are gradients in the noise, higher means hard lines", 500f);
HardnessProperty.MinInputValue = 0f;
HardnessProperty.MaxInputValue = 2048f;
ScrollSpeedProperty = RegisterLayerProperty<SKPoint>("Brush.ScrollSpeed", "Movement speed", "The speed at which the noise moves vertically and horizontally.");
ScrollSpeedProperty = RegisterLayerProperty<SKPoint>("Brush.ScrollSpeed", "Movement speed", "The speed at which the noise moves vertically and horizontally");
ScrollSpeedProperty.MinInputValue = -64f;
ScrollSpeedProperty.MaxInputValue = 64f;
AnimationSpeedProperty = RegisterLayerProperty<float>("Brush.AnimationSpeed", "Animation speed", "The speed at which the noise moves.");
AnimationSpeedProperty = RegisterLayerProperty("Brush.AnimationSpeed", "Animation speed", "The speed at which the noise moves", 25f);
AnimationSpeedProperty.MinInputValue = 0f;
AnimationSpeedProperty.MaxInputValue = 64f;
ScaleProperty.InputAffix = "%";

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
@ -31,21 +32,29 @@ namespace Artemis.UI
protected override void Launch()
{
StartupArguments = Args.ToList();
var logger = Kernel.Get<ILogger>();
var windowManager = Kernel.Get<IWindowManager>();
windowManager.ShowWindow(RootViewModel);
var viewManager = Kernel.Get<IViewManager>();
Task.Run(() =>
Task.Run(async () =>
{
try
{
StartupArguments = Args.ToList();
if (StartupArguments.Contains("-autorun"))
{
logger.Information("Sleeping for 15 seconds on auto run to allow applications like iCUE and LGS to start");
await Task.Delay(TimeSpan.FromSeconds(15));
}
// Create and bind the root view, this is a tray icon so don't show it with the window manager
Execute.OnUIThread(() => viewManager.CreateAndBindViewForModelIfNecessary(RootViewModel));
// Start the Artemis core
_core = Kernel.Get<ICoreService>();
}
catch (Exception e)
{
var logger = Kernel.Get<ILogger>();
logger.Fatal(e, "Fatal exception during initialization, shutting down.");
// TODO: A proper exception viewer

View File

@ -1,8 +1,7 @@
{
"profiles": {
"Artemis.UI": {
"commandName": "Project",
"commandLineArgs": "-autorun"
"commandName": "Project"
}
}
}

View File

@ -120,19 +120,19 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
_profileEditorService.RedoUpdateProfile(Module);
}
protected override void OnActivate()
protected override void OnInitialActivate()
{
LoadWorkspaceSettings();
_profileEditorService.StopRegularRender();
Task.Run(LoadProfiles);
base.OnActivate();
base.OnInitialActivate();
}
protected override void OnDeactivate()
protected override void OnClose()
{
SaveWorkspaceSettings();
_profileEditorService.ResumeRegularRender();
base.OnDeactivate();
base.OnClose();
}
private void ChangeSelectedProfile(Profile profile)

View File

@ -114,7 +114,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
}
}
protected override void OnActivate()
protected override void OnInitialActivate()
{
HighlightSelectedLayer = _settingsService.GetSetting("ProfileEditor.HighlightSelectedLayer", true);
PauseRenderingOnFocusLoss = _settingsService.GetSetting("ProfileEditor.PauseRenderingOnFocusLoss", true);
@ -122,10 +122,10 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
HighlightSelectedLayer.SettingChanged += HighlightSelectedLayerOnSettingChanged;
_updateTrigger.Start();
base.OnActivate();
base.OnInitialActivate();
}
protected override void OnDeactivate()
protected override void OnClose()
{
HighlightSelectedLayer.Save();
PauseRenderingOnFocusLoss.Save();
@ -139,7 +139,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
// TODO: Remove when fixed in RGB.NET, or avoid double stopping
}
base.OnDeactivate();
base.OnClose();
}
private void CreateUpdateTrigger()

View File

@ -36,18 +36,18 @@ namespace Artemis.UI.Screens.Settings.Debug
GC.WaitForPendingFinalizers();
}
protected override void OnActivate()
protected override void OnInitialActivate()
{
_coreService.FrameRendered += CoreServiceOnFrameRendered;
_coreService.FrameRendering += CoreServiceOnFrameRendering;
base.OnActivate();
base.OnInitialActivate();
}
protected override void OnDeactivate()
protected override void OnClose()
{
_coreService.FrameRendered -= CoreServiceOnFrameRendered;
_coreService.FrameRendering -= CoreServiceOnFrameRendering;
base.OnDeactivate();
base.OnClose();
}
private void CoreServiceOnFrameRendered(object sender, FrameRenderedEventArgs e)

View File

@ -142,17 +142,17 @@ namespace Artemis.UI.Screens.SurfaceEditor
#region Overrides of Screen
protected override void OnActivate()
protected override void OnInitialActivate()
{
LoadSurfaceConfigurations();
LoadWorkspaceSettings();
base.OnActivate();
base.OnInitialActivate();
}
protected override void OnDeactivate()
protected override void OnClose()
{
SaveWorkspaceSettings();
base.OnDeactivate();
base.OnClose();
}
#endregion

View File

@ -1,4 +1,4 @@
<Window x:Class="Artemis.UI.Screens.TrayView"
<controls:MaterialWindow x:Class="Artemis.UI.Screens.TrayView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@ -6,6 +6,7 @@
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:controls="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions"
mc:Ignorable="d"
Title="Artemis"
Height="1"
@ -33,4 +34,4 @@
</ContextMenu>
</tb:TaskbarIcon.ContextMenu>
</tb:TaskbarIcon>
</Window>
</controls:MaterialWindow>