From 190a27eec50ee3a8a04af8fca7c60dc60b94d076 Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Wed, 24 Jun 2026 21:39:34 +0200 Subject: [PATCH] Add global seed node --- README.md | 16 ++++++++++++++++ __init__.py | 23 +++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/README.md b/README.md index 0e38ed6..200bb71 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ generator without writing image batches. The node is registered as: - `prompt_builder / SxCP Prompt Builder` +- `prompt_builder / SxCP Global Seed` - `prompt_builder / SxCP Seed Control` - `prompt_builder / SxCP Seed Locker` - `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 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 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 @@ -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 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: - `base_seed`: the seed whose character/location/etc. you want to keep. diff --git a/__init__.py b/__init__.py index e392b08..5e85bbd 100644 --- a/__init__.py +++ b/__init__.py @@ -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: @classmethod def INPUT_TYPES(cls): @@ -1457,6 +1478,7 @@ class SxCPInstaOFPromptPair: NODE_CLASS_MAPPINGS = { "SxCPPromptBuilder": SxCPPromptBuilder, + "SxCPGlobalSeed": SxCPGlobalSeed, "SxCPSeedControl": SxCPSeedControl, "SxCPSeedLocker": SxCPSeedLocker, "SxCPCameraControl": SxCPCameraControl, @@ -1481,6 +1503,7 @@ NODE_CLASS_MAPPINGS.update(LOOP_NODE_CLASS_MAPPINGS) NODE_DISPLAY_NAME_MAPPINGS = { "SxCPPromptBuilder": "SxCP Prompt Builder", + "SxCPGlobalSeed": "SxCP Global Seed", "SxCPSeedControl": "SxCP Seed Control", "SxCPSeedLocker": "SxCP Seed Locker", "SxCPCameraControl": "SxCP Camera Control",