Download

Switch On Int (manual values)

Is there any particular reason we cannot manually assign values to the pins?

It isn’t always feasible to ensure the source values are going to fall into a low (or sequential) range, and filling the node with unused values is incredibly tedious, and entirely useless when some of the values are going to be in the hundreds or thousands.

Yeah that is a little annoying. Alternatively you can cast the int to string and use a SwitchOnString node.

How about having both switch on int/float with a range built into the pin:

range.png

I know I can write a macro… but it looks neat.

Oh, that’s a neat trick, never thought about it!
Thanks!

these last few weeks, I think I’ve been thinking about something like this every day… mmm… writing a macro… I might consider it

Im relatively new to C++ but as far as I know C++ does not support ranges in a switch case statement. As bluebrints are tried to be translates as closely to c++ as possible (nativize) it would be not that straight forward. Basically it would have to be translated in a set of nested IF-ELSE statements. Not sure if that is always feasible…

Could you please tell me how you got the switch node to look like this? It doesn’t look like there is an easy way to switch on int range otherwise…

They didn’t, it was an example / request.