McManning / BlueGraph

Visual Scripting Framework for Unity
MIT License
236 stars 30 forks source link

Split ports into input/output #12

Closed McManning closed 3 years ago

McManning commented 3 years ago

Big (backwards breaking) refactor so not sure if it makes sense to do:

Currently ports are stored in a single array on AbstractNode and methods more or less assume one array (AddPort, RemovePort, GetPort). Ports themselves know whether or not they're input or output (Port.isInput) which then changes the behavior of methods like GetValue.

From an optimization standpoint, it doesn't really matter if we're going through a list of 6 ports vs 3 ports to find the right named output. But from a usability standpoint - there's implicit gotchas in the API. E.g. you can't have an output port named the same as an input port, and the behavior of Port.GetValue changing dramatically based on that isInput flag.

I think I'm going to make a branch with the change, see what it looks like, and whether or not it makes more sense to do it that way than what I've got currently.

McManning commented 3 years ago

Couple other thoughts in no particular order:

McManning commented 3 years ago

For the storage format in runtime nodes, I'm going to keep this as a single list. Moving forward - I might look at changing the API to be more explicit, but since that won't be a breaking change on the format itself I'm moving this off the priority list for release.

McManning commented 3 years ago

Closing this out - I'm sticking with a single port list until it becomes a problem. At which point I can look at doing a 2.0 for it.