Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Array based input support #80

Closed
snarlynarwhal opened this issue Jun 28, 2016 · 3 comments
Closed

Array based input support #80

snarlynarwhal opened this issue Jun 28, 2016 · 3 comments

Comments

@snarlynarwhal
Copy link

snarlynarwhal commented Jun 28, 2016

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
Copy link
Owner

Seneral commented Jun 28, 2016

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
Copy link
Author

snarlynarwhal commented Jun 28, 2016

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
Copy link
Owner

Seneral commented Jun 28, 2016

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

@Seneral Seneral closed this as completed Jun 28, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants