@@ -280,6 +280,20 @@ public IEnumerable<BlueprintPin> GetAllPins()
280280 /// Default implementation returns Name; subclasses override for richer display.
281281 /// </summary>
282282 public virtual string GetDisplayTitle ( ) => Name ;
283+
284+ /// <summary>
285+ /// Initializes InputPins and OutputPins from GetDescriptor().
286+ /// Subclasses should call this in their constructor instead of manually adding pins.
287+ /// This ensures the descriptor is the single source of truth for pin layout.
288+ /// </summary>
289+ protected void InitializePinsFromDescriptor ( )
290+ {
291+ var desc = GetDescriptor ( ) ;
292+ foreach ( var pd in desc . InputPins )
293+ InputPins . Add ( new BlueprintPin { Name = pd . Name , Direction = PinDirection . Input , Type = pd . Type } ) ;
294+ foreach ( var pd in desc . OutputPins )
295+ OutputPins . Add ( new BlueprintPin { Name = pd . Name , Direction = PinDirection . Output , Type = pd . Type } ) ;
296+ }
283297}
284298
285299// Node-specific classes can be defined for additional properties
@@ -294,12 +308,7 @@ public EntryNode()
294308 {
295309 NodeType = BlueprintNodeType . Entry ;
296310 Name = "Entry" ;
297- OutputPins . Add ( new BlueprintPin
298- {
299- Name = "Exec" ,
300- Direction = PinDirection . Output ,
301- Type = PinType . Execution
302- } ) ;
311+ InitializePinsFromDescriptor ( ) ;
303312 }
304313
305314 public override NodeDescriptor GetDescriptor ( ) => new (
@@ -319,30 +328,7 @@ public BranchNode()
319328 {
320329 NodeType = BlueprintNodeType . Branch ;
321330 Name = "Branch" ;
322- InputPins . Add ( new BlueprintPin
323- {
324- Name = "Exec" ,
325- Direction = PinDirection . Input ,
326- Type = PinType . Execution
327- } ) ;
328- InputPins . Add ( new BlueprintPin
329- {
330- Name = "Condition" ,
331- Direction = PinDirection . Input ,
332- Type = PinType . Boolean
333- } ) ;
334- OutputPins . Add ( new BlueprintPin
335- {
336- Name = "True" ,
337- Direction = PinDirection . Output ,
338- Type = PinType . Execution
339- } ) ;
340- OutputPins . Add ( new BlueprintPin
341- {
342- Name = "False" ,
343- Direction = PinDirection . Output ,
344- Type = PinType . Execution
345- } ) ;
331+ InitializePinsFromDescriptor ( ) ;
346332 }
347333
348334 public override NodeDescriptor GetDescriptor ( ) => new (
@@ -368,30 +354,7 @@ public LoopNode()
368354 {
369355 NodeType = BlueprintNodeType . Loop ;
370356 Name = "Loop" ;
371- InputPins . Add ( new BlueprintPin
372- {
373- Name = "Exec" ,
374- Direction = PinDirection . Input ,
375- Type = PinType . Execution
376- } ) ;
377- InputPins . Add ( new BlueprintPin
378- {
379- Name = "Condition" ,
380- Direction = PinDirection . Input ,
381- Type = PinType . Boolean
382- } ) ;
383- OutputPins . Add ( new BlueprintPin
384- {
385- Name = "LoopBody" ,
386- Direction = PinDirection . Output ,
387- Type = PinType . Execution
388- } ) ;
389- OutputPins . Add ( new BlueprintPin
390- {
391- Name = "LoopEnd" ,
392- Direction = PinDirection . Output ,
393- Type = PinType . Execution
394- } ) ;
357+ InitializePinsFromDescriptor ( ) ;
395358 }
396359
397360 public override NodeDescriptor GetDescriptor ( ) => new (
@@ -417,12 +380,7 @@ public BreakNode()
417380 {
418381 NodeType = BlueprintNodeType . Break ;
419382 Name = "Break" ;
420- InputPins . Add ( new BlueprintPin
421- {
422- Name = "Exec" ,
423- Direction = PinDirection . Input ,
424- Type = PinType . Execution
425- } ) ;
383+ InitializePinsFromDescriptor ( ) ;
426384 }
427385
428386 public override NodeDescriptor GetDescriptor ( ) => new (
@@ -457,12 +415,7 @@ public ConstNode()
457415 {
458416 NodeType = BlueprintNodeType . Const ;
459417 Name = "Const" ;
460- OutputPins . Add ( new BlueprintPin
461- {
462- Name = "Value" ,
463- Direction = PinDirection . Output ,
464- Type = PinType . Any
465- } ) ;
418+ InitializePinsFromDescriptor ( ) ;
466419 }
467420
468421 public override NodeDescriptor GetDescriptor ( ) => new (
@@ -494,24 +447,7 @@ public CallNode()
494447 {
495448 NodeType = BlueprintNodeType . Call ;
496449 Name = "Call" ;
497- InputPins . Add ( new BlueprintPin
498- {
499- Name = "Exec" ,
500- Direction = PinDirection . Input ,
501- Type = PinType . Execution
502- } ) ;
503- OutputPins . Add ( new BlueprintPin
504- {
505- Name = "Exec" ,
506- Direction = PinDirection . Output ,
507- Type = PinType . Execution
508- } ) ;
509- OutputPins . Add ( new BlueprintPin
510- {
511- Name = "Return" ,
512- Direction = PinDirection . Output ,
513- Type = PinType . Any
514- } ) ;
450+ InitializePinsFromDescriptor ( ) ;
515451 }
516452
517453 public override NodeDescriptor GetDescriptor ( ) => new (
@@ -542,24 +478,7 @@ public CallHelperNode()
542478 {
543479 NodeType = BlueprintNodeType . CallHelper ;
544480 Name = "CallHelper" ;
545- InputPins . Add ( new BlueprintPin
546- {
547- Name = "Exec" ,
548- Direction = PinDirection . Input ,
549- Type = PinType . Execution
550- } ) ;
551- OutputPins . Add ( new BlueprintPin
552- {
553- Name = "Exec" ,
554- Direction = PinDirection . Output ,
555- Type = PinType . Execution
556- } ) ;
557- OutputPins . Add ( new BlueprintPin
558- {
559- Name = "Return" ,
560- Direction = PinDirection . Output ,
561- Type = PinType . Any
562- } ) ;
481+ InitializePinsFromDescriptor ( ) ;
563482 }
564483
565484 public override NodeDescriptor GetDescriptor ( ) => new (
@@ -589,24 +508,7 @@ public GetNode()
589508 {
590509 NodeType = BlueprintNodeType . Get ;
591510 Name = "Get" ;
592- InputPins . Add ( new BlueprintPin
593- {
594- Name = "Exec" ,
595- Direction = PinDirection . Input ,
596- Type = PinType . Execution
597- } ) ;
598- OutputPins . Add ( new BlueprintPin
599- {
600- Name = "Exec" ,
601- Direction = PinDirection . Output ,
602- Type = PinType . Execution
603- } ) ;
604- OutputPins . Add ( new BlueprintPin
605- {
606- Name = "Value" ,
607- Direction = PinDirection . Output ,
608- Type = PinType . Any
609- } ) ;
511+ InitializePinsFromDescriptor ( ) ;
610512 }
611513
612514 public override NodeDescriptor GetDescriptor ( ) => new (
@@ -636,24 +538,7 @@ public SetNode()
636538 {
637539 NodeType = BlueprintNodeType . Set ;
638540 Name = "Set" ;
639- InputPins . Add ( new BlueprintPin
640- {
641- Name = "Exec" ,
642- Direction = PinDirection . Input ,
643- Type = PinType . Execution
644- } ) ;
645- InputPins . Add ( new BlueprintPin
646- {
647- Name = "Value" ,
648- Direction = PinDirection . Input ,
649- Type = PinType . Any
650- } ) ;
651- OutputPins . Add ( new BlueprintPin
652- {
653- Name = "Exec" ,
654- Direction = PinDirection . Output ,
655- Type = PinType . Execution
656- } ) ;
541+ InitializePinsFromDescriptor ( ) ;
657542 }
658543
659544 public override NodeDescriptor GetDescriptor ( ) => new (
@@ -678,24 +563,7 @@ public PrintNode()
678563 {
679564 NodeType = BlueprintNodeType . Print ;
680565 Name = "Print" ;
681- InputPins . Add ( new BlueprintPin
682- {
683- Name = "Exec" ,
684- Direction = PinDirection . Input ,
685- Type = PinType . Execution
686- } ) ;
687- InputPins . Add ( new BlueprintPin
688- {
689- Name = "Value" ,
690- Direction = PinDirection . Input ,
691- Type = PinType . Any
692- } ) ;
693- OutputPins . Add ( new BlueprintPin
694- {
695- Name = "Exec" ,
696- Direction = PinDirection . Output ,
697- Type = PinType . Execution
698- } ) ;
566+ InitializePinsFromDescriptor ( ) ;
699567 }
700568
701569 public override NodeDescriptor GetDescriptor ( ) => new (
@@ -718,24 +586,7 @@ public PauseNode()
718586 {
719587 NodeType = BlueprintNodeType . Pause ;
720588 Name = "Pause" ;
721- InputPins . Add ( new BlueprintPin
722- {
723- Name = "Exec" ,
724- Direction = PinDirection . Input ,
725- Type = PinType . Execution
726- } ) ;
727- InputPins . Add ( new BlueprintPin
728- {
729- Name = "Milliseconds" ,
730- Direction = PinDirection . Input ,
731- Type = PinType . Integer
732- } ) ;
733- OutputPins . Add ( new BlueprintPin
734- {
735- Name = "Exec" ,
736- Direction = PinDirection . Output ,
737- Type = PinType . Execution
738- } ) ;
589+ InitializePinsFromDescriptor ( ) ;
739590 }
740591
741592 public override NodeDescriptor GetDescriptor ( ) => new (
0 commit comments