Connecting nodes ...... again

The drag is trivial, and works perfectly - if you grab one node and drag it to another, they snap, and the positions are identical - I’ve verified this. The problem arises in the next bit, which decides whether two nodes should be joined:

  • They have to be on the same layer (IE same color)
  • The two shapes have to be continuous and with no T-junctions or broken ordering

The second part is the hard one, and it’s due to the way LightBurn represents path shapes internally. I store shapes as two lists - one for the node positions, and another to say how to connect those nodes. That lists sometimes end up in weird orders, and it makes figuring out if two shapes can be properly connected quite hard.

We’re going to change the way LightBurn stores things under the hood to make this kind of thing easier, but it means rewriting a large chunk of the fundamental parts of LightBurn - all the code that deals with shapes, offsets, merging, editing, drawing, etc will have to be updated, and that’s going to take a while to do.

2 Likes