summaryrefslogtreecommitdiff
path: root/lib/stitch_plan/stitch_plan.py
diff options
context:
space:
mode:
authorLex Neva <lexelby@users.noreply.github.com>2023-03-14 00:06:46 -0400
committerGitHub <noreply@github.com>2023-03-14 00:06:46 -0400
commit164d5643085b7f1c22babcec8d35d31825e86d87 (patch)
treea3651562836041b865f786d71bbfd3e6ead27563 /lib/stitch_plan/stitch_plan.py
parent78d81932b3bd856fc1efd0fd7c588568b521a238 (diff)
parente5ce4499f602588e771d6d97840f304a2a95d2cd (diff)
Merge pull request #1886 from talljosh/main
Fixed bug where STOP command would cause colours to apply to the wrong stitches after the STOP in exported files
Diffstat (limited to 'lib/stitch_plan/stitch_plan.py')
-rw-r--r--lib/stitch_plan/stitch_plan.py27
1 files changed, 9 insertions, 18 deletions
diff --git a/lib/stitch_plan/stitch_plan.py b/lib/stitch_plan/stitch_plan.py
index 1a846099..0038a106 100644
--- a/lib/stitch_plan/stitch_plan.py
+++ b/lib/stitch_plan/stitch_plan.py
@@ -44,25 +44,17 @@ def stitch_groups_to_stitch_plan(stitch_groups, collapse_len=None, min_stitch_le
continue
if color_block.color != stitch_group.color:
- if len(color_block) == 0:
- # We just processed a stop, which created a new color block.
- # end the previous block with a color change
- stitch_plan.color_blocks[-2].add_stitch(color_change=True)
-
- # We'll just claim this new block as ours:
- color_block.color = stitch_group.color
- else:
- # add a lock stitch to the last element of the previous group
- lock_stitches = previous_stitch_group.get_lock_stitches("end", disable_ties)
- if lock_stitches:
- color_block.add_stitches(stitches=lock_stitches)
- need_tie_in = True
+ # add a lock stitch to the last element of the previous group
+ lock_stitches = previous_stitch_group.get_lock_stitches("end", disable_ties)
+ if lock_stitches:
+ color_block.add_stitches(stitches=lock_stitches)
+ need_tie_in = True
- # end the previous block with a color change
- color_block.add_stitch(color_change=True)
+ # end the previous block with a color change
+ color_block.add_stitch(color_change=True)
- # make a new block of our color
- color_block = stitch_plan.new_color_block(color=stitch_group.color)
+ # make a new block of our color
+ color_block = stitch_plan.new_color_block(color=stitch_group.color)
else:
if (len(color_block) and not need_tie_in and
((stitch_group.stitches[0] - color_block.stitches[-1]).length() > collapse_len or
@@ -94,7 +86,6 @@ def stitch_groups_to_stitch_plan(stitch_groups, collapse_len=None, min_stitch_le
if stitch_group.stop_after:
color_block.add_stitch(stop=True)
- color_block = stitch_plan.new_color_block(color_block.color)
previous_stitch_group = stitch_group