summaryrefslogtreecommitdiff
path: root/lib/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'lib/extensions')
-rw-r--r--lib/extensions/base.py15
1 files changed, 12 insertions, 3 deletions
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