UI - Added debugger log tab (#753)

This commit is contained in:
Diogo Trindade authored and GitHub committed 2023-02-01 19:46:37 +01:00
1 parent 425485b059
commit b493e43c6e
10 files changed
+174 -31

No files matched your search

@@ -66,6 +66,9 @@ public class EnumSwitchNode : Node
return;
Type enumType = SwitchValue.ConnectedTo[0].Type;
if (!enumType.IsEnum)
return;
foreach (Enum enumValue in Enum.GetValues(enumType).Cast<Enum>())
{
InputPin pin = CreateOrAddInputPin(typeof(object), enumValue.ToString().Humanize(LetterCasing.Sentence));
@@ -7,6 +7,7 @@ namespace Artemis.VisualScripting.Nodes.Color
[Node("Sorted Gradient", "Generates a sorted gradient from the given colors", "Color", InputType = typeof(SKColor), OutputType = typeof(ColorGradient))]
public class SortedGradientNode : Node
{
private int lastComputedColorGroup;
public InputPinCollection<SKColor> Inputs { get; }
public OutputPin<ColorGradient> Output { get; }
@@ -14,10 +15,15 @@ namespace Artemis.VisualScripting.Nodes.Color
{
Inputs = CreateInputPinCollection<SKColor>();
Output = CreateOutputPin<ColorGradient>();
lastComputedColorGroup = 0;
}
public override void Evaluate()
{
int newHash = GetInputColorHash();
if (newHash == lastComputedColorGroup)
return;
SKColor[] colors = Inputs.Values.ToArray();
if (colors.Length == 0)
@@ -35,6 +41,17 @@ namespace Artemis.VisualScripting.Nodes.Color
}
Output.Value = gradient;
lastComputedColorGroup = newHash;
}
private int GetInputColorHash()
{
int hash = 0;
foreach (SKColor color in Inputs.Values)
hash = HashCode.Combine(hash, color.GetHashCode());
return hash;
}
}
}