@@ -25,7 +25,8 @@ internal class CreateNode_Change : Change
public override bool InitializeAndValidate(Document target)
{
- return nodeType.IsSubclassOf(typeof(Node)) && nodeType is { IsAbstract: false, IsInterface: false };
+ bool canCreate = nodeType.IsSubclassOf(typeof(Node)) && nodeType is { IsAbstract: false, IsInterface: false };
+ return canCreate && (!nodeType.IsAssignableTo(typeof(OutputNode)) || target.NodeGraph.OutputNode is null);
}
public override OneOf<None, IChangeInfo, List<IChangeInfo>> Apply(Document target, bool firstApply, out bool ignoreInUndo)
@@ -21,7 +21,7 @@ internal class DeleteNode_Change : Change
Node node = target.FindNode<Node>(NodeId);
- if (node is null)
+ if (node is null || target.NodeGraph.OutputNode == node)
return false;
originalConnections = NodeOperations.CreateConnectionsData(node);