diff --git a/nodes_simple.py b/nodes_simple.py index 0e62df5..f54565f 100644 --- a/nodes_simple.py +++ b/nodes_simple.py @@ -20,7 +20,10 @@ from ._funcs import ( simple_result_from_approx_wh as _simple_result_from_approx_wh ) from . import _meta -from .slot_types import * +from .slot_types import ( + type_dict_res as _type_dict_res, + type_dict_step_init as _type_dict_step_init +) # ---------------------------------------------------------- @@ -32,9 +35,9 @@ _return_names_simple = ('width', 'height') # A tiny optimization by reusing the same immutable dict: _input_types_simple = _deepfreeze({ 'required': { - 'width': (_IO.INT, dict(type_dict_res, **{'tooltip': "Approximate width"})), - 'height': (_IO.INT, dict(type_dict_res, **{'tooltip': "Approximate height"})), - 'step': (_IO.INT, dict(type_dict_step_init, **{'tooltip': ( + 'width': (_IO.INT, dict(_type_dict_res, **{'tooltip': "Approximate width"})), + 'height': (_IO.INT, dict(_type_dict_res, **{'tooltip': "Approximate height"})), + 'step': (_IO.INT, dict(_type_dict_step_init, **{'tooltip': ( "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" @@ -98,7 +101,7 @@ _tooltip_aspect = ( _input_types_orient = _deepfreeze({ 'required': { - 'size': (_IO.INT, dict(type_dict_res, **{'tooltip': ( + 'size': (_IO.INT, dict(_type_dict_res, **{'tooltip': ( "Approximate size of one of the image sides.\nWhich one - see the 'size_is_big' and 'landscape' toggles." )})), 'step': _input_types_simple['required']['step'], @@ -178,7 +181,7 @@ class BestResolutionFromAspectRatio: _input_types_area = _deepfreeze({ 'required': { - 'square_size': (_IO.INT, dict(type_dict_res, **{'tooltip': ( + 'square_size': (_IO.INT, dict(_type_dict_res, **{'tooltip': ( "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" diff --git a/nodes_upscale.py b/nodes_upscale.py index 5920c3c..8031d9a 100644 --- a/nodes_upscale.py +++ b/nodes_upscale.py @@ -20,9 +20,12 @@ from ._funcs import ( ) from . import _meta from .enums import * -from .slot_types import * from .nodes_simple import _input_types_area from .nodes_prims import _res_priority_in_type, _res_priority_verify +from .slot_types import ( + type_dict_step_upscale1 as _type_dict_step_upscale1, + upscale_in_type as _upscale_in_type +) # ---------------------------------------------------------- @@ -47,11 +50,8 @@ _return_ttips_upscale = _frozendict({ __extra_inputs_for_upscale_only = { 'priority': _res_priority_in_type, - 'upscale': (_IO.FLOAT, { - 'default': 1.5, 'min': 1.0, 'max': _sys.float_info.max, 'step': 0.25, 'round': 0.001, - # 'tooltip': "", # TODO - }), - 'up_step': (_IO.INT, dict(type_dict_step_upscale1, **{ + 'upscale': _upscale_in_type, + 'up_step': (_IO.INT, dict(_type_dict_step_upscale1, **{ 'tooltip': "Same as the main `step`, but for the upscaled resolution.", })), } diff --git a/slot_types.py b/slot_types.py index 8c6b2a2..3ce0758 100644 --- a/slot_types.py +++ b/slot_types.py @@ -7,6 +7,8 @@ import typing as _t import sys as _sys +from comfy.comfy_types.node_typing import IO as _IO + def number_type_dict(default: int = 512, min: int = 1, max: int = _sys.maxsize, step: int = 1) -> _t.Dict[str, int]: """Prepare type-dict for an input int/float parameter.""" @@ -20,6 +22,11 @@ def number_type_dict(default: int = 512, min: int = 1, max: int = _sys.maxsize, } +type_dict_res = number_type_dict(1024) type_dict_step_init = number_type_dict(48) type_dict_step_upscale1 = number_type_dict(128) -type_dict_res = number_type_dict(1024) + +upscale_in_type = (_IO.FLOAT, { + 'default': 1.5, 'min': 1.0, 'max': _sys.float_info.max, 'step': 0.25, 'round': 0.001, + # 'tooltip': "", # TODO +}) \ No newline at end of file