kopia lustrzana https://github.com/inkstitch/inkstitch
Merge branch 'main' of https://github.com/inkstitch/inkstitch into george-steel/fix-running-stitch
commit
c2c256727b
|
|
@ -361,7 +361,10 @@ class SatinColumn(EmbroideryElement):
|
|||
@property
|
||||
@cache
|
||||
def csp(self):
|
||||
return self.parse_path()
|
||||
paths = self.parse_path()
|
||||
# exclude subpaths which are just a point
|
||||
paths = [path for path in paths if len(path) >= 2]
|
||||
return paths
|
||||
|
||||
@property
|
||||
@cache
|
||||
|
|
@ -518,8 +521,9 @@ class SatinColumn(EmbroideryElement):
|
|||
def validation_errors(self):
|
||||
# The node should have exactly two paths with the same number of points - or it should
|
||||
# have two rails and at least one rung
|
||||
|
||||
if len(self.rails) < 2:
|
||||
if len(self.csp) < 2:
|
||||
yield TooFewPathsError((0, 0))
|
||||
elif len(self.rails) < 2:
|
||||
yield TooFewPathsError(self.shape.centroid)
|
||||
elif len(self.csp) == 2:
|
||||
if len(self.rails[0]) != len(self.rails[1]):
|
||||
|
|
@ -1015,7 +1019,7 @@ class SatinColumn(EmbroideryElement):
|
|||
self.zigzag_spacing,
|
||||
self.pull_compensation_px,
|
||||
self.pull_compensation_percent/100,
|
||||
self.random_width_decrease.any() and self.random_width_increase.any() and self.random_zigzag_spacing,
|
||||
self.random_width_decrease.any() or self.random_width_increase.any() or self.random_zigzag_spacing,
|
||||
)
|
||||
|
||||
# "left" and "right" here are kind of arbitrary designations meaning
|
||||
|
|
@ -1070,7 +1074,7 @@ class SatinColumn(EmbroideryElement):
|
|||
offset_px = [0, 0]
|
||||
if a.distance(pairs[i-1][0]) < min_dist:
|
||||
offset_px[0] = -inset_px
|
||||
if b.distance(pairs[i-1][0]) < min_dist:
|
||||
if b.distance(pairs[i-1][1]) < min_dist:
|
||||
offset_px[1] = -inset_px
|
||||
shortened.append(self.offset_points(a, b, offset_px, (0, 0)))
|
||||
return shortened
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
# Copyright (c) 2010 Authors
|
||||
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
|
||||
|
||||
from lxml import etree
|
||||
|
||||
from inkex import Boolean, Style
|
||||
from lxml import etree
|
||||
|
||||
from ..stitch_plan import stitch_groups_to_stitch_plan
|
||||
from ..svg import render_stitch_plan
|
||||
from ..svg.tags import (INKSCAPE_GROUPMODE, INKSTITCH_ATTRIBS, SVG_DEFS_TAG,
|
||||
SVG_GROUP_TAG, SVG_PATH_TAG)
|
||||
from ..svg.tags import (INKSCAPE_GROUPMODE, INKSTITCH_ATTRIBS,
|
||||
SODIPODI_INSENSITIVE, SVG_DEFS_TAG, SVG_GROUP_TAG,
|
||||
SVG_PATH_TAG)
|
||||
from .base import InkstitchExtension
|
||||
from .stitch_plan_preview_undo import reset_stitch_plan
|
||||
|
||||
|
|
@ -21,6 +21,7 @@ class StitchPlanPreview(InkstitchExtension):
|
|||
self.arg_parser.add_argument("-s", "--move-to-side", type=Boolean, default=True, dest="move_to_side")
|
||||
self.arg_parser.add_argument("-v", "--layer-visibility", type=int, default=0, dest="layer_visibility")
|
||||
self.arg_parser.add_argument("-n", "--needle-points", type=Boolean, default=False, dest="needle_points")
|
||||
self.arg_parser.add_argument("-i", "--insensitive", type=Boolean, default=False, dest="insensitive")
|
||||
|
||||
def effect(self):
|
||||
# delete old stitch plan
|
||||
|
|
@ -58,6 +59,11 @@ class StitchPlanPreview(InkstitchExtension):
|
|||
float(style.get('opacity', 1)) > 0.4 and not style.get('display', 'inline') == 'none'):
|
||||
g.style['opacity'] = 0.4
|
||||
|
||||
if self.options.insensitive is True:
|
||||
layer.set(SODIPODI_INSENSITIVE, True)
|
||||
else:
|
||||
layer.set(SODIPODI_INSENSITIVE, False)
|
||||
|
||||
# translate stitch plan to the right side of the canvas
|
||||
if self.options.move_to_side:
|
||||
layer.set('transform', 'translate(%s)' % svg.get('viewBox', '0 0 800 0').split(' ')[2])
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ XLINK_HREF = inkex.addNS('href', 'xlink')
|
|||
SODIPODI_NAMEDVIEW = inkex.addNS('namedview', 'sodipodi')
|
||||
SODIPODI_GUIDE = inkex.addNS('guide', 'sodipodi')
|
||||
SODIPODI_ROLE = inkex.addNS('role', 'sodipodi')
|
||||
SODIPODI_INSENSITIVE = inkex.addNS('insensitive', 'sodipodi')
|
||||
|
||||
INKSTITCH_LETTERING = inkex.addNS('lettering', 'inkstitch')
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
<option value="2">Lower opacity</option>
|
||||
</param>
|
||||
<param name="needle-points" type="boolean" gui-text="Needle points">false</param>
|
||||
<param name="insensitive" type="boolean" gui-text="Lock"
|
||||
gui-description="Make stitch plan insensitive to mouse interactions">false</param>
|
||||
<spacer />
|
||||
<script>
|
||||
{{ command_tag | safe }}
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue