diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/ILayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/ILayerProperty.cs index 9391c1027..52ae56bf1 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/ILayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/ILayerProperty.cs @@ -22,6 +22,11 @@ namespace Artemis.Core /// LayerPropertyGroup LayerPropertyGroup { get; } + /// + /// Gets or sets whether the property is hidden in the UI + /// + public bool IsHidden { get; set; } + /// /// Gets the data binding of this property /// diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs index d75e47af0..059707618 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs @@ -105,9 +105,7 @@ namespace Artemis.Core private bool _isHidden; - /// - /// Gets or sets whether the property is hidden in the UI - /// + /// public bool IsHidden { get => _isHidden; diff --git a/src/Artemis.Core/VisualScripting/NodeScript.cs b/src/Artemis.Core/VisualScripting/NodeScript.cs index 0094d8daa..faeac5616 100644 --- a/src/Artemis.Core/VisualScripting/NodeScript.cs +++ b/src/Artemis.Core/VisualScripting/NodeScript.cs @@ -178,9 +178,13 @@ namespace Artemis.Core Entity.Description = Description; Entity.Nodes.Clear(); - int id = 0; + + // No need to save the exit node if that's all there is + if (Nodes.Count() == 1) + return; - Dictionary nodes = new(); + int id = 0; + foreach (INode node in Nodes) { NodeEntity nodeEntity = new() @@ -208,7 +212,6 @@ namespace Artemis.Core } Entity.Nodes.Add(nodeEntity); - nodes.Add(node, id); id++; } @@ -216,20 +219,21 @@ namespace Artemis.Core Entity.Connections.Clear(); foreach (INode node in Nodes) { - SavePins(nodes, node, -1, node.Pins); + SavePins(node, -1, node.Pins); int pinCollectionId = 0; foreach (IPinCollection pinCollection in node.PinCollections) { - SavePins(nodes, node, pinCollectionId, pinCollection); + SavePins(node, pinCollectionId, pinCollection); pinCollectionId++; } } } - private void SavePins(Dictionary nodes, INode node, int collectionId, IEnumerable pins) + private void SavePins(INode node, int collectionId, IEnumerable pins) { int sourcePinId = 0; + List nodes = Nodes.ToList(); foreach (IPin sourcePin in pins.Where(p => p.Direction == PinDirection.Input)) { foreach (IPin targetPin in sourcePin.ConnectedTo) @@ -249,11 +253,11 @@ namespace Artemis.Core Entity.Connections.Add(new NodeConnectionEntity() { SourceType = sourcePin.Type.Name, - SourceNode = nodes[node], + SourceNode = nodes.IndexOf(node), SourcePinCollectionId = collectionId, SourcePinId = sourcePinId, TargetType = targetPin.Type.Name, - TargetNode = nodes[targetPin.Node], + TargetNode = nodes.IndexOf(targetPin.Node), TargetPinCollectionId = targetPinCollectionId, TargetPinId = targetPinId, }); diff --git a/src/Artemis.UI/Services/RegistrationService.cs b/src/Artemis.UI/Services/RegistrationService.cs index 5adbd456b..820ff6fd5 100644 --- a/src/Artemis.UI/Services/RegistrationService.cs +++ b/src/Artemis.UI/Services/RegistrationService.cs @@ -126,6 +126,7 @@ namespace Artemis.UI.Services _nodeService.RegisterTypeColor(Constants.CorePlugin, typeof(int), new SKColor(0xFF32CD32)); _nodeService.RegisterTypeColor(Constants.CorePlugin, typeof(double), new SKColor(0xFF1E90FF)); _nodeService.RegisterTypeColor(Constants.CorePlugin, typeof(float), new SKColor(0xFFFF7C00)); + _nodeService.RegisterTypeColor(Constants.CorePlugin, typeof(SKColor), new SKColor(0xFF7630C7)); _nodeService.RegisterTypeColor(Constants.CorePlugin, typeof(IList), new SKColor(0xFFC842FF)); foreach (Type nodeType in typeof(SumIntegersNode).Assembly.GetTypes().Where(t => typeof(INode).IsAssignableFrom(t) && t.IsPublic && !t.IsAbstract && !t.IsInterface)) diff --git a/src/Artemis.UI/packages.lock.json b/src/Artemis.UI/packages.lock.json index 4a5da0c7b..2a76c380f 100644 --- a/src/Artemis.UI/packages.lock.json +++ b/src/Artemis.UI/packages.lock.json @@ -535,8 +535,8 @@ }, "SkiaSharp": { "type": "Transitive", - "resolved": "2.80.2", - "contentHash": "D25rzdCwh+3L+XyXqpNa+H/yiLJbE3/R3K/XexwHyQjGdzZvSufFW3oqf3En7hhqSIsxsJ8f5NEZ0J5W5wlGBg==", + "resolved": "2.80.3", + "contentHash": "qX6tGNP3+MXNYe2pKm0PCRiJ/cx+LTeLaggwZifB7sUMXhECfKKKHJq45VqZKt37xQegnCCdf1jHXwmHeJQs5Q==", "dependencies": { "System.Memory": "4.5.3" } @@ -1484,6 +1484,7 @@ "Artemis.Core": "1.0.0", "Artemis.UI.Shared": "2.0.0", "JetBrains.Annotations": "2021.1.0", + "SkiaSharp": "2.80.3", "Stylet": "1.3.6" } } diff --git a/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj b/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj index 85b4c6b8e..987d69f58 100644 --- a/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj +++ b/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj @@ -37,6 +37,7 @@ + diff --git a/src/Artemis.VisualScripting/Editor/Styles/VisualScriptCablePresenter.xaml b/src/Artemis.VisualScripting/Editor/Styles/VisualScriptCablePresenter.xaml index 223a2b870..57770438c 100644 --- a/src/Artemis.VisualScripting/Editor/Styles/VisualScriptCablePresenter.xaml +++ b/src/Artemis.VisualScripting/Editor/Styles/VisualScriptCablePresenter.xaml @@ -3,14 +3,16 @@ xmlns:system="clr-namespace:System;assembly=System.Runtime" xmlns:controls="clr-namespace:Artemis.VisualScripting.Editor.Controls" xmlns:converters="clr-namespace:Artemis.VisualScripting.Converters" - xmlns:collections="clr-namespace:System.Collections;assembly=System.Runtime"> - + xmlns:collections="clr-namespace:System.Collections;assembly=System.Runtime" + xmlns:skiaSharp="clr-namespace:SkiaSharp;assembly=SkiaSharp" + xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"> + @@ -21,8 +23,8 @@ - @@ -36,26 +38,60 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + -