← All ideas
  • Published 2 Aug 2023

Negative indices in Geometry Nodes select indices from the end

it would be really convenient if we could use negative indices when selecting or sampling indices from the end of the spreadsheet, so -1 would mean the last index, -2 would mean penultimate index and so on. Just like it is done in Python lists. Безымянный.png

Here is how it will be used in Geonodes. No changes to the interface required. Безымянный.png

40%

Development Status: Open

Upvote 2 Downvote 3
ruslan65
2 Aug 2023

3 Comments

drew_ab

You can probably achieve this by adding "domain size node", which gives you the amount of elements in a domain, then "math node" > subtract 1.00 (or the number of the last indices you want) . Now you just use the compare node > greater than, compare the "index node" with the previous count. I've done this heaps of times, give it a shot

1
ruslan65 Author

i know i can do it like that. Just would be so much easier if i didn't have to create 3 additional nodes just to achieve the same thing that could be done with a negative index. Just a minor quality of life update that i don't think is hard to implement.

1
Hulifier

I would prefer a 'Wrap Index' check box instead, that way one can choose between behaviors, since the default value has its uses, mainly for debugging the node tree.

Also maybe a 'Is Valid Index' output could be available when 'Wrap Index' isn't checked.