Add global seed node

This commit is contained in:
2026-06-24 21:39:34 +02:00
parent cf4fec34b8
commit 190a27eec5
2 changed files with 39 additions and 0 deletions
+16
View File
@@ -6,6 +6,7 @@ generator without writing image batches.
The node is registered as: The node is registered as:
- `prompt_builder / SxCP Prompt Builder` - `prompt_builder / SxCP Prompt Builder`
- `prompt_builder / SxCP Global Seed`
- `prompt_builder / SxCP Seed Control` - `prompt_builder / SxCP Seed Control`
- `prompt_builder / SxCP Seed Locker` - `prompt_builder / SxCP Seed Locker`
- `prompt_builder / SxCP Camera Control` - `prompt_builder / SxCP Camera Control`
@@ -231,6 +232,13 @@ like an auto-labeled slot and can participate in couple/group casts. The outfit,
scene, pose, expression, and composition can still change while the saved scene, pose, expression, and composition can still change while the saved
character appearance remains stable. character appearance remains stable.
`SxCP Global Seed` is the simplest reproducibility node. Set `global_seed`,
connect its `seed` output to the prompt node's `seed` input, and connect its
`seed_config` output to the prompt node's `seed_config` input. With the same
row number, settings, category files, and sampler seed, this recreates the same
prompt result. Manual fields and explicitly fixed per-axis or character-slot
seeds still override the global seed for those parts.
`SxCP Seed Control` outputs `seed_config`, which can be connected to the prompt `SxCP Seed Control` outputs `seed_config`, which can be connected to the prompt
builder's optional `seed_config` input. When an axis is set to `random`, the builder's optional `seed_config` input. When an axis is set to `random`, the
visible seed value is materialized before the workflow queues, and that exact visible seed value is materialized before the workflow queues, and that exact
@@ -716,6 +724,14 @@ axis has its own mode plus seed value:
The `Lock Random Seeds Now` button turns every current `random` axis into a The `Lock Random Seeds Now` button turns every current `random` axis into a
visible concrete seed and switches those axes to `fixed`. visible concrete seed and switches those axes to `fixed`.
For exact prompt reproduction, `SxCP Global Seed` is the shortest path:
- Connect `seed` to the generator `seed` input.
- Connect `seed_config` to the generator `seed_config` input.
- Keep character `slot_seed=-1` when that character should follow the global
person seed; set `slot_seed` only when that character should be independently
pinned.
For normal prompt iteration, `SxCP Seed Locker` is usually simpler: For normal prompt iteration, `SxCP Seed Locker` is usually simpler:
- `base_seed`: the seed whose character/location/etc. you want to keep. - `base_seed`: the seed whose character/location/etc. you want to keep.
+23
View File
@@ -317,6 +317,27 @@ class SxCPSeedControl:
) )
class SxCPGlobalSeed:
@classmethod
def INPUT_TYPES(cls):
seed_spec = {"default": 20260614, "min": 0, "max": 0xFFFFFFFF, "step": 1}
return {
"required": {
"global_seed": ("INT", seed_spec),
}
}
RETURN_TYPES = ("INT", "STRING", "STRING")
RETURN_NAMES = ("seed", "seed_config", "summary")
FUNCTION = "build"
CATEGORY = "prompt_builder"
def build(self, global_seed):
seed = max(0, min(0xFFFFFFFF, int(global_seed)))
config = build_seed_lock_config_json(base_seed=seed, reroll_axis="none", reroll_seed=-1)
return seed, config, f"global seed {seed}; all axes locked"
class SxCPSeedLocker: class SxCPSeedLocker:
@classmethod @classmethod
def INPUT_TYPES(cls): def INPUT_TYPES(cls):
@@ -1457,6 +1478,7 @@ class SxCPInstaOFPromptPair:
NODE_CLASS_MAPPINGS = { NODE_CLASS_MAPPINGS = {
"SxCPPromptBuilder": SxCPPromptBuilder, "SxCPPromptBuilder": SxCPPromptBuilder,
"SxCPGlobalSeed": SxCPGlobalSeed,
"SxCPSeedControl": SxCPSeedControl, "SxCPSeedControl": SxCPSeedControl,
"SxCPSeedLocker": SxCPSeedLocker, "SxCPSeedLocker": SxCPSeedLocker,
"SxCPCameraControl": SxCPCameraControl, "SxCPCameraControl": SxCPCameraControl,
@@ -1481,6 +1503,7 @@ NODE_CLASS_MAPPINGS.update(LOOP_NODE_CLASS_MAPPINGS)
NODE_DISPLAY_NAME_MAPPINGS = { NODE_DISPLAY_NAME_MAPPINGS = {
"SxCPPromptBuilder": "SxCP Prompt Builder", "SxCPPromptBuilder": "SxCP Prompt Builder",
"SxCPGlobalSeed": "SxCP Global Seed",
"SxCPSeedControl": "SxCP Seed Control", "SxCPSeedControl": "SxCP Seed Control",
"SxCPSeedLocker": "SxCP Seed Locker", "SxCPSeedLocker": "SxCP Seed Locker",
"SxCPCameraControl": "SxCP Camera Control", "SxCPCameraControl": "SxCP Camera Control",