summaryrefslogtreecommitdiff
path: root/lib/elements/utils.py
diff options
context:
space:
mode:
authorLex Neva <lexelby@users.noreply.github.com>2022-05-20 12:06:31 -0400
committerGitHub <noreply@github.com>2022-05-20 12:06:31 -0400
commit8ab4abf190778867a8eccde08733c45f3760b2d0 (patch)
treef5b63f5e192c36d8c6bf47e4c30c68d8b1a73728 /lib/elements/utils.py
parent1316e8132e58361f42cb4315c586e0e2cccfc64c (diff)
parent47123198760f8740acda0799d3b22f14b3f69550 (diff)
Merge pull request #1548 from inkstitch/feature_guided_fill
Feature guided fill
Diffstat (limited to 'lib/elements/utils.py')
-rw-r--r--lib/elements/utils.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/elements/utils.py b/lib/elements/utils.py
index 960f5b07..dafde759 100644
--- a/lib/elements/utils.py
+++ b/lib/elements/utils.py
@@ -7,11 +7,10 @@ from ..commands import is_command
from ..marker import has_marker
from ..svg.tags import (EMBROIDERABLE_TAGS, SVG_IMAGE_TAG, SVG_PATH_TAG,
SVG_POLYLINE_TAG, SVG_TEXT_TAG)
-from .auto_fill import AutoFill
+from .fill_stitch import FillStitch
from .clone import Clone, is_clone
from .element import EmbroideryElement
from .empty_d_object import EmptyDObject
-from .fill import Fill
from .image import ImageObject
from .marker import MarkerObject
from .polyline import Polyline
@@ -20,11 +19,12 @@ from .stroke import Stroke
from .text import TextObject
-def node_to_elements(node): # noqa: C901
+def node_to_elements(node, clone_to_element=False): # noqa: C901
if node.tag == SVG_POLYLINE_TAG:
return [Polyline(node)]
- elif is_clone(node):
+ elif is_clone(node) and not clone_to_element:
+ # clone_to_element: get an actual embroiderable element once a clone has been defined as a clone
return [Clone(node)]
elif node.tag == SVG_PATH_TAG and not node.get('d', ''):
@@ -33,7 +33,7 @@ def node_to_elements(node): # noqa: C901
elif has_marker(node):
return [MarkerObject(node)]
- elif node.tag in EMBROIDERABLE_TAGS:
+ elif node.tag in EMBROIDERABLE_TAGS or is_clone(node):
element = EmbroideryElement(node)
if element.get_boolean_param("satin_column") and element.get_style("stroke"):
@@ -41,10 +41,7 @@ def node_to_elements(node): # noqa: C901
else:
elements = []
if element.get_style("fill", "black") and not element.get_style('fill-opacity', 1) == "0":
- if element.get_boolean_param("auto_fill", True):
- elements.append(AutoFill(node))
- else:
- elements.append(Fill(node))
+ elements.append(FillStitch(node))
if element.get_style("stroke"):
if not is_command(element.node):
elements.append(Stroke(node))