Add per-axis seed modes

This commit is contained in:
2026-06-24 15:34:33 +02:00
parent cad2f4b4e4
commit 81d9b20db7
3 changed files with 90 additions and 22 deletions
+45 -11
View File
@@ -1,6 +1,7 @@
from __future__ import annotations
import json
import random
try:
from .prompt_builder import (
@@ -40,6 +41,7 @@ try:
ethnicity_choices,
generation_profile_choices,
load_character_profile_json,
seed_mode_choices,
subcategory_choices,
)
from .caption_naturalizer import naturalize_caption
@@ -82,6 +84,7 @@ except ImportError:
ethnicity_choices,
generation_profile_choices,
load_character_profile_json,
seed_mode_choices,
subcategory_choices,
)
from caption_naturalizer import naturalize_caption
@@ -192,21 +195,27 @@ class SxCPPromptBuilder:
class SxCPSeedControl:
SEED_AXES = (
"category",
"subcategory",
"content",
"person",
"scene",
"pose",
"role",
"expression",
"composition",
)
@classmethod
def INPUT_TYPES(cls):
seed_spec = {"default": -1, "min": -1, "max": 0xFFFFFFFF, "step": 1}
required = {}
for axis in cls.SEED_AXES:
required[f"{axis}_seed_mode"] = (seed_mode_choices(), {"default": "auto"})
required[f"{axis}_seed"] = ("INT", seed_spec)
return {
"required": {
"category_seed": ("INT", seed_spec),
"subcategory_seed": ("INT", seed_spec),
"content_seed": ("INT", seed_spec),
"person_seed": ("INT", seed_spec),
"scene_seed": ("INT", seed_spec),
"pose_seed": ("INT", seed_spec),
"role_seed": ("INT", seed_spec),
"expression_seed": ("INT", seed_spec),
"composition_seed": ("INT", seed_spec),
}
"required": required
}
RETURN_TYPES = ("STRING",)
@@ -214,16 +223,32 @@ class SxCPSeedControl:
FUNCTION = "build"
CATEGORY = "prompt_builder"
@classmethod
def IS_CHANGED(cls, *args, **kwargs):
values = list(args) + list(kwargs.values())
if "random" in values:
return random.random()
return tuple(args), tuple(sorted(kwargs.items()))
def build(
self,
category_seed_mode,
category_seed,
subcategory_seed_mode,
subcategory_seed,
content_seed_mode,
content_seed,
person_seed_mode,
person_seed,
scene_seed_mode,
scene_seed,
pose_seed_mode,
pose_seed,
role_seed_mode,
role_seed,
expression_seed_mode,
expression_seed,
composition_seed_mode,
composition_seed,
):
return (
@@ -237,6 +262,15 @@ class SxCPSeedControl:
role_seed=role_seed,
expression_seed=expression_seed,
composition_seed=composition_seed,
category_seed_mode=category_seed_mode,
subcategory_seed_mode=subcategory_seed_mode,
content_seed_mode=content_seed_mode,
person_seed_mode=person_seed_mode,
scene_seed_mode=scene_seed_mode,
pose_seed_mode=pose_seed_mode,
role_seed_mode=role_seed_mode,
expression_seed_mode=expression_seed_mode,
composition_seed_mode=composition_seed_mode,
),
)