diff options
| author | George Steel <george.steel@gmail.com> | 2023-01-08 18:33:02 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-08 18:33:02 -0500 |
| commit | fbf57b92d2f37814e0029a1e5b8b413f76697463 (patch) | |
| tree | a5c302b6e093edbca4c20b18ebd9b14dea29da11 /lib/elements/element.py | |
| parent | a7b2122d91703d72177cf980cecbef8fca3d54ec (diff) | |
| parent | 8d13e09bc41f9cfeaa0cd32cd75fa4da07afc03c (diff) | |
Merge pull request #1918 from inkstitch/george-steel/random-base-satin
Add randomization options to satin columns and rewrite split stitches
Diffstat (limited to 'lib/elements/element.py')
| -rw-r--r-- | lib/elements/element.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/elements/element.py b/lib/elements/element.py index 436423a4..75f9fc10 100644 --- a/lib/elements/element.py +++ b/lib/elements/element.py @@ -163,6 +163,8 @@ class EmbroideryElement(object): return self.get_split_float_param(param, default) * PIXELS_PER_MM def set_param(self, name, value): + # Sets a param on the node backing this element. Used by params dialog. + # After calling, this element is invalid due to caching and must be re-created to use the new value. param = INKSTITCH_ATTRIBS[name] self.node.set(param, str(value)) @@ -251,6 +253,22 @@ class EmbroideryElement(object): return self.get_boolean_param('force_lock_stitches', False) @property + @param('random_seed', + _('Random seed'), + tooltip=_('Use a specific seed for randomized attributes. Uses the element ID if empty.'), + type='random_seed', + default='', + sort_index=100) + @cache + def random_seed(self) -> str: + seed = self.get_param('random_seed', '') + if not seed: + seed = self.node.get_id() or '' + # TODO(#1696): When inplementing grouped clones, join this with the IDs of any shadow roots, + # letting each instance without a specified seed get a different default. + return seed + + @property def path(self): # A CSP is a "cubic superpath". # |
