From 21ee72007b1ecb811a0239d2cd2bc756727d5217 Mon Sep 17 00:00:00 2001 From: Haoming Date: Mon, 11 Sep 2023 13:56:24 +0800 Subject: [PATCH] minor bug fix - Buttons now correctly work with the new Contrast value range - Minor formatting --- CHANGELOG.md | 3 +++ README.md | 6 ++++-- scripts/cc.py | 21 +++++++++++---------- scripts/cc_version.py | 2 +- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5bd8cf..f0c43ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### v1.4.2 - 2023 Sep.11 +- Fix the Reset and Randomize buttons for the new Contrast algorithm + ### v1.4.1 - 2023 Sep.11 - New **Contrast** algorithm diff --git a/README.md b/README.md index 801239b..cbf35b4 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ Thus, I added a scaling option to modify the offset amount. - [ ] Add Gradient features

-

X/Y/Z Plot Support

+

X/Y/Z Plot Support
(Outdated Contrast Value)

For Randomize in X/Y/Z Plot, the value is used as the random seed
@@ -233,5 +233,7 @@ Those who are experienced in Color Correction should be rather familiar with thi

+
+ ~~Yes. I'm aware that it's just how digital colors work in general.~~
-~~We've come full **circle** *(\*ba dum tss)* now that a Color Wheel is actually added.~~
\ No newline at end of file +~~We've come full **circle** *(\*ba dum tss)* now that a Color Wheel is actually added.~~ diff --git a/scripts/cc.py b/scripts/cc.py index 773a574..b060cff 100644 --- a/scripts/cc.py +++ b/scripts/cc.py @@ -95,19 +95,19 @@ class VectorscopeCC(scripts.Script): def register_reset(self, reset_btn, enable, latent, bri, con, sat, early, r, g, b, doHR, method, scaling): for component in [enable, latent, doHR]: reset_btn.click(fn=lambda _: gr.update(value=False), outputs=component) - for component in [early, bri, r, g, b]: + for component in [early, bri, con, r, g, b]: reset_btn.click(fn=lambda _: gr.update(value=0.0), outputs=component) - for component in [con, sat]: + for component in [sat]: reset_btn.click(fn=lambda _: gr.update(value=1.0), outputs=component) reset_btn.click(fn=lambda _: gr.update(value='Straight Abs.'), outputs=method) reset_btn.click(fn=lambda _: gr.update(value='Flat'), outputs=scaling) def register_random(self, random_btn, bri, con, sat, r, g, b): - for component in [bri, r, g, b]: - random_btn.click(fn=lambda _: gr.update(value=round(random.uniform(-3.0, 3.0), 2)), outputs=component) - for component in [con, sat]: - random_btn.click(fn=lambda _: gr.update(value=round(random.uniform(0.25, 1.75), 2)), outputs=component) + for component in [bri, con, r, g, b]: + random_btn.click(fn=lambda _: gr.update(value=round(random.uniform(-2.5, 2.5), 2)), outputs=component) + for component in [sat]: + random_btn.click(fn=lambda _: gr.update(value=round(random.uniform(0.5, 1.5), 2)), outputs=component) def parse_bool(self, string:str): if string.lower() == "true": @@ -124,16 +124,17 @@ class VectorscopeCC(scripts.Script): if not enable: if 'Enable' not in self.xyzCache.keys(): if len(self.xyzCache) > 0: - print('\n\n[X/Y/Z Plot] x [Vec.CC] Extension is not Enabled!\n\n') + print('\n[X/Y/Z Plot] x [Vec.CC] Extension is not Enabled!\n') self.xyzCache.clear() KDiffusionSampler.callback_state = og_callback return p if 'Random' in self.xyzCache.keys(): - print('\n\n[X/Y/Z Plot] x [Vec.CC] Randomize is Enabled!') if len(self.xyzCache) > 1: - print('Some settings will not apply!') + print('\n[X/Y/Z Plot] x [Vec.CC] Randomize is Enabled!\nSome settings will not apply!\n') + else: + print('\n[X/Y/Z Plot] x [Vec.CC] Randomize is Enabled!\n') cc_seed = None @@ -198,7 +199,7 @@ class VectorscopeCC(scripts.Script): if stop < 1: return p - if shared.opts.cc_metadata and shared.opts.cc_metadata is True: + if hasattr(shared.opts, 'cc_metadata') and shared.opts.cc_metadata is True: cc_params = f'Alt: {latent}, Skip: {early}, Brightness: {bri}, Contrast: {con}, Saturation: {sat}, RGB: ({r}, {g}, {b}), Noise: {method}, Proc. Hr.F: {doHR}, Scaling: {scaling}' p.extra_generation_params.update({f'Vec. CC [{VERSION}]': cc_params}) diff --git a/scripts/cc_version.py b/scripts/cc_version.py index 18c292b..e815b89 100644 --- a/scripts/cc_version.py +++ b/scripts/cc_version.py @@ -1,7 +1,7 @@ import modules.scripts as scripts import json -VERSION = 'v1.4.1' +VERSION = 'v1.4.2' def clean_outdated(EXT_NAME:str): with open(scripts.basedir() + '/' + 'ui-config.json', 'r') as json_file: