Reorder By Axis widget fields, share model list/default with Preset node
model now goes last (primary_dim, reference, aspect_ratio, batch_size, model). Both nodes derive MODELS from presets.py's own order once at module level, so whichever model is listed first there becomes the default everywhere — no per-node edits needed when a new architecture takes the top spot. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
8dad556fff
commit
20d0637de5
@@ -25,6 +25,11 @@ MODEL_LATENT_SPEC = {
|
|||||||
}
|
}
|
||||||
DEFAULT_LATENT_SPEC = (4, 8)
|
DEFAULT_LATENT_SPEC = (4, 8)
|
||||||
|
|
||||||
|
# Unique models in presets.py order (most relevant first, per its own convention) — both
|
||||||
|
# nodes default to whichever model is listed first there, so adding a new architecture at
|
||||||
|
# the top of presets.py automatically becomes the new default without touching this file.
|
||||||
|
MODELS = list(dict.fromkeys(model for model, _, _, _ in PRESETS))
|
||||||
|
|
||||||
ASPECT_RATIOS = [
|
ASPECT_RATIOS = [
|
||||||
("1:1 Square", (1, 1)),
|
("1:1 Square", (1, 1)),
|
||||||
("3:2 Landscape", (3, 2)),
|
("3:2 Landscape", (3, 2)),
|
||||||
@@ -63,10 +68,10 @@ class EmptyLatentAspectPreset:
|
|||||||
f"{w}x{h} - {lbl} - {model}": (w, h)
|
f"{w}x{h} - {lbl} - {model}": (w, h)
|
||||||
for model, lbl, w, h in PRESETS
|
for model, lbl, w, h in PRESETS
|
||||||
}
|
}
|
||||||
# Unique models in first-appearance order; the "model" widget is purely a
|
# The "model" widget is purely a client-side filter (see web/aspect_ratio_filter.js)
|
||||||
# client-side filter (see web/aspect_ratio_filter.js) for the "preset" dropdown,
|
# for the "preset" dropdown, which already encodes the model in its label — parsed
|
||||||
# which already encodes the model in its label — parsed there, not duplicated.
|
# there, not duplicated.
|
||||||
MODELS = list(dict.fromkeys(model for model, _, _, _ in PRESETS))
|
MODELS = MODELS
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(cls):
|
def INPUT_TYPES(cls):
|
||||||
@@ -101,17 +106,17 @@ class EmptyLatentAspectByAxis:
|
|||||||
ASPECT_CHOICES = ASPECT_RATIOS
|
ASPECT_CHOICES = ASPECT_RATIOS
|
||||||
REFERENCE_CHOICES = ["Width", "Height"]
|
REFERENCE_CHOICES = ["Width", "Height"]
|
||||||
RATIO_MAP = dict(ASPECT_CHOICES)
|
RATIO_MAP = dict(ASPECT_CHOICES)
|
||||||
MODELS = list(MODEL_LATENT_SPEC.keys())
|
MODELS = MODELS
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(cls):
|
def INPUT_TYPES(cls):
|
||||||
return {
|
return {
|
||||||
"required": {
|
"required": {
|
||||||
"model": (cls.MODELS,),
|
|
||||||
"primary_dim": ("INT", {"default": 512, "min": 8}),
|
"primary_dim": ("INT", {"default": 512, "min": 8}),
|
||||||
"reference": (cls.REFERENCE_CHOICES,),
|
"reference": (cls.REFERENCE_CHOICES,),
|
||||||
"aspect_ratio": ([lbl for lbl, _ in cls.ASPECT_CHOICES],),
|
"aspect_ratio": ([lbl for lbl, _ in cls.ASPECT_CHOICES],),
|
||||||
"batch_size": ("INT", {"default": 1, "min": 1}),
|
"batch_size": ("INT", {"default": 1, "min": 1}),
|
||||||
|
"model": (cls.MODELS,),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +125,7 @@ class EmptyLatentAspectByAxis:
|
|||||||
FUNCTION = "generate"
|
FUNCTION = "generate"
|
||||||
CATEGORY = "latent"
|
CATEGORY = "latent"
|
||||||
|
|
||||||
def generate(self, model: str, primary_dim: int, reference: str, aspect_ratio: str, batch_size: int):
|
def generate(self, primary_dim: int, reference: str, aspect_ratio: str, batch_size: int, model: str):
|
||||||
if aspect_ratio not in self.RATIO_MAP:
|
if aspect_ratio not in self.RATIO_MAP:
|
||||||
raise ValueError(f"Unknown aspect ratio: {aspect_ratio}")
|
raise ValueError(f"Unknown aspect ratio: {aspect_ratio}")
|
||||||
wr, hr = self.RATIO_MAP[aspect_ratio]
|
wr, hr = self.RATIO_MAP[aspect_ratio]
|
||||||
|
|||||||
Reference in New Issue
Block a user