Implemented fix for default input and output nodes for functions
This commit is contained in:
@@ -97,12 +97,12 @@ namespace Nodify.Calculator
|
|||||||
})
|
})
|
||||||
.WhenRemoved(x =>
|
.WhenRemoved(x =>
|
||||||
{
|
{
|
||||||
foreach (var input in x.Input)
|
foreach (var input in x.Input.ToList())
|
||||||
{
|
{
|
||||||
DisconnectConnector(input);
|
DisconnectConnector(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var item in x.Output)
|
foreach (var item in x.Output.ToList())
|
||||||
{
|
{
|
||||||
DisconnectConnector(item);
|
DisconnectConnector(item);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace Nodify.Calculator
|
namespace Nodify.Calculator
|
||||||
@@ -26,6 +27,19 @@ namespace Nodify.Calculator
|
|||||||
|
|
||||||
public FunctionOperationViewModel()
|
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
|
// Add Begin and End nodes inside the inner calculator for flow-based editing
|
||||||
InnerBegin = new SystemOperationViewModel
|
InnerBegin = new SystemOperationViewModel
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user