fix: ensure resolution widget is a combo and bypass validation

This commit is contained in:
Your Name
2026-01-20 10:09:46 +07:00
parent f4d201d34d
commit 8505e89542
2 changed files with 7 additions and 2 deletions
+5 -1
View File
@@ -46,10 +46,14 @@ class PixelForge:
["1 MP", "2 MP", "4 MP", "6 MP", "8 MP", "12 MP", "16 MP"],
{"default": f"{cls._last_max_mp} MP"},
),
"resolution": ("STRING", {"default": "1024×1024"}),
"resolution": (resolutions,),
}
}
@classmethod
def VALIDATE_INPUTS(cls, **kwargs):
return True
RETURN_TYPES = ("INT", "INT", "INT", "INT", "STRING", "FLOAT")
RETURN_NAMES = (
"width_px",
+2 -1
View File
@@ -18,18 +18,19 @@ app.registerExtension({
const onNodeCreated = nodeType.prototype.onNodeCreated;
nodeType.prototype.onNodeCreated = function () {
const r = onNodeCreated ? onNodeCreated.apply(this, arguments) : undefined;
console.log("PixelForge: Node created, initializing dropdown logic");
const aspectWidget = this.widgets.find(w => w.name === "aspect_ratio");
const divisibleWidget = this.widgets.find(w => w.name === "divisible_by");
const mpLimitWidget = this.widgets.find(w => w.name === "max_megapixels");
const resolutionWidget = this.widgets.find(w => w.name === "resolution");
resolutionWidget.type = "combo";
resolutionWidget.options = { values: [] };
const updateResolutions = () => {
const aspect = aspectWidget.value;
const div = parseInt(divisibleWidget.value);
const maxMp = parseInt(mpLimitWidget.value.split(" ")[0]);
console.log("PixelForge: Updating resolutions for aspect:", aspect, "divisible by:", div, "max MP:", maxMp);
const ratio = ASPECT_RATIOS[aspect];
if (!ratio) return;