fix: ensure resolution widget is a combo and bypass validation
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user