summaryrefslogtreecommitdiff
path: root/lib/extensions/base.py
diff options
context:
space:
mode:
authorKaalleen <reni@allenka.de>2022-05-04 20:04:39 +0200
committerKaalleen <reni@allenka.de>2022-05-04 20:04:39 +0200
commite65aaebbcab1ca6fbcf99d9f3665af423e02c2f5 (patch)
tree314fda9b420cf77d03293ea4b542593ee8ccbf2e /lib/extensions/base.py
parent48d0a0250e2787a3351137172924d1c4d277f002 (diff)
rebase corrections
Diffstat (limited to 'lib/extensions/base.py')
-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