Resonite-Issues icon indicating copy to clipboard operation
Resonite-Issues copied to clipboard

Add the index of maximum/minimum to the max/min nodes

Open yoshiyoshyosh opened this issue 10 months ago • 3 comments

Is your feature request related to a problem? Please describe.

Currently, if one wants to get the index of the maximum in a list of nodes (for use in e.g. a multiplexer), they have to use an index of first match along with the maximum:

Image

this is a little unwieldy.

Describe the solution you'd like

it'd be nice if the min/max nodes could directly give the index of the matched value as well. this avoids the need for an extra node.

Describe alternatives you've considered

using a ValueGradientDriver and driving the Position of each of the points with a Progress value set to positive infinity, but this only works with floats.

Image

Additional Context

No response

Requesters

yosh, LuxKitty, and a few others that I have unfortunately forgotten.

yoshiyoshyosh avatar Jan 26 '25 04:01 yoshiyoshyosh

I've used this pattern (Min / Max + IndexOfFirstMatch) plenty of times, this would be a very useful tweak to simplify that!

JackTheFoxOtter avatar Jan 26 '25 10:01 JackTheFoxOtter

We'd probably just add another variant of these nodes like "Max with Index" and "Min with Index". That way if you don't need it, you can use the simpler version.

Frooxius avatar Jan 27 '25 19:01 Frooxius

I apologize for replying to this so late, but this has just been on my mind every time I get reminded of this feature request and I just never got around to replying--I don't think adding another variant of these nodes is the best idea.

As-is, nobody's going to be getting the maximum of one value. Adding another output to the existing wouldn't introduce visual clutter at all--not nearly as much as the extra node browser clutter from having another variant of the node (unless this hypothetical "node browser overhaul" later down the line handles this in some good fashion). There's already some nodes where alternative outputs are used much less than their main outputs. I don't see why this has to be different.

I'd probably never use the version of max/min without an index, because as I'm making protoflux, later down the line I'm most likely going to want to use the index of that somewhere, even if I don't think of it in the moment.

Just my two cents.

yoshiyoshyosh avatar May 28 '25 05:05 yoshiyoshyosh