diff options
| author | Claudine <claudine@MacBook-Pro-2.local> | 2022-11-06 11:03:47 -0500 |
|---|---|---|
| committer | George Steel <george.steel@gmail.com> | 2022-11-06 14:31:28 -0500 |
| commit | 72b001e7c227131a01d3bf3ae8678b704127de77 (patch) | |
| tree | b2f98975ffea691fa870fb03b2bea49bc82a0a2d /lib/extensions/params.py | |
| parent | 4285a6fb7f230547d0c70032c346f6f30956e167 (diff) | |
add random parameters to satin columns
Diffstat (limited to 'lib/extensions/params.py')
| -rw-r--r-- | lib/extensions/params.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/extensions/params.py b/lib/extensions/params.py index df62128f..7d38b5ff 100644 --- a/lib/extensions/params.py +++ b/lib/extensions/params.py @@ -6,6 +6,7 @@ # -*- coding: UTF-8 -*- import os +import random import sys from collections import defaultdict from copy import copy @@ -78,6 +79,9 @@ class ParamsTab(ScrolledPanel): self.pencil_icon = wx.Image(os.path.join(get_resource_dir( "icons"), "pencil_20x20.png")).ConvertToBitmap() + self.randomize_icon = wx.Image(os.path.join(get_resource_dir( + "icons"), "randomize_20x20.png")).ConvertToBitmap() + self.__set_properties() self.__do_layout() @@ -187,6 +191,16 @@ class ParamsTab(ScrolledPanel): return values + def on_change_seed(self, event): + + for node in self.nodes: + random.seed() + new_seed = random.randint(1, 10000) + node.set_param("use_seed", new_seed) + if self.on_change_hook: + self.on_change_hook(self) + event.Skip() + def apply(self): values = self.get_values() for node in self.nodes: @@ -379,6 +393,17 @@ class ParamsTab(ScrolledPanel): self.inputs_to_params = {v: k for k, v in self.param_inputs.items()} box.Add(self.settings_grid, proportion=1, flag=wx.ALL, border=10) + + add_seed_button = False + for param in self.params: + if param.name[:6] == "random": + add_seed_button = True + if add_seed_button: + self.change_seed_button = wx.Button(self, wx.ID_ANY, _("Change Seed")) + self.change_seed_button.Bind(wx.EVT_BUTTON, self.on_change_seed) + self.change_seed_button.SetBitmap(self.randomize_icon) + box.Add(self.change_seed_button, proportion=0, flag=wx.ALIGN_CENTER_HORIZONTAL, border=10) + self.SetSizer(box) self.update_choice_widgets() |
