From ccfaadaa694fcdda95063fb659df0b4e63161738 Mon Sep 17 00:00:00 2001 From: "Lex Darlog (DRL)" <3897975+Lex-DRL@users.noreply.github.com> Date: Fri, 19 Sep 2025 01:25:28 +0500 Subject: [PATCH] `_tooltips` --- _tooltips.py | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ nodes_upscale.py | 20 ++++++------------ 2 files changed, 59 insertions(+), 14 deletions(-) create mode 100644 _tooltips.py diff --git a/_tooltips.py b/_tooltips.py new file mode 100644 index 0000000..3f894d4 --- /dev/null +++ b/_tooltips.py @@ -0,0 +1,53 @@ +# encoding: utf-8 +""" +Pre-defined tooltips, shared between node inputs. +""" + +upscale = ( + "If the HD resolution can be achieved by uniformly scaling the initial one " + "(there is \"✅\" and not \"⚠️\" in the upscale-line of the status message), " + "outputs this precise upscale-value (might be different from the one originally set on the node itself).\n\n" + "Otherwise, outputs the original upscale-value intact.\n" + "In this case, you shouldn't use it directly and instead should pass it " + "to the \"Upscaled Crop/Pad (Best-Res)\" node and use the upscale-output from it.\n\n" + "In both cases, it won't hurt to use the \"Upscaled Crop/Pad (Best-Res)\" node and just rely " + "on it's `do_crop` and `do_padding` toggle-outputs." +) + +init_width = "Width for original/initial image" +init_height = "Height for original/initial image" +HD_width = "Width for the (main/upscaled) HD-image" +HD_height = "Height for the (main/upscaled) HD-image" + +size_one_side = "Approximate size of one of the image sides.\nWhich one - see the 'size_is_big' and 'landscape' toggles." +size_square = ( + "The total resolution of the image would be the same as of a square with this side.\n" + "The width and height would be such to respect aspect ratio, but also be as close as possible to the " + "total number of pixels as in this square image.\n\n" + "- 512x512 square (SD 1.5): ~0.25 megapixels\n" + "- 1024x1024 square (SDXL): ~1 megapixel" +) + +step_init = ( + "Both width and height will be divisible by this value - by rounding them " + "to the closest appropriate resolution.\n\n" + "The default 48 is (8 * 3 * 2), so it's a safe choice because:\n" + "- it's compatible with SD1.5/XL downsampling factor (divisible by 8),\n" + "- it can be upscaled by x1.5 or x1.333 at the first iteration, which is optimal for latent-upscale,\n" + "- after x1.5 upscale, if you only do x2 later (it's OK for already high resolutions) - it will be divisible " + "by 3 AND 9, which might become handy at that point, where you'll probably use UltimateSDUpscale.\n\n" + "Other values worth trying first: 64, 96, 128." +) +step_upscale1 = "Same as the main `step`, but for the upscaled resolution.\n144 = 8 * 2 * 3 * 3", + +aspect = ( + "Two aspects together define an aspect ratio (16:9, 4:3, etc).\n" + "Order doesn't matter: image orientation is defined by the 'landscape' toggle.\n\n" + "The specified aspect ratio is APPROXIMATE: step parameter has priority over the exact image proportions." +) +toggle_size_is_big = "When ON, size parameter represents the bigger image side.\nWhen OFF, it specifies the smaller one." +toggle_landscape = ( + "Specifies image orientation:\n\n" + "When ON, width is bigger (image is horizontal).\n" + "When OFF, height is bigger (image is vertical)." +) diff --git a/nodes_upscale.py b/nodes_upscale.py index cd0ca73..9ef5ee7 100644 --- a/nodes_upscale.py +++ b/nodes_upscale.py @@ -17,6 +17,7 @@ from .funcs import ( upscale_result_from_approx_wh as _upscale_result_from_approx_wh ) from . import _meta +from . import _tooltips as _tt from .docstring_formatter import format_docstring as _format_docstring from .enums import * from .nodes_simple import _input_types_area @@ -30,20 +31,11 @@ from .slot_types import ( _return_types_upscale = (_IO.FLOAT, _IO.INT, _IO.INT, _IO.INT, _IO.INT) _return_ttips_upscale = _frozendict({ - 'upscale': ( - "If the HD resolution can be achieved by uniformly scaling the initial one " - "(there is \"✅\" and not \"⚠️\" in the upscale-line of the status message), " - "outputs this precise upscale-value (might be different from the one originally set on the node itself).\n\n" - "Otherwise, outputs the original upscale-value intact.\n" - "In this case, you shouldn't use it directly and instead should pass it " - "to the \"Upscaled Crop/Pad (Best-Res)\" node and use the upscale-output from it.\n\n" - "In both cases, it won't hurt to use the \"Upscaled Crop/Pad (Best-Res)\" node and just rely " - "on it's `do_crop` and `do_padding` toggle-outputs." - ), - 'init_width': "Width for original/initial image", - 'init_height': "Height for original/initial image", - 'HD_width': "Width for the (main/upscaled) HD-image", - 'HD_height': "Height for the (main/upscaled) HD-image", + 'upscale': _tt.upscale, + 'init_width': _tt.init_width, + 'init_height': _tt.init_height, + 'HD_width': _tt.HD_width, + 'HD_height': _tt.HD_height, }) __extra_inputs_for_upscale_only = {