improve hires. fix logic

Use the new "before_hr" callback to check the status of Hires. Fix instead
pull/19/head
Haoming 2023-11-01 18:13:12 +08:00
parent d23551b1a4
commit a792a0b167
3 changed files with 9 additions and 19 deletions

View File

@ -1,3 +1,6 @@
### v1.4.10 - 2023 Nov.01
- Better **Hires. fix** logic
### v1.4.9 - 2023 Nov.01
- Improve Sliders values refresh

View File

@ -134,6 +134,7 @@ class VectorscopeCC(scripts.Script):
raise ValueError(f"Invalid Value: {string}")
def process(self, p, enable:bool, latent:bool, bri:float, con:float, sat:float, r:float, g:float, b:float, doHR:bool, method:str, scaling:str):
KDiffusionSampler.isHR_Pass = False
if 'Enable' in self.xyzCache.keys():
enable = self.parse_bool(self.xyzCache['Enable'])
@ -237,20 +238,7 @@ class VectorscopeCC(scripts.Script):
# Channel 2: Violet | Yellow
def callback_state(self, d):
if not doHR:
if hasattr(p, 'enable_hr') and p.enable_hr:
if not hasattr(p, 'hr_pass'):
p.hr_pass = 0
if p.hr_pass == 0:
if d["i"] == 0:
p.hr_pass = 1
elif p.hr_pass == 1:
if d["i"] == 0:
p.hr_pass = 2
if p.hr_pass == 2:
if not doHR and self.isHR_Pass is True:
return og_callback(self, d)
source = d[mode]
@ -299,9 +287,8 @@ class VectorscopeCC(scripts.Script):
KDiffusionSampler.callback_state = callback_state
return p
def postprocess_image(self, p, *args):
if hasattr(p, 'hr_pass'):
del p.hr_pass
def before_hr(self, p, *args):
KDiffusionSampler.isHR_Pass = True
def postprocess(self, p, processed, *args):
KDiffusionSampler.callback_state = og_callback

View File

@ -2,7 +2,7 @@ from modules import script_callbacks
import modules.scripts as scripts
import json
VERSION = 'v1.4.9'
VERSION = 'v1.4.10'
def clean_outdated(EXT_NAME:str):
with open(scripts.basedir() + '/' + 'ui-config.json', 'r') as json_file: