add manual stitch mode

pull/135/head
Lex Neva 2018-04-02 22:11:57 -04:00
rodzic 95df3c7c44
commit db64531d24
3 zmienionych plików z 27 dodań i 14 usunięć

Wyświetl plik

@ -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',

Wyświetl plik

@ -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)

Wyświetl plik

@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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."