Allow for nodes to define whether they default to a widget or input
Hello 👋
I've run into a small problem that I've realised I can't solve in a straightforward manner using a custom node.
This issue arises when you want to create a node with a string, int, or other primitive, as an input by default. I don't want to invoke the widget as a side effect of a node input.
The problem:
I am creating a stacking string node. It's an incredibly simple implementation of a default multiline string that allows for easier visibility into prompts in a node-based style.
Now, that's fine, they work great and I'm quite happy. But, I want to add stacking. Stack multiple text nodes into each other, therefore combining their contents as a concat.
It's quite simple to add another string input, but there does not appear to be a way to display the widget as an input by default. I don't want to display two text boxes to the user as that leads to a confusing interaction.
Ideally, it should be
| IN | OUT |
|---|---|
| INPUT: String | STRING |
| WIDGET: Multiline String |
This would take the String, add it to the multiline string at the front, then output the result. The current implementation of the string node allows only for this:
| IN | OUT |
|---|---|
| STRING | |
| WIDGET: Multiline String | |
| WIDGET: Multiline String |
We are specifically talking about node default formats here.
I'm vaguely aware that you can append specific node formats to nodes somehow (I';ve seen colours and shapes defined as defaults) but I think it would be beneficial for this functionality to be applied as a default.
I've been diving into the UI with pycharm recently and trying to familiarise myself with the repo, but I'm no python guru by an stretch so I'm making slow progress.
At least now I have a document to work from here, and maybe other people are able to add their thoughts. I do intend to follow this up with a PR hopefully soon, but guidance beyond my rather narrow vision scope would be appreciated.
Currently, my solution thinks to add another argument alongside multiline to allow a widget to default to an input instead, like "widget=true" in the argument section.
Hopefully that makes sense to everyone reading.
Here's a visual example.
This is the current implementation and the desired default output for this functionality:
But by default, these nodes will initialise as a widget:
Which means you actually end up with a rather confusing interface.
I've also drawn attention to the fact that there's a lot of unrequited visual buffering between the INPUT and OUTPUT nodes and the widget itself which in itself is another issue...