@@ -64,7 +64,16 @@ def run(self, p, *args):
64
64
def process (self , p , * args ):
65
65
"""
66
66
This function is called before processing begins for AlwaysVisible scripts.
67
- scripts. You can modify the processing object (p) here, inject hooks, etc.
67
+ You can modify the processing object (p) here, inject hooks, etc.
68
+ args contains all values returned by components from ui()
69
+ """
70
+
71
+ pass
72
+
73
+ def postprocess (self , p , processed , * args ):
74
+ """
75
+ This function is called after processing ends for AlwaysVisible scripts.
76
+ args contains all values returned by components from ui()
68
77
"""
69
78
70
79
pass
@@ -289,13 +298,22 @@ def run(self, p: StableDiffusionProcessing, *args):
289
298
290
299
return processed
291
300
292
- def run_alwayson_scripts (self , p ):
301
+ def process (self , p ):
293
302
for script in self .alwayson_scripts :
294
303
try :
295
304
script_args = p .script_args [script .args_from :script .args_to ]
296
305
script .process (p , * script_args )
297
306
except Exception :
298
- print (f"Error running alwayson script: { script .filename } " , file = sys .stderr )
307
+ print (f"Error running process: { script .filename } " , file = sys .stderr )
308
+ print (traceback .format_exc (), file = sys .stderr )
309
+
310
+ def postprocess (self , p , processed ):
311
+ for script in self .alwayson_scripts :
312
+ try :
313
+ script_args = p .script_args [script .args_from :script .args_to ]
314
+ script .postprocess (p , processed , * script_args )
315
+ except Exception :
316
+ print (f"Error running postprocess: { script .filename } " , file = sys .stderr )
299
317
print (traceback .format_exc (), file = sys .stderr )
300
318
301
319
def reload_sources (self , cache ):
0 commit comments