Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
926d0faf98 | ||
|
|
a0984df4ed |
+2
-3
@@ -1,11 +1,10 @@
|
|||||||
from .nodes import YARS, YARSAdv, YARSAdvFrack
|
from .nodes import YARS, YARSAdv
|
||||||
|
|
||||||
|
|
||||||
NODE_CLASS_MAPPINGS = {"YARS": YARS, "YARSAdv": YARSAdv, "YARSAdvFrack": YARSAdvFrack}
|
NODE_CLASS_MAPPINGS = {"YARS": YARS, "YARSAdv": YARSAdv}
|
||||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||||
"YARS": "yaResolution Selector",
|
"YARS": "yaResolution Selector",
|
||||||
"YARSAdv": "yaResolution Selector (Advanced)",
|
"YARSAdv": "yaResolution Selector (Advanced)",
|
||||||
"YARSAdvFrack": "yaResolution Selector (Fractional)",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-6
@@ -141,11 +141,7 @@ app.registerExtension({
|
|||||||
name: "trop.YARS",
|
name: "trop.YARS",
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
||||||
// add resolution printout
|
// add resolution printout
|
||||||
if (
|
if (nodeData.name === "YARSAdv" || nodeData.name === "YARS") {
|
||||||
nodeData.name === "YARSAdvFrack" ||
|
|
||||||
nodeData.name === "YARSAdv" ||
|
|
||||||
nodeData.name === "YARS"
|
|
||||||
) {
|
|
||||||
const onExecuted = nodeType.prototype.onExecuted;
|
const onExecuted = nodeType.prototype.onExecuted;
|
||||||
nodeType.prototype.onExecuted = function (message) {
|
nodeType.prototype.onExecuted = function (message) {
|
||||||
const r = onExecuted?.apply?.(this, arguments);
|
const r = onExecuted?.apply?.(this, arguments);
|
||||||
@@ -185,7 +181,6 @@ app.registerExtension({
|
|||||||
const entries = [
|
const entries = [
|
||||||
{ name: "yaResolution Selector", value: "YARS" },
|
{ name: "yaResolution Selector", value: "YARS" },
|
||||||
{ name: "Advanced yaResolution Selector", value: "YARSAdv" },
|
{ name: "Advanced yaResolution Selector", value: "YARSAdv" },
|
||||||
{ name: "Fractional yaResolution Selector", value: "YARSAdvFrack" },
|
|
||||||
];
|
];
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
options.unshift({
|
options.unshift({
|
||||||
|
|||||||
BIN
Binary file not shown.
@@ -212,84 +212,6 @@ class YARSAdv:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class YARSAdvFrack:
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def INPUT_TYPES(self):
|
|
||||||
return {
|
|
||||||
"required": {
|
|
||||||
"base_resolution": (
|
|
||||||
"INT",
|
|
||||||
{
|
|
||||||
"default": 512,
|
|
||||||
"min": 512,
|
|
||||||
"max": 8192,
|
|
||||||
"step": 128,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
"width_ratio": (
|
|
||||||
"FLOAT",
|
|
||||||
{
|
|
||||||
"default": 1,
|
|
||||||
"min": 0.1,
|
|
||||||
"max": 24,
|
|
||||||
"step": 0.01,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
"height_ratio": (
|
|
||||||
"FLOAT",
|
|
||||||
{
|
|
||||||
"default": 1,
|
|
||||||
"min": 0.1,
|
|
||||||
"max": 24,
|
|
||||||
"step": 0.01,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
"overextend": (
|
|
||||||
"BOOLEAN",
|
|
||||||
{"default": False, "label_on": "yes ", "label_off": "no "},
|
|
||||||
),
|
|
||||||
"constant_resolution": (
|
|
||||||
"BOOLEAN",
|
|
||||||
{"default": False, "label_on": "yes ", "label_off": "no "},
|
|
||||||
),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
RETURN_TYPES = ("INT", "INT")
|
|
||||||
RETURN_NAMES = ("width", "height")
|
|
||||||
FUNCTION = "calculate"
|
|
||||||
OUTPUT_NODE = False
|
|
||||||
CATEGORY = "utils"
|
|
||||||
|
|
||||||
def calculate(
|
|
||||||
self,
|
|
||||||
base_resolution: int,
|
|
||||||
width_ratio: float,
|
|
||||||
height_ratio: float,
|
|
||||||
overextend: bool,
|
|
||||||
constant_resolution: bool,
|
|
||||||
):
|
|
||||||
ratio: float = height_ratio / width_ratio
|
|
||||||
|
|
||||||
if constant_resolution:
|
|
||||||
d = calculate_constant_constant_resolution(base_resolution, ratio)
|
|
||||||
else:
|
|
||||||
d = calculate_aspect_ratio(base_resolution, ratio, overextend)
|
|
||||||
|
|
||||||
# return as dict with `ui` key to trigger onExecuted
|
|
||||||
return {
|
|
||||||
"ui": {
|
|
||||||
"width": [d.width],
|
|
||||||
"height": [d.height],
|
|
||||||
"ratio": [width_ratio / height_ratio],
|
|
||||||
},
|
|
||||||
"result": (d.width, d.height),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "comfyui-yaresolutionselector"
|
name = "ComfyUI-yaResolutionSelector"
|
||||||
description = "Freely adjust resolution and aspect ratio, maintain pixel count of StableDiffusion model, or hook it up to upscaling nodes to get that 5k 16:10 wallpaper in just few clicks."
|
description = "Freely adjust resolution and aspect ratio, maintain pixel count of StableDiffusion model, or hook it up to upscaling nodes to get that 5k 16:10 wallpaper in just few clicks."
|
||||||
version = "1.3.0"
|
version = "1.2.0"
|
||||||
license = {text = "GPL License"}
|
license = { file = "LICENSE" }
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
Repository = "https://github.com/Tropfchen/ComfyUI-yaResolutionSelector"
|
Repository = "https://github.com/Tropfchen/ComfyUI-yaResolutionSelector"
|
||||||
|
|||||||
Reference in New Issue
Block a user