Skip to content

Fix draft missing line tracker when snapper detects an object without any snap targets

Created by: Moult

Basically the snapper is called to draw the line tracker. When the snapper comes across another object, it attempts to snap to objects. During the snap to objects function, it makes a list of things it can snap to (vertices, edges, etc), but if it doesn't find anything (because there isn't anything, or because all your snaps are disabled in your settings), then it doesn't bother to draw the line tracker. The actual fix is only a few lines, L383-385 in DraftSnap.py.

The reason this PR is quite big is because as I was reading through the logic to make the PR, I did some code cleanup:

  • Predicates in if-statements that could be simplified, were simplified
  • As above, if I could return the function early, in order to prevent code indentation, then I did so
  • Functions are reordered so that they are ordered in the same order that they are called, to make it more natural to read

The code cleanup only contains one refactor, and therefore only improves readability but does not change any flow or scope of logic.

Merge request reports