diff options
| author | Kaalleen <reni@allenka.de> | 2022-06-06 12:47:03 +0200 |
|---|---|---|
| committer | Kaalleen <reni@allenka.de> | 2022-06-06 12:47:03 +0200 |
| commit | c2bba7fe961e5f7875fb85e5f8f3653bfca06004 (patch) | |
| tree | 4750a8f5d53980729548407e2942ca46e9e5686a /lib/stitches | |
| parent | d4505ebaa29c58fa77bf2e0544ed9be28418dee7 (diff) | |
autorun keep all attributes (also the ripple attribs)
Diffstat (limited to 'lib/stitches')
| -rw-r--r-- | lib/stitches/auto_run.py | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/stitches/auto_run.py b/lib/stitches/auto_run.py index 91a99849..4656bc5d 100644 --- a/lib/stitches/auto_run.py +++ b/lib/stitches/auto_run.py @@ -258,24 +258,28 @@ def create_element(path, position, direction, element): else: label = _("AutoRun Underpath %d") % index - stitch_length = element.node.get(INKSTITCH_ATTRIBS['running_stitch_length_mm'], '') - bean = element.node.get(INKSTITCH_ATTRIBS['bean_stitch_repeats'], 0) - repeats = int(element.node.get(INKSTITCH_ATTRIBS['repeats'], 1)) - if repeats % 2 == 0: - repeats -= 1 - node = inkex.PathElement() node.set("id", generate_unique_id(element.node, el_id)) node.set(INKSCAPE_LABEL, label) node.set("d", path) node.set("style", str(style)) - if stitch_length: - node.set(INKSTITCH_ATTRIBS['running_stitch_length_mm'], stitch_length) - if direction == "autorun": - node.set(INKSTITCH_ATTRIBS['repeats'], str(repeats)) - if bean: - node.set(INKSTITCH_ATTRIBS['bean_stitch_repeats'], bean) + # Set Ink/Stitch attributes + stitch_length = element.node.get(INKSTITCH_ATTRIBS['running_stitch_length_mm'], '') + repeats = int(element.node.get(INKSTITCH_ATTRIBS['repeats'], 1)) + if repeats % 2 == 0: + repeats -= 1 + + if direction == "autorun": + for attrib in element.node.attrib: + if attrib.startswith(inkex.NSS['inkstitch'], 1): + if attrib == INKSTITCH_ATTRIBS['repeats']: + node.set(INKSTITCH_ATTRIBS['repeats'], str(repeats)) + else: + node.set(attrib, element.node.get(attrib)) + else: + if stitch_length: + node.set(INKSTITCH_ATTRIBS['running_stitch_length_mm'], stitch_length) return Stroke(node) |
