Nodes - Added categories

Nodes - Added quick node creation
Nodes - Added input and output types to NodeAttribute
This commit is contained in:
Robert committed 2021-08-26 22:09:04 +02:00
1 parent 73794591bc
commit c4340c3c97
29 files changed
+389 -82

No files matched your search

@@ -3,7 +3,7 @@ using SkiaSharp;
namespace Artemis.VisualScripting.Nodes.Color
{
[Node("Brighten Color", "Brightens a color by a specified amount in percent")]
[Node("Brighten Color", "Brightens a color by a specified amount in percent", "Color", InputType = typeof(SKColor), OutputType = typeof(SKColor))]
public class BrightenSKColorNode : Node
{
public BrightenSKColorNode() : base("Brighten Color", "Brightens a color by a specified amount in percent")
@@ -20,7 +20,7 @@ namespace Artemis.VisualScripting.Nodes.Color
public override void Evaluate()
{
Input.Value.ToHsl(out float h, out float s, out float l);
l *= (Percentage.Value + 100f) / 100f;
l += l * (Percentage.Value / 100f);
Output.Value = SKColor.FromHsl(h, s, l);
}
}
@@ -3,7 +3,7 @@ using SkiaSharp;
namespace Artemis.VisualScripting.Nodes.Color
{
[Node("Darken Color", "Darkens a color by a specified amount in percent")]
[Node("Darken Color", "Darkens a color by a specified amount in percent", "Color", InputType = typeof(SKColor), OutputType = typeof(SKColor))]
public class DarkenSKColorNode : Node
{
public DarkenSKColorNode() : base("Darken Color", "Darkens a color by a specified amount in percent")
@@ -20,7 +20,7 @@ namespace Artemis.VisualScripting.Nodes.Color
public override void Evaluate()
{
Input.Value.ToHsl(out float h, out float s, out float l);
l *= (Percentage.Value * -1 + 100f) / 100f;
l -= l * (Percentage.Value / 100f);
Output.Value = SKColor.FromHsl(h, s, l);
}
}
@@ -4,7 +4,7 @@ using SkiaSharp;
namespace Artemis.VisualScripting.Nodes.Color
{
[Node("Desaturate Color", "Desaturates a color by a specified amount in percent")]
[Node("Desaturate Color", "Desaturates a color by a specified amount in percent", "Color", InputType = typeof(SKColor), OutputType = typeof(SKColor))]
public class DesaturateSKColorNode : Node
{
public DesaturateSKColorNode() : base("Desaturate Color", "Desaturates a color by a specified amount in percent")
@@ -21,9 +21,8 @@ namespace Artemis.VisualScripting.Nodes.Color
public override void Evaluate()
{
Input.Value.ToHsl(out float h, out float s, out float l);
s -= Percentage.Value;
s = Math.Clamp(s, 0, 100);
Output.Value = SKColor.FromHsl(h, s, l);
s -= s * (Percentage.Value / 100f);
Output.Value = SKColor.FromHsl(h, Math.Clamp(s, 0f, 100f), l);
}
}
}
@@ -3,7 +3,7 @@ using SkiaSharp;
namespace Artemis.VisualScripting.Nodes.Color
{
[Node("HSL Color", "Creates a color from hue, saturation and lightness values")]
[Node("HSL Color", "Creates a color from hue, saturation and lightness values", "Color", InputType = typeof(float), OutputType = typeof(SKColor))]
public class HslSKColorNode : Node
{
public HslSKColorNode() : base("HSL Color", "Creates a color from hue, saturation and lightness values")
@@ -3,7 +3,7 @@ using SkiaSharp;
namespace Artemis.VisualScripting.Nodes.Color
{
[Node("Invert Color", "Inverts a color by a specified amount in percent")]
[Node("Invert Color", "Inverts a color by a specified amount in percent", "Color", InputType = typeof(SKColor), OutputType = typeof(SKColor))]
public class InvertSKColorNode : Node
{
public InvertSKColorNode() : base("Invert Color", "Inverts a color")
@@ -17,9 +17,12 @@ namespace Artemis.VisualScripting.Nodes.Color
public override void Evaluate()
{
Input.Value.ToHsl(out float h, out float s, out float l);
h += 180;
Output.Value = SKColor.FromHsl(h % 360, s, l);
Output.Value = new SKColor(
(byte) (255 - Input.Value.Red),
(byte) (255 - Input.Value.Green),
(byte) (255 - Input.Value.Blue),
Input.Value.Alpha
);
}
}
}
@@ -3,7 +3,7 @@ using SkiaSharp;
namespace Artemis.VisualScripting.Nodes.Color
{
[Node("Rotate Color Hue", "Rotates the hue of a color by a specified amount in degrees")]
[Node("Rotate Color Hue", "Rotates the hue of a color by a specified amount in degrees", "Color", InputType = typeof(SKColor), OutputType = typeof(SKColor))]
public class RotateHueSKColorNode : Node
{
public RotateHueSKColorNode() : base("Rotate Color Hue", "Rotates the hue of a color by a specified amount in degrees")
@@ -4,7 +4,7 @@ using SkiaSharp;
namespace Artemis.VisualScripting.Nodes.Color
{
[Node("Saturate Color", "Saturates a color by a specified amount in percent")]
[Node("Saturate Color", "Saturates a color by a specified amount in percent", "Color", InputType = typeof(SKColor), OutputType = typeof(SKColor))]
public class SaturateSKColorNode : Node
{
public SaturateSKColorNode() : base("Saturate Color", "Saturates a color by a specified amount in percent")
@@ -21,9 +21,8 @@ namespace Artemis.VisualScripting.Nodes.Color
public override void Evaluate()
{
Input.Value.ToHsl(out float h, out float s, out float l);
s += Percentage.Value;
s = Math.Clamp(s, 0, 100);
Output.Value = SKColor.FromHsl(h, s, l);
s += s * (Percentage.Value / 100f);
Output.Value = SKColor.FromHsl(h, Math.Clamp(s, 0f, 100f), l);
}
}
}
@@ -4,7 +4,7 @@ using SkiaSharp;
namespace Artemis.VisualScripting.Nodes.Color
{
[Node("Color-Value", "Outputs a configurable color value.")]
[Node("Color-Value", "Outputs a configurable color value.", "Static", InputType = typeof(SKColor), OutputType = typeof(SKColor))]
public class StaticSKColorValueNode : Node<StaticSKColorValueNodeCustomViewModel>
{
#region Constructors
@@ -3,7 +3,7 @@ using SkiaSharp;
namespace Artemis.VisualScripting.Nodes.Color
{
[Node("Sum (Color)", "Sums the connected color values.")]
[Node("Sum (Color)", "Sums the connected color values.", "Color", InputType = typeof(SKColor), OutputType = typeof(SKColor))]
public class SumSKColorsNode : Node
{
#region Properties & Fields