summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/elements/clone.py6
-rw-r--r--lib/extensions/base.py15
-rw-r--r--lib/stitches/fill.py1
-rw-r--r--lib/svg/tags.py10
4 files changed, 20 insertions, 12 deletions
diff --git a/lib/elements/clone.py b/lib/elements/clone.py
index 303c1c2f..d9185012 100644
--- a/lib/elements/clone.py
+++ b/lib/elements/clone.py
@@ -5,13 +5,7 @@
from math import atan, degrees
-<<<<<<< HEAD
-from ..commands import is_command, is_command_symbol
-=======
-import inkex
-
from ..commands import is_command_symbol
->>>>>>> c69b6f5a (* autofill to fillstitch)
from ..i18n import _
from ..svg.path import get_node_transform
from ..svg.svg import find_elements
diff --git a/lib/extensions/base.py b/lib/extensions/base.py
index 949f947e..cf94714c 100644
--- a/lib/extensions/base.py
+++ b/lib/extensions/base.py
@@ -8,10 +8,12 @@ import os
import re
from collections.abc import MutableMapping
-import inkex
from lxml import etree
+from lxml.etree import Comment
from stringcase import snakecase
+import inkex
+
from ..commands import is_command, layer_commands
from ..elements import EmbroideryElement, nodes_to_elements
from ..elements.clone import is_clone
@@ -19,7 +21,8 @@ from ..i18n import _
from ..marker import has_marker
from ..svg import generate_unique_id
from ..svg.tags import (CONNECTOR_TYPE, EMBROIDERABLE_TAGS, INKSCAPE_GROUPMODE,
- NOT_EMBROIDERABLE_TAGS, SVG_DEFS_TAG, SVG_GROUP_TAG)
+ NOT_EMBROIDERABLE_TAGS, SVG_CLIPPATH_TAG, SVG_DEFS_TAG,
+ SVG_GROUP_TAG, SVG_MASK_TAG)
SVG_METADATA_TAG = inkex.addNS("metadata", "svg")
@@ -129,6 +132,10 @@ class InkstitchExtension(inkex.Effect):
def descendants(self, node, selected=False, troubleshoot=False): # noqa: C901
nodes = []
+
+ if node.tag == Comment:
+ return []
+
element = EmbroideryElement(node)
if element.has_command('ignore_object'):
@@ -141,7 +148,9 @@ class InkstitchExtension(inkex.Effect):
if (node.tag in EMBROIDERABLE_TAGS or node.tag == SVG_GROUP_TAG) and element.get_style('display', 'inline') is None:
return []
- if node.tag == SVG_DEFS_TAG:
+ # defs, masks and clippaths can contain embroiderable elements
+ # but should never be rendered directly.
+ if node.tag in [SVG_DEFS_TAG, SVG_MASK_TAG, SVG_CLIPPATH_TAG]:
return []
# command connectors with a fill color set, will glitch into the elements list
diff --git a/lib/stitches/fill.py b/lib/stitches/fill.py
index a09b93b1..94df3f77 100644
--- a/lib/stitches/fill.py
+++ b/lib/stitches/fill.py
@@ -11,7 +11,6 @@ from ..stitch_plan import Stitch
from ..svg import PIXELS_PER_MM
from ..utils import Point as InkstitchPoint
from ..utils import cache
-from ..stitch_plan import Stitch
def legacy_fill(shape, angle, row_spacing, end_row_spacing, max_stitch_length, flip, staggers, skip_last):
diff --git a/lib/svg/tags.py b/lib/svg/tags.py
index 02340aa5..0c5ffd3d 100644
--- a/lib/svg/tags.py
+++ b/lib/svg/tags.py
@@ -3,14 +3,16 @@
# Copyright (c) 2010 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
-import inkex
from lxml import etree
+import inkex
+
etree.register_namespace("inkstitch", "http://inkstitch.org/namespace")
inkex.NSS['inkstitch'] = 'http://inkstitch.org/namespace'
SVG_PATH_TAG = inkex.addNS('path', 'svg')
SVG_POLYLINE_TAG = inkex.addNS('polyline', 'svg')
+SVG_POLYGON_TAG = inkex.addNS('polygon', 'svg')
SVG_RECT_TAG = inkex.addNS('rect', 'svg')
SVG_ELLIPSE_TAG = inkex.addNS('ellipse', 'svg')
SVG_CIRCLE_TAG = inkex.addNS('circle', 'svg')
@@ -22,12 +24,15 @@ SVG_LINK_TAG = inkex.addNS('a', 'svg')
SVG_SYMBOL_TAG = inkex.addNS('symbol', 'svg')
SVG_USE_TAG = inkex.addNS('use', 'svg')
SVG_IMAGE_TAG = inkex.addNS('image', 'svg')
+SVG_CLIPPATH_TAG = inkex.addNS('clipPath', 'svg')
+SVG_MASK_TAG = inkex.addNS('mask', 'svg')
INKSCAPE_LABEL = inkex.addNS('label', 'inkscape')
INKSCAPE_GROUPMODE = inkex.addNS('groupmode', 'inkscape')
CONNECTION_START = inkex.addNS('connection-start', 'inkscape')
CONNECTION_END = inkex.addNS('connection-end', 'inkscape')
CONNECTOR_TYPE = inkex.addNS('connector-type', 'inkscape')
+INKSCAPE_DOCUMENT_UNITS = inkex.addNS('document-units', 'inkscape')
XLINK_HREF = inkex.addNS('href', 'xlink')
@@ -37,7 +42,8 @@ SODIPODI_ROLE = inkex.addNS('role', 'sodipodi')
INKSTITCH_LETTERING = inkex.addNS('lettering', 'inkstitch')
-EMBROIDERABLE_TAGS = (SVG_PATH_TAG, SVG_POLYLINE_TAG, SVG_RECT_TAG, SVG_ELLIPSE_TAG, SVG_CIRCLE_TAG)
+EMBROIDERABLE_TAGS = (SVG_PATH_TAG, SVG_POLYLINE_TAG, SVG_POLYGON_TAG,
+ SVG_RECT_TAG, SVG_ELLIPSE_TAG, SVG_CIRCLE_TAG)
NOT_EMBROIDERABLE_TAGS = (SVG_IMAGE_TAG, SVG_TEXT_TAG)
SVG_OBJECT_TAGS = (SVG_ELLIPSE_TAG, SVG_CIRCLE_TAG, SVG_RECT_TAG)