Offsetting and overriding curve indices?

I know that you can offset index values of any curve using Offset Point in Curve node. However, I also want those changes to override the curve’s original “index” values and not creating a new one with Store Named Attribute node, is there a way to achieve this?

Well, to be clear, it’s not offsetting value, it allows to access index that are further down the list.

The index relate to how the data is stored on disk, point index 1 of curve index 1 is basically the first point of the first curve as it’s stored in memory. Therefore you can’t write a new index, if you really want to do that you need to shuffle the data and it’s not simple :
Basically if you want to swap curves 1 and 2 you need to create two new curves and let the first one get the same amount of point and position that the curve 2 and do the same with the second.

I 'm not sure there is a nodegroup somewhere that does that, if you reaaaallllly want to do that I can give some pointers about how to do that, but it’s pretty painful and I recommend you to find another way to get to the result you’re after if possible !

Good luck !

3 Likes

Yeah, that’s pretty much what I’ve assumed so far, therefore I decided to just stick with a basic workaround where I just create a node group that accepts the current index, an offset value and a total point count that in conjunction with a Math Addition node and a Math Floored Modulo node successfully emulate index offsetting. Thank you for the response, nonetheless.

edit: nevermind, didn’t understand question.

Blender 4.1 has a new node called Sort Elements. I haven’t tried it, but it seems to do what you’re looking for:

The Sort Elements node rearranges geometry elements by changing their indices.`

https://docs.blender.org/manual/en/4.1/modeling/geometry_nodes/geometry/operations/sort_elements.html

But not for curve points, apparently - the error says “Domain and geometry type combination is unsupported”. (Splines in a curve through are a different matter.)
Which, I suppose, makes sense: curves are directional - the order of points seem very important.

3 Likes

Blender 4.0’s Points to Curve has a weight input which acts exactly like 4.1’s Sort Element’s. So for curves you can convert to points and back to curve adding weight and that would sort it.

3 Likes