(RFE) Support dict-based COMBO values for INPUT_TYPES in custom nodes.
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 155
Description
### Feature Idea
Currently, custom nodes can have COMBO (ie. drop-down UI/selected categorical parameters) inputs specified as a list of str. The strings in the list appear in the UI, and then those strings are passed to the node handler function when the node is activated. For example:
```
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"image": ("IMAGE",),
"image_ref": ("IMAGE",),
"supersample": ["none", "2x", "4x", "8x"]),
},
}
```
It would facilitate writing much cleaner code if this would also support dict[str, Any] values, where the key str would appear in the user interface, and the value object would be passed as the parameter to the node handler when that key was selected in the UI. So, in the previous example, I'd like to write:
```
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"image": ("IMAGE",),
"image_ref": ("IMAGE",),
"supersample": {"none":1, "2x":2, "4x":4, "8x":8}),
},
}
```
In this example, if this was supported, I wouldn't have to do string handling in the handler function to transform the parameters to a number. This is a simple example I used for clarity, but when you consider that /the inputs are computed dynamically at runtime/, you can see how more complex cases are possible that lead to real separation-of-concerns issues - it would be much cleaner to allow this sort of thing!
### Existing Solutions
No existing solutions are available.
### Other
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.