aboutsummaryrefslogtreecommitdiffstats
path: root/modules/scripts.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-03-11 13:44:20 +0000
committerGitHub <noreply@github.com>2023-03-11 13:44:20 +0000
commit76bc72116e2576b887e3ec8619c9c0f54a151f7a (patch)
tree8fac1a81e1cfec802e7de819470f94b85d3670b3 /modules/scripts.py
parentef9efb61aa1e0500ffc522b97d072a490ff54788 (diff)
parent7df7e4d22796fda11629463f2fcbe859b98b1d19 (diff)
downloadstable-diffusion-webui-gfx803-76bc72116e2576b887e3ec8619c9c0f54a151f7a.tar.gz
stable-diffusion-webui-gfx803-76bc72116e2576b887e3ec8619c9c0f54a151f7a.tar.bz2
stable-diffusion-webui-gfx803-76bc72116e2576b887e3ec8619c9c0f54a151f7a.zip
Merge pull request #7818 from space-nuko/extension-paste-field-names
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 e6a505b3..8de19884 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."""
@@ -270,6 +275,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
@@ -318,6 +324,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)