We have Reroutes and Frames, which I can’t imagine living without. Sometimes I make a material or a composite that has several variations and I find myself disconnecting and later reconnecting a lot of the same sockets. If there were were a node that could cycle through multiple inputs and multiple outputs I imagine it would save time.
An added benefit would be the ability to create materials with multiple user-friendly presets. Numbered slots could optionally show labels as well, for example 1. “Polished” 2. “Unpolished” …that sort of thing.
Wires that are plugged into a channel not currently active could grey out to give user feedback that the switch is set to another channel.
OMG you’re right - and I’ve seen it before. Well my memory sucks.
Yes, I remember looking at it and wishing it existed for materials too. And wishing the number of inputs and outputs could be increased. Come to think of it, seeing it in the compositor may be the reason I often long for it in materials.
So my post is partially not so valid, but still partially valid. ;-p
Thanks for the correction.
There’s another one I saw like that posted by somebody else later on which expounded on the idea and had even more inputs. (I’m ok with that.) Reverse engineering that node group shouldn’t be too hard so it just switches with a value input instead of hitting a threshold in a grayscale range.
Come to think of it, the node group interface has something like this already : a blank socket is added every time you add an input or an output. There could very well be a switch node using that kind of behaviour.
By some miraculous stroke of luck I seem to have got it working, by capitalizing the S in “switch” and shortening “integer” to “int”.
Don’t ask me why I thought that was the right thing to do, but it compiled successfully! Haha
#include "stdosl.h"
shader node_switch(
int Switch = 0,
closure color Closure1 = 0,
closure color Closure2 = 0,
output closure color Closure = 0)
{
if (Switch == 0)
Closure = Closure1;
else
Closure = Closure2;
}
The irony does not escape me:
Maybe I’m not always so terribly unlucky with code after all.
Now how to add more inputs and outputs on this thing? Hmmm…