Added New object creation node for creating a new node from object from class

This commit is contained in:
Ankitkumar Satapara
2026-04-19 18:39:22 +05:30
parent 813c78eb40
commit dcedbfdc18
5 changed files with 233 additions and 1 deletions

View File

@@ -108,9 +108,19 @@ namespace Nodify.Calculator
};
debugNode.Input.Add("Value");
var newObjectNode = new OperationInfoViewModel()
{
Title = "New Object",
Type = OperationType.System,
sysOp = SystemOperations.NEW_OBJECT,
IsFlowNode = true
};
newObjectNode.Input.Add("");
systemNodes.Add(authNode);
systemNodes.Add(copynode);
systemNodes.Add(debugNode);
systemNodes.Add(newObjectNode);
systemNodes.Add(begin);
systemNodes.Add(ending);
systemNodes.Add(debugAndCreateModels);
@@ -331,6 +341,35 @@ namespace Nodify.Calculator
return funcOp;
}
if (info.sysOp == SystemOperations.NEW_OBJECT)
{
var newObjOp = new SystemOperationViewModel
{
Title = info.Title,
SystemOperationType = SystemOperations.NEW_OBJECT
};
// Flow connectors
newObjOp.Input.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Triangle });
newObjOp.Output.Add(new ConnectorViewModel { Title = "", Shape = ConnectorShape.Triangle, IsInput = false });
// Model class input (Square — user connects a model source)
foreach (var inp in input)
{
inp.Shape = ConnectorShape.Square;
inp.ConnectorColor = Color.MediumPurple;
newObjOp.Input.Add(inp);
}
// Model output (Square — returns the constructed object)
newObjOp.Output.Add(new ConnectorViewModel
{
Title = "Object",
IsInput = false,
Shape = ConnectorShape.Square,
ConnectorColor = Color.MediumPurple,
DataType = "object"
});
return newObjOp;
}
if (info.sysOp == SystemOperations.DEBUG)
{
var debugOp = new SystemOperationViewModel