noisecraft icon indicating copy to clipboard operation
noisecraft copied to clipboard

Ability to rename inputs and outputs for individual nodes

Open maximecb opened this issue 4 years ago • 6 comments

One of the issues right now, when creating modules, is that the inputs and outputs get assigned generic names ie in0, in1, out0, out1. This is obviously not very descriptive. If you combine a set of nodes into a module, you might not even know which input is which.

One solution is to allow renaming ins and outs for modules. However, that still has the problem that you might now know which in/out is which when renaming them. So I was thinking, maybe the better solution is to allow renaming ins/outs not just for modules, but for every type of node. That way, before you group nodes into a module, you could rename their ins/outs. Then, when creating the module, it would use the in/out names of the nodes for the in/out names of the module. This would fix the problem of being able to figure out what is what 🤔

maximecb avatar Jun 28 '21 01:06 maximecb

Semi-related question -- I'm noticing that most created modules aren't producing any visible inputs/outputs, is that the current expected state? Or am I perhaps creating modules incorrectly?

alexlitty avatar Aug 28 '21 23:08 alexlitty

When creating a module, it only creates inputs for ports that are already connected in the graph. That way, it doesn't list all the input ports that aren't actually connected (which there could potentially be many).

I just had an idea for the input and output rename: at first I was thinking we'd need to put this in the node parameter dialog. However, something that could be much simpler, is to just make the in/out port names on nodes <input type="text">. This is what's currently done for the project title in the bottom-right corner of the window. You can just click and edit the title. We could do the same for node inputs and outputs :thinking:. Though a potential problem is that some port names are currently the empty string.

Maybe we could add an action SetPortName(nodeId, side, portIdx, name) to store the in/out names in the node state.

maximecb avatar Aug 28 '21 23:08 maximecb

My plan right now is to change the schema of nodes so that each node has an array of strings, inNames and outNames. That will make it fairly trivial to implement the renaming.

maximecb avatar Nov 01 '21 13:11 maximecb

Currently working on adding inNames and outNames for each node. Looks like it shouldn't be too difficult. I'll probably also create a converter script to go from the old node schema format to the new.

maximecb avatar Nov 13 '21 21:11 maximecb

I've completed a converter.js script and changed the schema for projects uploaded on the server so that all nodes have inNames and outNames. It's good to see that this wasn't too hard to do because we may want to change the schema again in the future. I'll proceed with creating new actions to change node input and output names next :)

maximecb avatar Nov 16 '21 05:11 maximecb

I've implemented the SetInName and SetOutName actions. Now we need a way to edit the input and output names in the UI. Slight complication because some input and output names are the empty string, so we can't just click on the names to edit them.

maximecb avatar Dec 04 '21 17:12 maximecb