|
@@ -37,6 +37,25 @@ public static class NodeOperations
|
|
|
{
|
|
|
List<IChangeInfo> changes = new();
|
|
|
|
|
|
+ if (structureNode.Background.Connection != null)
|
|
|
+ {
|
|
|
+ // connect connection to next input if possible
|
|
|
+
|
|
|
+ var connections = structureNode.Output.Connections.ToArray();
|
|
|
+
|
|
|
+ var output = structureNode.Background.Connection;
|
|
|
+
|
|
|
+ foreach (var input in connections)
|
|
|
+ {
|
|
|
+ output.ConnectTo(input);
|
|
|
+ changes.Add(new ConnectProperty_ChangeInfo(output.Node.Id, input.Node.Id,
|
|
|
+ output.InternalPropertyName, input.InternalPropertyName));
|
|
|
+ }
|
|
|
+
|
|
|
+ structureNode.Background.Connection.DisconnectFrom(structureNode.Background);
|
|
|
+ changes.Add(new ConnectProperty_ChangeInfo(null, structureNode.Id, null,
|
|
|
+ structureNode.Background.InternalPropertyName));
|
|
|
+ }
|
|
|
|
|
|
var outputs = structureNode.Output.Connections.ToArray();
|
|
|
foreach (var outputConnection in outputs)
|
|
@@ -46,19 +65,35 @@ public static class NodeOperations
|
|
|
outputConnection.InternalPropertyName));
|
|
|
}
|
|
|
|
|
|
- if (structureNode.Background.Connection != null)
|
|
|
+ return changes;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static List<IChangeInfo> ConnectStructureNodeProperties(List<IInputProperty> originalOutputConnections,
|
|
|
+ List<(IInputProperty, IOutputProperty?)> originalInputConnections, StructureNode node)
|
|
|
+ {
|
|
|
+ List<IChangeInfo> changes = new();
|
|
|
+ foreach (var connection in originalOutputConnections)
|
|
|
{
|
|
|
- // connect connection to next input if possible
|
|
|
+ node.Output.ConnectTo(connection);
|
|
|
+ changes.Add(new ConnectProperty_ChangeInfo(node.Id, connection.Node.Id, node.Output.InternalPropertyName,
|
|
|
+ connection.InternalPropertyName));
|
|
|
+ }
|
|
|
|
|
|
- var connections = structureNode.Output.Connections.ToArray();
|
|
|
+ foreach (var connection in originalInputConnections)
|
|
|
+ {
|
|
|
+ if (connection.Item2 is null)
|
|
|
+ continue;
|
|
|
|
|
|
- var output = structureNode.Background.Connection;
|
|
|
+ IInputProperty? input =
|
|
|
+ node.InputProperties.FirstOrDefault(
|
|
|
+ x => x.InternalPropertyName == connection.Item1.InternalPropertyName);
|
|
|
|
|
|
- foreach (var input in connections)
|
|
|
+ if (input != null)
|
|
|
{
|
|
|
- output.ConnectTo(input);
|
|
|
- changes.Add(new ConnectProperty_ChangeInfo(output.Node.Id, input.Node.Id,
|
|
|
- output.InternalPropertyName, input.InternalPropertyName));
|
|
|
+ connection.Item2.ConnectTo(input);
|
|
|
+ changes.Add(new ConnectProperty_ChangeInfo(connection.Item2.Node.Id, node.Id,
|
|
|
+ connection.Item2.InternalPropertyName,
|
|
|
+ input.InternalPropertyName));
|
|
|
}
|
|
|
}
|
|
|
|