diff options
author | hako-mikan <122196982+hako-mikan@users.noreply.github.com> | 2023-06-28 18:37:08 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-28 18:37:08 +0900 |
commit | b0ec69b360835a901a1aa57df1f7c8c9d55bf31c (patch) | |
tree | b74a35db59200b7e1374eb421d1dd85ddc38f1c5 /modules/scripts.py | |
parent | 394ffa7b0a7fff3ec484bcd084e673a8b301ccc8 (diff) |
add 'before_hr callback' script callback
Diffstat (limited to 'modules/scripts.py')
-rw-r--r-- | modules/scripts.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/scripts.py b/modules/scripts.py index 99bf836a..6485f398 100644 --- a/modules/scripts.py +++ b/modules/scripts.py @@ -186,6 +186,11 @@ class Script: return f'script_{tabname}{title}_{item_id}'
+ def before_hr(self, p ,*args):
+ """
+ This function is called before hires fix start.
+ """
+ pass
current_basedir = paths.script_path
@@ -548,6 +553,15 @@ class ScriptRunner: self.scripts[si].args_to = args_to
+ def before_hr(self, p):
+ for script in self.alwayson_scripts:
+ try:
+ script_args = p.script_args[script.args_from:script.args_to]
+ script.before_hr(p, *script_args)
+ except Exception:
+ errors.report(f"Error running before_hr: {script.filename}", exc_info=True)
+
+
scripts_txt2img: ScriptRunner = None
scripts_img2img: ScriptRunner = None
scripts_postproc: scripts_postprocessing.ScriptPostprocessingRunner = None
|