flume icon indicating copy to clipboard operation
flume copied to clipboard

Input Port should allow multiple connections

Open ghost opened this issue 4 years ago • 7 comments

This would be great. Is there a workaround for now?

ghost avatar Dec 04 '20 13:12 ghost

This is an upcoming feature for sure. The groundwork is in place to make this possible, but at the moment there isn't a workaround. The first-class support right now is for root-style graphs. But there's significant community support for supporting different styles of graphs. Can I ask what your use-case is for that kind of graph?

chrisjpatty avatar Dec 08 '20 23:12 chrisjpatty

Hi @chrisjpatty thanks for your response. Imagine a workflow. Different paths may lead back together again. Currently I would have to add the same node twice for this to work. As the node also includes controls / user input, I have to maintain the same node configuration multiple times.

ghost avatar Dec 10 '20 07:12 ghost

@chrisjpatty I’m also very interested in this. I’m planning to have each node represent an async function that can call other async functions. So having a function callable from 2 places is a must.

As a workaround I’m thinking of auto adding an additional input every time the previous one gets connected using the Dynamic Nodes feature (though I haven’t tried yet).

Thank you for this project! It’s quality is great and applications endless.

tjbaron avatar Feb 27 '21 06:02 tjbaron

@chrisjpatty agree with everyone here, having multiple inputs per port would help for my use case as well, where I am modeling child/parent relationships.

Francois-Esquire avatar Oct 23 '21 20:10 Francois-Esquire

This functionality is critical for my use case. The logic could be simplified if each input or output item held an array containing between 0 and N connections, with the ability to limit N when defining the input/output on the node.

This added concept of I/O configuration would also allow for better port definition reuse by moving instance details like the name and label to the node definition.

For example:

const config = new FlumeConfig()
config
  .addPortType({
    type: "string",
    color: Colors.green,
    controls: [
      Controls.text({
        name: "string",
        label: ""
      })
    ]
  })
  .addNodeType({
    type: "string",
    label: "Text",
    description: "Outputs a string of text",
    inputs: ports => [
      .addPortConfig( {type: "string", name: "fname", label: "First Name", min: 1, max: 1} ),
      //UI would show a warning if unconnected since min=1
      .addPortConfig( {type: "string", name: "colors", label: "Favorite Colors", max: 10} )
    ],
    outputs: ports => [
      .addPortConfig({ type: "string", name: "result", label: "Result"});
    ]
  })

You could probably use ES6 rest properties and unpacking to simplify the potential null condition for 0..n connections and backwards compatibility.

davinic avatar Oct 23 '22 12:10 davinic

This could also solve the issue of the different graph types while keeping the concept of the root node. If the root node can accept any collection of inputs to a single port (thinking of the root node as "virtual"), then the outputs of the root are just the destructured input values.

Here is an example from TouchDesigner: image

davinic avatar Oct 23 '22 23:10 davinic

Has anyone forked or figured out how this can be done?

JSH32 avatar Jan 18 '24 23:01 JSH32