Add configurable location pools

This commit is contained in:
2026-06-25 22:05:50 +02:00
parent c01d1d52e0
commit 38ab587e8e
3 changed files with 295 additions and 3 deletions
+50
View File
@@ -18,6 +18,7 @@ SXCP_ETHNICITY_LIST = "SXCP_ETHNICITY_LIST"
SXCP_FILTER_CONFIG = "SXCP_FILTER_CONFIG"
SXCP_SEED_CONFIG = "SXCP_SEED_CONFIG"
SXCP_CAMERA_CONFIG = "SXCP_CAMERA_CONFIG"
SXCP_LOCATION_CONFIG = "SXCP_LOCATION_CONFIG"
SXCP_CATEGORY_CONFIG = "SXCP_CATEGORY_CONFIG"
SXCP_CAST_CONFIG = "SXCP_CAST_CONFIG"
SXCP_GENERATION_PROFILE = "SXCP_GENERATION_PROFILE"
@@ -58,12 +59,14 @@ COMMON_INPUT_TOOLTIPS = {
"ethnicity_list": "Optional ethnicity pool. When connected, it overrides the slot or generator ethnicity picker.",
"seed_config": "Per-axis seed config. Connect Global Seed, Seed Locker, or Seed Control here.",
"camera_config": "Camera config used by the prompt formatter when camera mode is from_camera_config.",
"location_config": "Location config from SxCP Location Pool. It can replace or add to the category scene pool.",
"softcore_camera_config": "Camera config used only for the softcore Insta/OF prompt. Falls back to camera_config if empty.",
"hardcore_camera_config": "Camera config used only for the hardcore Insta/OF prompt. Falls back to camera_config if empty.",
"character_profile": "Saved or loaded single-character profile. Character slots override this for configured casts.",
"character_cast": "Chain character slots here. The node closest to the final generator becomes the next auto_chain label.",
"character_slot": "Single slot payload for saving/loading profiles or debugging one character.",
"hardcore_position_config": "Hardcore action/position config. Chain Position Pool into Action Filter, then into the generator.",
"custom_locations": "One custom location per line. Use plain text, or slug: location text.",
"metadata_json": "Structured metadata from an SxCP generator. Prefer this over raw prompt text for formatters and profile save.",
"source_text": "Raw prompt, caption, or metadata JSON depending on input_hint.",
"source_text_input": "Optional linked raw prompt/caption input. When connected, it overrides the source_text widget.",
@@ -413,6 +416,7 @@ try:
build_hardcore_action_filter_json,
build_hardcore_position_pool_json,
build_insta_of_options_json,
build_location_pool_json,
build_insta_of_pair,
build_prompt,
build_prompt_from_configs,
@@ -457,6 +461,7 @@ try:
hardcore_position_key_choices,
hardcore_detail_density_choices,
load_character_profile_json,
location_pool_preset_choices,
save_character_profile_payload,
seed_mode_choices,
subcategory_choices,
@@ -491,6 +496,7 @@ except ImportError:
build_hardcore_action_filter_json,
build_hardcore_position_pool_json,
build_insta_of_options_json,
build_location_pool_json,
build_insta_of_pair,
build_prompt,
build_prompt_from_configs,
@@ -535,6 +541,7 @@ except ImportError:
hardcore_position_key_choices,
hardcore_detail_density_choices,
load_character_profile_json,
location_pool_preset_choices,
save_character_profile_payload,
seed_mode_choices,
subcategory_choices,
@@ -646,6 +653,7 @@ class SxCPPromptBuilder:
"ethnicity_list": (SXCP_ETHNICITY_LIST,),
"seed_config": (SXCP_SEED_CONFIG,),
"camera_config": (SXCP_CAMERA_CONFIG,),
"location_config": (SXCP_LOCATION_CONFIG,),
"character_profile": (SXCP_CHARACTER_PROFILE,),
"character_cast": (SXCP_CHARACTER_CAST,),
"hardcore_position_config": (SXCP_HARDCORE_POSITION_CONFIG,),
@@ -681,6 +689,7 @@ class SxCPPromptBuilder:
prepend_trigger_to_prompt,
seed_config="",
camera_config="",
location_config="",
character_profile="",
character_cast="",
hardcore_position_config="",
@@ -715,6 +724,7 @@ class SxCPPromptBuilder:
extra_negative=extra_negative or "",
seed_config=seed_config or "",
camera_config=camera_config or "",
location_config=location_config or "",
character_profile=character_profile or "",
character_cast=character_cast or "",
hardcore_position_config=hardcore_position_config or "",
@@ -1162,6 +1172,38 @@ class SxCPCategoryPreset:
return config, parsed["category"], parsed["subcategory"]
class SxCPLocationPool:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"enabled": ("BOOLEAN", {"default": True}),
"combine_mode": (["replace", "add"], {"default": "replace"}),
"preset": (location_pool_preset_choices(), {"default": "custom_only"}),
"custom_locations": ("STRING", {"default": "", "multiline": True}),
},
"optional": {
"location_config": (SXCP_LOCATION_CONFIG,),
},
}
RETURN_TYPES = (SXCP_LOCATION_CONFIG, "STRING")
RETURN_NAMES = ("location_config", "summary")
FUNCTION = "build"
CATEGORY = "prompt_builder"
def build(self, enabled, combine_mode, preset, custom_locations, location_config=""):
config = build_location_pool_json(
enabled=enabled,
combine_mode=combine_mode,
preset=preset,
custom_locations=custom_locations or "",
location_config=location_config or "",
)
parsed = json.loads(config)
return config, parsed.get("summary", "")
class SxCPCastControl:
@classmethod
def INPUT_TYPES(cls):
@@ -1913,6 +1955,7 @@ class SxCPPromptBuilderFromConfigs:
"ethnicity_list": (SXCP_ETHNICITY_LIST,),
"seed_config": (SXCP_SEED_CONFIG,),
"camera_config": (SXCP_CAMERA_CONFIG,),
"location_config": (SXCP_LOCATION_CONFIG,),
"character_profile": (SXCP_CHARACTER_PROFILE,),
"character_cast": (SXCP_CHARACTER_CAST,),
"hardcore_position_config": (SXCP_HARDCORE_POSITION_CONFIG,),
@@ -1938,6 +1981,7 @@ class SxCPPromptBuilderFromConfigs:
ethnicity_list="",
seed_config="",
camera_config="",
location_config="",
character_profile="",
character_cast="",
hardcore_position_config="",
@@ -1954,6 +1998,7 @@ class SxCPPromptBuilderFromConfigs:
filter_config=ethnicity_list or filter_config or "",
seed_config=seed_config or "",
camera_config=camera_config or "",
location_config=location_config or "",
character_profile=character_profile or "",
character_cast=character_cast or "",
hardcore_position_config=hardcore_position_config or "",
@@ -2674,6 +2719,7 @@ class SxCPInstaOFPromptPair:
"camera_config": (SXCP_CAMERA_CONFIG,),
"softcore_camera_config": (SXCP_CAMERA_CONFIG,),
"hardcore_camera_config": (SXCP_CAMERA_CONFIG,),
"location_config": (SXCP_LOCATION_CONFIG,),
"character_profile": (SXCP_CHARACTER_PROFILE,),
"character_cast": (SXCP_CHARACTER_CAST,),
"hardcore_position_config": (SXCP_HARDCORE_POSITION_CONFIG,),
@@ -2712,6 +2758,7 @@ class SxCPInstaOFPromptPair:
camera_config="",
softcore_camera_config="",
hardcore_camera_config="",
location_config="",
character_profile="",
character_cast="",
hardcore_position_config="",
@@ -2736,6 +2783,7 @@ class SxCPInstaOFPromptPair:
camera_config=camera_config or "",
softcore_camera_config=softcore_camera_config or "",
hardcore_camera_config=hardcore_camera_config or "",
location_config=location_config or "",
character_profile=character_profile or "",
character_cast=character_cast or "",
hardcore_position_config=hardcore_position_config or "",
@@ -2764,6 +2812,7 @@ NODE_CLASS_MAPPINGS = {
"SxCPCameraOrbitControl": SxCPCameraOrbitControl,
"SxCPQwenCameraTranslator": SxCPQwenCameraTranslator,
"SxCPCategoryPreset": SxCPCategoryPreset,
"SxCPLocationPool": SxCPLocationPool,
"SxCPCastControl": SxCPCastControl,
"SxCPCastBias": SxCPCastBias,
"SxCPGenerationProfile": SxCPGenerationProfile,
@@ -2806,6 +2855,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"SxCPCameraOrbitControl": "SxCP Camera Orbit Control",
"SxCPQwenCameraTranslator": "SxCP Qwen Camera Translator",
"SxCPCategoryPreset": "SxCP Category Preset",
"SxCPLocationPool": "SxCP Location Pool",
"SxCPCastControl": "SxCP Cast Control",
"SxCPCastBias": "SxCP Cast Bias",
"SxCPGenerationProfile": "SxCP Generation Profile",