Seneral / Node_Editor_Framework

A flexible and modular Node Editor Framework for creating node based displays and editors in Unity
https://nodeeditor.seneral.dev
MIT License
2.01k stars 414 forks source link

Array based input support #80

Closed snarlynarwhal closed 8 years ago

snarlynarwhal commented 8 years ago

I apologize ahead of time for bugging the contributors again, but any way to handle array based input support? Here's an example using the calc node: I want to have an int input (numInput) that correlates to the number of inputs in an array (inputArray). So if numInput = 2, I can add/multiply inputArray[0] and inputArray[1]. Alternatively, I could make numInput = 5 and do sum(inputArray[0]:inputArray[4]) to get the sum of each integer in the array.

Right now, node creation usually goes in the Create method. I imagined implementing it like so: create an integer input that correlates to the input array size. Then, create/delete inputs whenever that value changes. However, I don't currently see a delete input method. Do you think this approach would work? Or, is there a better solution?

If there's not currently support for this, any direction how I might implement this? As I said, I'm new to open source projects, but willing to try to help out! :)

Seneral commented 8 years ago

No problem, ask whenever you have a question you can't answer yourself:) I already made an example for nearly exactly the same in this post:) There is a delete method, just do Inputs[0].Delete(); and for outputs: Outputs[0].Delete(); respectively. I agree it's cumbersome for that case but there's barely a different way other than support for multiple input connections (#74). I hope the example in the post above is what you need to get started:)

snarlynarwhal commented 8 years ago

Ahh I forgot to check the forums! My bad - I'll be sure to do that before posting next time. :)

But this is perfect - thanks! :D

Seneral commented 8 years ago

Don't worry I wouldn't check the whole thread either, but I remembered this post:)