aboutsummaryrefslogtreecommitdiffstats
path: root/modules/scripts.py
diff options
context:
space:
mode:
authorspace-nuko <24979496+space-nuko@users.noreply.github.com>2023-02-14 11:55:42 +0000
committerspace-nuko <24979496+space-nuko@users.noreply.github.com>2023-02-14 11:55:42 +0000
commit7df7e4d22796fda11629463f2fcbe859b98b1d19 (patch)
treed0c2b306293a93c3233c44ac78c853d66eddecf0 /modules/scripts.py
parent3715ece0adce7bf7c5e9c5ab3710b2fdc3848f39 (diff)
downloadstable-diffusion-webui-gfx803-7df7e4d22796fda11629463f2fcbe859b98b1d19.tar.gz
stable-diffusion-webui-gfx803-7df7e4d22796fda11629463f2fcbe859b98b1d19.tar.bz2
stable-diffusion-webui-gfx803-7df7e4d22796fda11629463f2fcbe859b98b1d19.zip
Allow extensions to declare paste fields for "Send to X" buttons
Diffstat (limited to 'modules/scripts.py')
-rw-r--r--modules/scripts.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/scripts.py b/modules/scripts.py
index 24056a12..ac0785ce 100644
--- a/modules/scripts.py
+++ b/modules/scripts.py
@@ -33,6 +33,11 @@ class Script:
parsing infotext to set the value for the component; see ui.py's txt2img_paste_fields for an example
"""
+ paste_field_names = None
+ """if set in ui(), this is a list of names of infotext fields; the fields will be sent through the
+ various "Send to <X>" buttons when clicked
+ """
+
def title(self):
"""this function should return the title of the script. This is what will be displayed in the dropdown menu."""
@@ -256,6 +261,7 @@ class ScriptRunner:
self.alwayson_scripts = []
self.titles = []
self.infotext_fields = []
+ self.paste_field_names = []
def initialize_scripts(self, is_img2img):
from modules import scripts_auto_postprocessing
@@ -304,6 +310,9 @@ class ScriptRunner:
if script.infotext_fields is not None:
self.infotext_fields += script.infotext_fields
+ if script.paste_field_names is not None:
+ self.paste_field_names += script.paste_field_names
+
inputs += controls
inputs_alwayson += [script.alwayson for _ in controls]
script.args_to = len(inputs)