Indices Selection NODE [to Approve]

Indices Selection Node

This node extracts numbers and symbols from a string input(from the user interface) and use those number to fill the selection output.
Basically speaking, it iterates from character to character of the input text and see if it finds a number or symbols. If a different symbol is found(I will list the allowed ones below) a warning will display and the selection output will be all false(so i won’t select anything). Here are the allowed symbols:

  • ’*’ - This symbol fills the selection Array / field output to true;

  • ’!’ - This symbol removes every other number or list after it from the selection(ex: !5 deselect the 5º number from selection array; !1:10 deselect from 1 to 10 numbers of the selection array);

  • ’,’ - The comma symbol checks if there are numbers grabbed before it by the stack variabel and insert it to the list. The list at the end will fill the selection Array / Fied.

  • ’:’ - This symbol works much like python does. It will fill from x:y(ex: 1:10 will fill the selection array from 1 to 10, if there’s ! it will fill with false).

  • ’0123456789’ - Numbers will be append to the list if it finds a comma or the end of text will append to a ADD list and then fill the selection[number] = true. If the number contains ! it will append to a REMOVE list and then fill the selection[number] = false.

If the input text contains any other symbol it will display a warning message and the selection field will be false(it wont select anything).
There is also plan for a UI for the input string, for now i’m fixing any existent bug.

Here’s a video of it working:

Also, let’s compare the old way vs new way. New way took one node to select and 13 ms total. Where as the old way took 0.19ms total and 16 nodes, all of that for just 5 selections:

The Patch:

Community, feel free to send me use case of this node. It’s working well but you can send me
bug report and examples at [email protected]
I’m doing this node for the community.

17 Likes

Well you can do a pull request or just provide a link to the code.

You don’t need permission to share the code, as a matter of fact, It will be easier to give you an approval or rejection if you would just… submit a link to the code.

1 Like

The Patch:

Community, feel free to send me use case of this node. It’s working well but you can send me
bug report and examples at [email protected]
I’m doing this node for the community.

Blender with “indices selection” node:

2 Likes

Superb work!!

Does this notation also supports negatives & slicing from beginning/end like python?
ex:

  • :10 == get first 9 element
  • -5: == get last 5 elements

I’m curious what’s the length limit of the string input,
because this might cause issues on large objects, if let say we automate the process of generating the string with an operator later, like H is doing

2 Likes

This is great. I would consider separating the “parsing” part of this node into its own thing and name it “string to integer field”, this way it’s not limited to selections

1 Like

It does not accept negative numbers because there’s no negative indices.The 1:10 sintax will just do that, fill indices from(1) to (10). I’m thinking of add other functions, like odd number, deselecting indices. What do you guys think? It’s alread working. I’m Uploading the code in the next comment of mine.

I think this is a rather narrowly applicable node, partially performing the functions of a code interpreter node. But it is now at a very initial planning level, as it involves the complete creation of a new interpretation language with a syntax that takes into account the specifics of geometry nodes.

1 Like

This node i’ve made, its more for user to input indices, only for that porpuse. It does not do anything else. It’s in the early stage, but people have ask it for a long time and i can implement more features to it. But its very fast, the only concer i have is if someone type a large number, but i am fixing it already. Im sending the code and tell me, what do you guys want me to implement more.

Sure, just need approval from the devs.

you can submit your diff here :slight_smile:
https://developer.blender.org/differential/diff/create/

That’s because it generally goes in pair with some sort of selection operator
how such operator would be implemented in the field system, however, is a whole other question

Sorry for the lack of a serious answer (although I was serious)
I definitely don’t want to do this, I realize that I’m not ready to create my own programming language yet )))
Although Lukas Toenne (lukastoenne) discussed and experimented on this in a chat, where it became clear that if you get loops, you will stop your computer)))

Well only if your mesh is too big, I’m coding to restrict it, but for now if your mesh isnt too big it won’t do much. Cuz it only selects the actual indices. but in memory that can happen, have a too big list from the input, that’s what I’m working on now.

It would be great if there were a way to input indices directly. However, while it could be convenient, I don’t think storing the indices in a string is the right way to do it, mostly because of concerns about performance and scalability:

Generally we try to make design choices that avoid inherent performance limitations. While it can be fast, this string processing will have inherent limitations that another form of data input won’t. When you scale this up to a much larger data-set, this could start to become a bottleneck. We should pick a core design that doesn’t have this issue.

So I think it’s a bit hard to say what the right approach is, but one guess is that this should probably line up with an implementation of lists in geometry nodes, where you could generate a list of integer indices (possibly from a string if you really needed to!)

2 Likes

There’s no such a ui for that in blender, input strings is what most softwares use. I’m working on resolving the performance issue, but so far I haven’t had any problems with performance. I should limit the among of numbers characters it can take and also append the indices that exists in the fields. A UI for lists of selection would be really weird, i think, and it’s beyond me. But all of those issues you pointed out i can fix with this node. This node is just the step one.

1 Like

Not yet, but if lists do land at some point, I expect the UI to be made to support them

When the new UI land i apply to the input, it would be very easy for me.

1 Like

I have submited the code:
https://developer.blender.org/D15876

There’s a lot of changes i made but it didnt end up in the diff file. I will update it soon.

2 Likes

Hi commnunity, this is my second revision. Let’s talk for new features and bugs(if there is).
I correct everything. Another problem i am having is to display messages when charater isnt allow.
Let’s talk and make it better. For now, you can use it normally.

LINK: ⚙ D15876 Indices Selection

1 Like

I just have done that already.

Hello, community. In this revision i added two features:
remove Indices and remove FromTo indices(ex: “!5” or FromTo “!5:10”);
Select all indices(’*’).

The dev team didn’t aprove my node but everyone here can use it. It’s working perfectly
https://developer.blender.org/D15876
Hope you enjoy it.
If anyone could help me get this node inside blender would be great for all of us.

1 Like