diff --git a/inkstitch/elements/element.py b/inkstitch/elements/element.py index 7a029eacd..a6db71896 100644 --- a/inkstitch/elements/element.py +++ b/inkstitch/elements/element.py @@ -203,25 +203,18 @@ class EmbroideryElement(object): # apply the combined transform to this node's path simpletransform.applyTransformToPath(transform, path) - return path + def strip_control_points(self, subpath): + return [point for control_before, point, control_after in subpath] + def flatten(self, path): """approximate a path containing beziers with a series of points""" path = deepcopy(path) - cspsubdiv(path, 0.1) - flattened = [] - - for comp in path: - vertices = [] - for ctl in comp: - vertices.append((ctl[1][0], ctl[1][1])) - flattened.append(vertices) - - return flattened + return [self.strip_control_points(subpath) for subpath in path] @property @param('trim_after', diff --git a/inkstitch/elements/stroke.py b/inkstitch/elements/stroke.py index b0e7d23fb..f245f3708 100644 --- a/inkstitch/elements/stroke.py +++ b/inkstitch/elements/stroke.py @@ -37,7 +37,17 @@ class Stroke(EmbroideryElement): @property def paths(self): - return self.flatten(self.parse_path()) + path = self.parse_path() + + if self.manual_stitch_mode: + return [self.strip_control_points(subpath) for subpath in path] + else: + return self.flatten(path) + + @property + @param('manual_stitch', _('Manual stitch placement'), tooltip=_("Stitch every node in the path. Stitch length and zig-zag spacing are ignored."), type='boolean', default=False) + def manual_stitch_mode(self): + return self.get_boolean_param('manual_stitch') def is_running_stitch(self): # stroke width <= 0.5 pixels is deprecated in favor of dashed lines @@ -99,7 +109,9 @@ class Stroke(EmbroideryElement): for path in self.paths: path = [Point(x, y) for x, y in path] - if self.is_running_stitch(): + if self.manual_stitch_mode: + patch = Patch(color=self.color, stitches=path) + elif self.is_running_stitch(): patch = self.stroke_points(path, self.running_stitch_length, stroke_width=0.0) else: patch = self.stroke_points(path, self.zigzag_spacing / 2.0, stroke_width=self.stroke_width) diff --git a/messages.po b/messages.po index 92630bb06..aa2a05239 100644 --- a/messages.po +++ b/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-03-30 20:26-0400\n" +"POT-Creation-Date: 2018-04-02 22:11-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -272,6 +272,14 @@ msgstr "" msgid "Repeats" msgstr "" +msgid "Manual stitch placement" +msgstr "" + +msgid "" +"Stitch every node in the path. Stitch length and zig-zag spacing are " +"ignored." +msgstr "" + msgid "" "Unable to autofill. This most often happens because your shape is made " "up of multiple sections that aren't connected."