Order of socket finding
enhancementhelp wanted
Currently there is automatic detection of the "most compatible" sockets when linking. Most of the time this is desired, but there are some times where it doesn't quite work as a user would expect.
The main issue that I have run into is inside of the compositor. It's quite common to change back-and-forth between float and color data types when applying different compositing nodes. A common example is applying the Sobel filter to the depth pass.
This would currently link the depth to the `Factor` input of the filter node, not the image input.
```py
c.Layers().o.depth >> c.Filter.sobel()
```
This correctly links to the first input which we want in the compositing setup.
```py
c.Layers().o.depth >> c.Filter.sobel(...)
```
The output data type is float and the `Image` input is color, so because there exists a "more compatible" socket (`Factor` which is a float) it links to the second socket instead of the first.
The `...` is used to be specific with location, but it feels strange to have to use it for the _first_ input to be the one that is used. For most other data type conversions it wouldn't be so bad, but given the float -> color -> float is so common in the compositor, it might be worth tweaking it to instead prioritise the first socket unless totally incompatible, then try searching for the most compatible.
Might even be worth just limiting this to some subset of data type conversions such as `float -> color`, `vector -> color`, `color -> vector`, `color -> float`.
We would want to keep the rules consistent across node trees. `color/vector/float -> shader` might be another one in the shader nodes.
The more that I think about it I think that we prioritise the first socket unless `...` is supplied, then we fallback on socket matching logic after that.
0 条评论