Implemented fix for default input and output nodes for functions

This commit is contained in:
Ankitkumar Satapara
2026-04-20 00:42:00 +05:30
parent dcedbfdc18
commit 7288bdd6f2
2 changed files with 16 additions and 2 deletions

View File

@@ -97,12 +97,12 @@ namespace Nodify.Calculator
})
.WhenRemoved(x =>
{
foreach (var input in x.Input)
foreach (var input in x.Input.ToList())
{
DisconnectConnector(input);
}
foreach (var item in x.Output)
foreach (var item in x.Output.ToList())
{
DisconnectConnector(item);
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows;
namespace Nodify.Calculator
@@ -26,6 +27,19 @@ namespace Nodify.Calculator
public FunctionOperationViewModel()
{
// Remove the default InnerInput/InnerOutput nodes added by the base class
// FunctionOperationViewModel uses its own InnerBegin/InnerEnd instead
var toRemove = InnerCalculator.Operations
.Where(op => op.Title == "Input Parameters" || op.Title == "Output Parameters")
.ToList();
foreach (var op in toRemove)
{
InnerCalculator.Operations.Remove(op);
}
// Clear any input connectors inherited from the base class InnerInput sync
Input.Clear();
// Add Begin and End nodes inside the inner calculator for flow-based editing
InnerBegin = new SystemOperationViewModel
{