Add BGM helper for H3 prompt curator
This commit is contained in:
+110
-1
@@ -398,6 +398,51 @@ _SOUNDSCAPE_PRESETS = OrderedDict(
|
||||
("custom", ""),
|
||||
]
|
||||
)
|
||||
_BGM_PRESETS = OrderedDict(
|
||||
[
|
||||
(
|
||||
"none",
|
||||
"",
|
||||
),
|
||||
(
|
||||
"subtle tension",
|
||||
"low, restrained tension bed with sparse pulses and no vocals",
|
||||
),
|
||||
(
|
||||
"cinematic suspense",
|
||||
"cinematic suspense score with muted strings, low drones, and controlled rising pressure",
|
||||
),
|
||||
(
|
||||
"emotional piano",
|
||||
"soft emotional piano underscoring with gentle space and no vocals",
|
||||
),
|
||||
(
|
||||
"dark ambient",
|
||||
"dark ambient music bed with deep drones, distant texture, and slow unease",
|
||||
),
|
||||
(
|
||||
"hopeful orchestral",
|
||||
"hopeful orchestral underscore with warm strings, gentle brass, and restrained lift",
|
||||
),
|
||||
(
|
||||
"retro synth",
|
||||
"retro synth score with analog pulses, warm pads, and steady momentum",
|
||||
),
|
||||
(
|
||||
"action pulse",
|
||||
"driving action pulse with percussion, rhythmic bass, and urgent forward motion",
|
||||
),
|
||||
(
|
||||
"lo-fi",
|
||||
"soft lo-fi instrumental bed with mellow rhythm and warm tape texture",
|
||||
),
|
||||
(
|
||||
"no vocals",
|
||||
"instrumental background music only, no singing, no lyrics, no vocal hooks",
|
||||
),
|
||||
("custom", ""),
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def _soundscape_options():
|
||||
@@ -406,6 +451,14 @@ def _soundscape_options():
|
||||
|
||||
def _soundscape_description(soundscape_name):
|
||||
return _SOUNDSCAPE_PRESETS.get(soundscape_name, "")
|
||||
|
||||
|
||||
def _bgm_options():
|
||||
return list(_BGM_PRESETS.keys())
|
||||
|
||||
|
||||
def _bgm_description(bgm_name):
|
||||
return _BGM_PRESETS.get(bgm_name, "")
|
||||
_LOAD_IMAGES_FOLDER_DEFAULT_STATE = {
|
||||
"version": 1,
|
||||
"folder": "",
|
||||
@@ -1187,6 +1240,7 @@ def curate_h3_prompt(
|
||||
action_prompt,
|
||||
anchor="",
|
||||
soundscape="",
|
||||
bgm="",
|
||||
refs=(),
|
||||
anatomy_guard="auto",
|
||||
subject_count_guard="auto",
|
||||
@@ -1209,6 +1263,7 @@ def curate_h3_prompt(
|
||||
):
|
||||
_append_prompt_section(prompt_parts, "Subject count guard", _subject_count_guard_text(selected))
|
||||
_append_prompt_section(prompt_parts, "overall_soundscape", soundscape)
|
||||
_append_prompt_section(prompt_parts, "background_music", bgm)
|
||||
|
||||
prompt = "\n\n".join(prompt_parts).strip()
|
||||
if len(prompt) > _H3_PROMPT_MAX_CHARS:
|
||||
@@ -2561,10 +2616,53 @@ class DumasSoundscapeHelperNode:
|
||||
return (text,)
|
||||
|
||||
|
||||
class DumasBackgroundMusicHelperNode:
|
||||
DESCRIPTION = (
|
||||
"Choose a background music preset, auto-fill its editable description, "
|
||||
"and pass the final BGM text downstream for MiniMax H3 prompts."
|
||||
)
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("bgm",)
|
||||
FUNCTION = "build_bgm"
|
||||
CATEGORY = "Dumas/MiniMax"
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
default_bgm = "none"
|
||||
return {
|
||||
"required": {
|
||||
"bgm": (
|
||||
_bgm_options(),
|
||||
{
|
||||
"default": default_bgm,
|
||||
"tooltip": "Preset title used to seed the editable background music description.",
|
||||
},
|
||||
),
|
||||
"bgm_description": (
|
||||
"STRING",
|
||||
{
|
||||
"default": _bgm_description(default_bgm),
|
||||
"multiline": True,
|
||||
"tooltip": (
|
||||
"Editable background music description. Whatever text is here "
|
||||
"is what the node outputs to the bgm socket."
|
||||
),
|
||||
},
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
def build_bgm(self, bgm, bgm_description):
|
||||
text = str(bgm_description or "").strip()
|
||||
if not text:
|
||||
text = _bgm_description(bgm)
|
||||
return (text,)
|
||||
|
||||
|
||||
class DumasH3PromptCuratorNode:
|
||||
DESCRIPTION = (
|
||||
"Curate one MiniMax H3 prompt from an action textbox, anchor text, "
|
||||
"soundscape text, and up to nine structured references. References are "
|
||||
"soundscape/BGM text, and up to nine structured references. References are "
|
||||
"compacted so only mentioned names, aliases, or explicit <Picture N>/<refN> "
|
||||
"tags are sent onward."
|
||||
)
|
||||
@@ -2603,6 +2701,13 @@ class DumasH3PromptCuratorNode:
|
||||
"tooltip": "Optional soundscape text, usually from Dumas Soundscape Helper.",
|
||||
},
|
||||
),
|
||||
"bgm": (
|
||||
"STRING",
|
||||
{
|
||||
"forceInput": True,
|
||||
"tooltip": "Optional background music text, usually from Dumas Background Music Helper.",
|
||||
},
|
||||
),
|
||||
}
|
||||
for slot in range(1, _H3_PROMPT_REF_SLOTS + 1):
|
||||
optional[f"ref_{slot}"] = (
|
||||
@@ -2658,6 +2763,7 @@ class DumasH3PromptCuratorNode:
|
||||
subject_count_guard,
|
||||
anchor="",
|
||||
soundscape="",
|
||||
bgm="",
|
||||
ref_1=None,
|
||||
ref_2=None,
|
||||
ref_3=None,
|
||||
@@ -2672,6 +2778,7 @@ class DumasH3PromptCuratorNode:
|
||||
action_prompt,
|
||||
anchor=anchor,
|
||||
soundscape=soundscape,
|
||||
bgm=bgm,
|
||||
refs=(ref_1, ref_2, ref_3, ref_4, ref_5, ref_6, ref_7, ref_8, ref_9),
|
||||
anatomy_guard=anatomy_guard,
|
||||
subject_count_guard=subject_count_guard,
|
||||
@@ -2730,6 +2837,7 @@ NODE_CLASS_MAPPINGS = {
|
||||
"DumasCharacterReference": DumasCharacterReferenceNode,
|
||||
"DumasLocationReference": DumasLocationReferenceNode,
|
||||
"DumasSoundscapeHelper": DumasSoundscapeHelperNode,
|
||||
"DumasBackgroundMusicHelper": DumasBackgroundMusicHelperNode,
|
||||
"DumasH3PromptCurator": DumasH3PromptCuratorNode,
|
||||
"DumasAnchorStyle": DumasAnchorStyleNode,
|
||||
"DumasCharacterHelper": DumasCharacterHelperNode,
|
||||
@@ -2746,6 +2854,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"DumasCharacterReference": "Dumas Character Reference",
|
||||
"DumasLocationReference": "Dumas Location Reference",
|
||||
"DumasSoundscapeHelper": "Dumas Soundscape Helper",
|
||||
"DumasBackgroundMusicHelper": "Dumas Background Music Helper",
|
||||
"DumasH3PromptCurator": "Dumas H3 Prompt Curator",
|
||||
"DumasAnchorStyle": "Dumas Anchor Style",
|
||||
"DumasCharacterHelper": "Dumas Character Helper",
|
||||
|
||||
Reference in New Issue
Block a user