diff options
author | timntorres <timothynarcisotorres@gmail.com> | 2022-10-29 21:55:30 +0000 |
---|---|---|
committer | timntorres <timothynarcisotorres@gmail.com> | 2022-10-29 21:55:30 +0000 |
commit | e709afb0f774dde34a0a0f8d972a7bd2fd0f023a (patch) | |
tree | c222a84c2e92d245e2a8c736f14740d94cfae380 /modules/scripts.py | |
parent | 2c4d20388425a5e40b93eef3722e42e8d375fbb4 (diff) | |
parent | e7254746bbfbff45099db44a8d4d25dd6181877d (diff) | |
download | stable-diffusion-webui-gfx803-e709afb0f774dde34a0a0f8d972a7bd2fd0f023a.tar.gz stable-diffusion-webui-gfx803-e709afb0f774dde34a0a0f8d972a7bd2fd0f023a.tar.bz2 stable-diffusion-webui-gfx803-e709afb0f774dde34a0a0f8d972a7bd2fd0f023a.zip |
Merge commit 'e7254746bbfbff45099db44a8d4d25dd6181877d' into 3825-save-hypernet-strength-to-info
Diffstat (limited to 'modules/scripts.py')
-rw-r--r-- | modules/scripts.py | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/modules/scripts.py b/modules/scripts.py index a7f36012..96e44bfd 100644 --- a/modules/scripts.py +++ b/modules/scripts.py @@ -64,7 +64,16 @@ class Script: def process(self, p, *args):
"""
This function is called before processing begins for AlwaysVisible scripts.
- scripts. You can modify the processing object (p) here, inject hooks, etc.
+ You can modify the processing object (p) here, inject hooks, etc.
+ args contains all values returned by components from ui()
+ """
+
+ pass
+
+ def postprocess(self, p, processed, *args):
+ """
+ This function is called after processing ends for AlwaysVisible scripts.
+ args contains all values returned by components from ui()
"""
pass
@@ -289,13 +298,22 @@ class ScriptRunner: return processed
- def run_alwayson_scripts(self, p):
+ def process(self, p):
for script in self.alwayson_scripts:
try:
script_args = p.script_args[script.args_from:script.args_to]
script.process(p, *script_args)
except Exception:
- print(f"Error running alwayson script: {script.filename}", file=sys.stderr)
+ print(f"Error running process: {script.filename}", file=sys.stderr)
+ print(traceback.format_exc(), file=sys.stderr)
+
+ def postprocess(self, p, processed):
+ for script in self.alwayson_scripts:
+ try:
+ script_args = p.script_args[script.args_from:script.args_to]
+ script.postprocess(p, processed, *script_args)
+ except Exception:
+ print(f"Error running postprocess: {script.filename}", file=sys.stderr)
print(traceback.format_exc(), file=sys.stderr)
def reload_sources(self, cache):
|