Add separate style pool config

This commit is contained in:
2026-06-28 00:24:40 +02:00
parent 4c8edc0d3e
commit 78e39734b5
18 changed files with 378 additions and 27 deletions
+58
View File
@@ -22,6 +22,11 @@ try:
location_pool_preset_choices,
location_theme_choices,
)
from .style_config import (
build_style_config_json,
style_combine_mode_choices,
style_pool_preset_choices,
)
except ImportError: # Allows local smoke tests from the repository root.
from category_cast_config import (
build_cast_config_json,
@@ -41,6 +46,11 @@ except ImportError: # Allows local smoke tests from the repository root.
location_pool_preset_choices,
location_theme_choices,
)
from style_config import (
build_style_config_json,
style_combine_mode_choices,
style_pool_preset_choices,
)
SXCP_CATEGORY_CONFIG = "SXCP_CATEGORY_CONFIG"
@@ -48,6 +58,7 @@ SXCP_LOCATION_CONFIG = "SXCP_LOCATION_CONFIG"
SXCP_COMPOSITION_CONFIG = "SXCP_COMPOSITION_CONFIG"
SXCP_CAST_CONFIG = "SXCP_CAST_CONFIG"
SXCP_SEED_CONFIG = "SXCP_SEED_CONFIG"
SXCP_STYLE_CONFIG = "SXCP_STYLE_CONFIG"
class SxCPCategoryPreset:
@@ -178,6 +189,51 @@ class SxCPLocationTheme:
)
class SxCPStylePool:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"enabled": ("BOOLEAN", {"default": True}),
"combine_mode": (style_combine_mode_choices(), {"default": "replace"}),
"preset": (style_pool_preset_choices(), {"default": "realistic_photo"}),
"custom_style": ("STRING", {"default": "", "multiline": True}),
"custom_positive_suffix": ("STRING", {"default": "", "multiline": True}),
"custom_negative": ("STRING", {"default": "", "multiline": True}),
},
"optional": {
"style_config": (SXCP_STYLE_CONFIG,),
},
}
RETURN_TYPES = (SXCP_STYLE_CONFIG, "STRING")
RETURN_NAMES = ("style_config", "summary")
FUNCTION = "build"
CATEGORY = "prompt_builder"
def build(
self,
enabled,
combine_mode,
preset,
custom_style,
custom_positive_suffix,
custom_negative,
style_config="",
):
config = build_style_config_json(
enabled=enabled,
combine_mode=combine_mode,
preset=preset,
custom_style=custom_style or "",
custom_positive_suffix=custom_positive_suffix or "",
custom_negative=custom_negative or "",
style_config=style_config or "",
)
parsed = json.loads(config)
return config, parsed.get("summary", "")
class SxCPCastControl:
@classmethod
def INPUT_TYPES(cls):
@@ -313,6 +369,7 @@ NODE_CLASS_MAPPINGS = {
"SxCPLocationPool": SxCPLocationPool,
"SxCPCompositionPool": SxCPCompositionPool,
"SxCPLocationTheme": SxCPLocationTheme,
"SxCPStylePool": SxCPStylePool,
"SxCPCastControl": SxCPCastControl,
"SxCPCastBias": SxCPCastBias,
}
@@ -322,6 +379,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"SxCPLocationPool": "SxCP Location Pool",
"SxCPCompositionPool": "SxCP Composition Pool",
"SxCPLocationTheme": "SxCP Location Theme",
"SxCPStylePool": "SxCP Style Pool",
"SxCPCastControl": "SxCP Cast Control",
"SxCPCastBias": "SxCP Cast Bias",
}