From 64decaf0c2e085c481f2032f572aa143839c0e11 Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 4 Feb 2023 23:32:14 +0100 Subject: [PATCH 1/6] Core - Refactor service registration pt 2 --- src/Artemis.Core/DryIoc/ContainerExtensions.cs | 2 +- src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs | 2 +- src/Artemis.UI/ArtemisBootstrapper.cs | 3 --- src/Artemis.UI/DryIoc/ContainerExtensions.cs | 4 ++-- src/Artemis.VisualScripting/DryIoc/ContainerExtensions.cs | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Artemis.Core/DryIoc/ContainerExtensions.cs b/src/Artemis.Core/DryIoc/ContainerExtensions.cs index 4f418d453..927f606a9 100644 --- a/src/Artemis.Core/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.Core/DryIoc/ContainerExtensions.cs @@ -13,7 +13,7 @@ namespace Artemis.Core.DryIoc; /// /// Provides an extension method to register services onto a DryIoc . /// -public static class CoreContainerExtensions +public static class ContainerExtensions { /// /// Registers core services into the container. diff --git a/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs b/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs index cb7baef36..4c4711b02 100644 --- a/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs @@ -7,7 +7,7 @@ namespace Artemis.UI.Shared.DryIoc; /// /// Provides an extension method to register services onto a DryIoc . /// -public static class UIContainerExtensions +public static class ContainerExtensions { /// /// Registers shared UI services into the container. diff --git a/src/Artemis.UI/ArtemisBootstrapper.cs b/src/Artemis.UI/ArtemisBootstrapper.cs index 1056070e1..1b47e8748 100644 --- a/src/Artemis.UI/ArtemisBootstrapper.cs +++ b/src/Artemis.UI/ArtemisBootstrapper.cs @@ -12,8 +12,6 @@ using Artemis.UI.Shared.DataModelPicker; using Artemis.UI.Shared.DryIoc; using Artemis.UI.Shared.Services; using Artemis.VisualScripting.DryIoc; -using Artemis.WebClient.Updating; -using Artemis.WebClient.Updating.DryIoc; using Avalonia; using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; @@ -44,7 +42,6 @@ public static class ArtemisBootstrapper _container.RegisterCore(); _container.RegisterUI(); _container.RegisterSharedUI(); - _container.RegisterUpdatingClient(); _container.RegisterNoStringEvaluating(); configureServices?.Invoke(_container); diff --git a/src/Artemis.UI/DryIoc/ContainerExtensions.cs b/src/Artemis.UI/DryIoc/ContainerExtensions.cs index f4c484bec..3e4caf226 100644 --- a/src/Artemis.UI/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.UI/DryIoc/ContainerExtensions.cs @@ -16,7 +16,7 @@ namespace Artemis.UI.DryIoc; /// /// Provides an extension method to register services onto a DryIoc . /// -public static class UIContainerExtensions +public static class ContainerExtensions { /// /// Registers UI services into the container. @@ -24,7 +24,7 @@ public static class UIContainerExtensions /// The builder building the current container public static void RegisterUI(this IContainer container) { - Assembly[] thisAssembly = {typeof(UIContainerExtensions).Assembly}; + Assembly[] thisAssembly = {typeof(ContainerExtensions).Assembly}; container.RegisterInstance(new AssetLoader(), IfAlreadyRegistered.Throw); container.Register(Reuse.Singleton); diff --git a/src/Artemis.VisualScripting/DryIoc/ContainerExtensions.cs b/src/Artemis.VisualScripting/DryIoc/ContainerExtensions.cs index 6e388f30d..0377f56ec 100644 --- a/src/Artemis.VisualScripting/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.VisualScripting/DryIoc/ContainerExtensions.cs @@ -13,7 +13,7 @@ namespace Artemis.VisualScripting.DryIoc; /// /// Provides an extension method to register services onto a DryIoc . /// -public static class UIContainerExtensions +public static class ContainerExtensions { /// /// Registers NoStringEvaluating services into the container. From 0200839a26300e4757005172bb1eaad8917da8a0 Mon Sep 17 00:00:00 2001 From: Diogo Trindade Date: Fri, 10 Feb 2023 11:06:52 +0000 Subject: [PATCH 2/6] Nodes - Added more HSV and HSL nodes --- .../Nodes/Color/HslSKColorNode.cs | 2 +- .../Nodes/Color/HsvSKColorNode.cs | 31 ++++++++++++++++ .../Nodes/Color/SkColorHsl.cs | 36 +++++++++++++++++++ .../Nodes/Color/SkColorHsv.cs | 36 +++++++++++++++++++ 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 src/Artemis.VisualScripting/Nodes/Color/HsvSKColorNode.cs create mode 100644 src/Artemis.VisualScripting/Nodes/Color/SkColorHsl.cs create mode 100644 src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs diff --git a/src/Artemis.VisualScripting/Nodes/Color/HslSKColorNode.cs b/src/Artemis.VisualScripting/Nodes/Color/HslSKColorNode.cs index cba686c38..15ce66d84 100644 --- a/src/Artemis.VisualScripting/Nodes/Color/HslSKColorNode.cs +++ b/src/Artemis.VisualScripting/Nodes/Color/HslSKColorNode.cs @@ -3,7 +3,7 @@ using SkiaSharp; namespace Artemis.VisualScripting.Nodes.Color; -[Node("HSL Color", "Creates a color from hue, saturation and lightness values", "Color", InputType = typeof(Numeric), OutputType = typeof(SKColor))] +[Node("HSL Color", "Creates a color from hue, saturation and lightness numbers", "Color", InputType = typeof(Numeric), OutputType = typeof(SKColor))] public class HslSKColorNode : Node { public HslSKColorNode() diff --git a/src/Artemis.VisualScripting/Nodes/Color/HsvSKColorNode.cs b/src/Artemis.VisualScripting/Nodes/Color/HsvSKColorNode.cs new file mode 100644 index 000000000..2544ccec2 --- /dev/null +++ b/src/Artemis.VisualScripting/Nodes/Color/HsvSKColorNode.cs @@ -0,0 +1,31 @@ +using Artemis.Core; +using SkiaSharp; + +namespace Artemis.VisualScripting.Nodes.Color; + +[Node("HSV Color", "Creates a color from hue, saturation and value numbers", "Color", InputType = typeof(Numeric), OutputType = typeof(SKColor))] +public class HsvSKColorNode : Node +{ + public HsvSKColorNode() + { + H = CreateInputPin("H"); + S = CreateInputPin("S"); + V = CreateInputPin("V"); + Output = CreateOutputPin(); + } + + public InputPin H { get; set; } + public InputPin S { get; set; } + public InputPin V { get; set; } + public OutputPin Output { get; } + + #region Overrides of Node + + /// + public override void Evaluate() + { + Output.Value = SKColor.FromHsv(H.Value, S.Value, V.Value); + } + + #endregion +} \ No newline at end of file diff --git a/src/Artemis.VisualScripting/Nodes/Color/SkColorHsl.cs b/src/Artemis.VisualScripting/Nodes/Color/SkColorHsl.cs new file mode 100644 index 000000000..aaa1c6e26 --- /dev/null +++ b/src/Artemis.VisualScripting/Nodes/Color/SkColorHsl.cs @@ -0,0 +1,36 @@ +using Artemis.Core; +using SkiaSharp; + +namespace Artemis.VisualScripting.Nodes.Color; + +[Node("Color to HSL", "Outputs H, S and L values from a color", "Color", InputType = typeof(SKColor), OutputType = typeof(Numeric))] +public class SkColorHsl : Node +{ + + public SkColorHsl() + { + Input = CreateInputPin(); + H = CreateOutputPin("H"); + S = CreateOutputPin("S"); + L = CreateOutputPin("L"); + } + + public InputPin Input { get; } + public OutputPin H { get; } + public OutputPin S { get; } + public OutputPin L { get; } + + #region Overrides of Node + + /// + public override void Evaluate() + { + Input.Value.ToHsl(out float h, out float s, out float l); + + H.Value = h; + S.Value = s; + L.Value = l; + } + + #endregion +} \ No newline at end of file diff --git a/src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs b/src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs new file mode 100644 index 000000000..95a2dffb1 --- /dev/null +++ b/src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs @@ -0,0 +1,36 @@ +using Artemis.Core; +using SkiaSharp; + +namespace Artemis.VisualScripting.Nodes.Color; + +[Node("Color to Hsv", "Outputs H, S and L values from a color", "Color", InputType = typeof(SKColor), OutputType = typeof(Numeric))] +public class SkColorHsv : Node +{ + + public SkColorHsv() + { + Input = CreateInputPin(); + H = CreateOutputPin("H"); + S = CreateOutputPin("S"); + V = CreateOutputPin("V"); + } + + public InputPin Input { get; } + public OutputPin H { get; } + public OutputPin S { get; } + public OutputPin V { get; } + + #region Overrides of Node + + /// + public override void Evaluate() + { + Input.Value.ToHsv(out float h, out float s, out float v); + + H.Value = h; + S.Value = s; + V.Value = v; + } + + #endregion +} \ No newline at end of file From f1c5b2c14f6120fed517f6c746882a4c5edb3e46 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 12 Feb 2023 17:44:03 +0100 Subject: [PATCH 3/6] Updated RGB.NET to stay in sync with plugins --- src/Artemis.Core/Artemis.Core.csproj | 6 +++--- src/Artemis.UI.Shared/Artemis.UI.Shared.csproj | 2 +- src/Artemis.UI/Artemis.UI.csproj | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj index df21cdfd2..ee57c4987 100644 --- a/src/Artemis.Core/Artemis.Core.csproj +++ b/src/Artemis.Core/Artemis.Core.csproj @@ -42,9 +42,9 @@ - - - + + + diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj index 09c2d5479..c8f440c29 100644 --- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj +++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj @@ -20,7 +20,7 @@ - + diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj index bf4ce5d0c..a9446ed2c 100644 --- a/src/Artemis.UI/Artemis.UI.csproj +++ b/src/Artemis.UI/Artemis.UI.csproj @@ -31,8 +31,8 @@ - - + + From 968b365a2935551d3efddb71a4bcb7ea5415866c Mon Sep 17 00:00:00 2001 From: Robert Date: Sun, 12 Feb 2023 21:27:46 +0100 Subject: [PATCH 4/6] Node editor - Fixed a crash when duplicating nodes with pin collections --- .../Services/NodeEditor/Commands/DuplicateNode.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Artemis.UI.Shared/Services/NodeEditor/Commands/DuplicateNode.cs b/src/Artemis.UI.Shared/Services/NodeEditor/Commands/DuplicateNode.cs index 8c60677b6..62340d3a6 100644 --- a/src/Artemis.UI.Shared/Services/NodeEditor/Commands/DuplicateNode.cs +++ b/src/Artemis.UI.Shared/Services/NodeEditor/Commands/DuplicateNode.cs @@ -56,7 +56,7 @@ public class DuplicateNode : INodeEditorCommand, IDisposable if (targetCollection == null) continue; while (targetCollection.Count() < sourceCollection.Count()) - targetCollection.CreatePin(); + targetCollection.Add(targetCollection.CreatePin()); } // Copy the storage From 7a5c018a3f9ea8c9e317bebaa5eee1ec250305b2 Mon Sep 17 00:00:00 2001 From: Robert Date: Sun, 12 Feb 2023 21:31:25 +0100 Subject: [PATCH 5/6] HSV Node - Fix name --- src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs b/src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs index 95a2dffb1..a0e448cf4 100644 --- a/src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs +++ b/src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs @@ -3,7 +3,7 @@ using SkiaSharp; namespace Artemis.VisualScripting.Nodes.Color; -[Node("Color to Hsv", "Outputs H, S and L values from a color", "Color", InputType = typeof(SKColor), OutputType = typeof(Numeric))] +[Node("Color to HSV", "Outputs H, S and L values from a color", "Color", InputType = typeof(SKColor), OutputType = typeof(Numeric))] public class SkColorHsv : Node { From 8dea510eb63ec39702b51e96dc9fe0f55927c911 Mon Sep 17 00:00:00 2001 From: RobertBeekman Date: Mon, 13 Feb 2023 15:52:23 +0100 Subject: [PATCH 6/6] To Numeric Node - Support converting booleans to numeric --- .../Nodes/Conversion/ConvertToNumericNode.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Artemis.VisualScripting/Nodes/Conversion/ConvertToNumericNode.cs b/src/Artemis.VisualScripting/Nodes/Conversion/ConvertToNumericNode.cs index 8a4190098..0dcfb6e1b 100644 --- a/src/Artemis.VisualScripting/Nodes/Conversion/ConvertToNumericNode.cs +++ b/src/Artemis.VisualScripting/Nodes/Conversion/ConvertToNumericNode.cs @@ -1,4 +1,4 @@ -using Artemis.Core; +using Artemis.Core; namespace Artemis.VisualScripting.Nodes.Conversion; @@ -33,6 +33,7 @@ public class ConvertToNumericNode : Node double input => new Numeric(input), float input => new Numeric(input), byte input => new Numeric(input), + bool input => new Numeric(input ? 1 : 0), _ => TryParse(Input.Value) }; } @@ -44,4 +45,4 @@ public class ConvertToNumericNode : Node } #endregion -} \ No newline at end of file +}