Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e973a0d785 | ||
|
|
388de1d837 | ||
|
|
338150648b | ||
|
|
7de62226f2 |
@@ -57,11 +57,12 @@
|
|||||||
- Builds one H3 prompt block per beat, with quick controls for per-shot timing, continuity, ref behavior, anchor additions, soundscape, and music while staying compatible with direct text editing.
|
- Builds one H3 prompt block per beat, with quick controls for per-shot timing, continuity, ref behavior, anchor additions, soundscape, and music while staying compatible with direct text editing.
|
||||||
|
|
||||||
- `Dumas H3 Prompt Curator`
|
- `Dumas H3 Prompt Curator`
|
||||||
- Inputs: `action_prompt`, `anatomy_guard`, `subject_count_guard`, optional `anchor`, optional `soundscape`, optional `ref_1` through `ref_9`
|
- Inputs: `action_prompt`, `anatomy_guard`, `subject_count_guard`, optional `anchor`, optional `soundscape`, optional `bgm`, optional `ref_1` through `ref_9`
|
||||||
- Outputs: `prompt`, `ref_image_1` through `ref_image_9`, `reference_count`, `debug`
|
- Outputs: `prompt`, `ref_image_1` through `ref_image_9`, `reference_count`, `debug`, `anchor`, `sounds`, `bgm`, `original_ref_1` through `original_ref_9`, `reference_description`
|
||||||
- Builds one standalone MiniMax H3 prompt from your final action text plus structured character/location references.
|
- Builds one standalone MiniMax H3 prompt from your final action text plus structured character/location references.
|
||||||
- The action text can mention references by character/location name, alias, `<Picture N>`, or `<refN>`. Only mentioned references are emitted, and the output images are compacted/renumbered so skipped inputs do not leave gaps.
|
- The action text can mention references by character/location name, alias, `<Picture N>`, or `<refN>`. Only mentioned references are emitted, and the output images are compacted/renumbered so skipped inputs do not leave gaps.
|
||||||
- Adds curated reference context, anatomy guard text, optional subject-count guard text, anchor/style text, and `overall_soundscape:` text while respecting MiniMax H3's reference-generation shape: one prompt plus up to nine reference images.
|
- Extra component outputs expose the cleaned anchor, sounds, BGM, selected structured references in compacted order, and the compiled reference-description block used inside the prompt.
|
||||||
|
- Adds curated reference context, anatomy guard text, optional subject-count guard text, anchor/style text, `overall_soundscape:` text, and `background_music:` text while respecting MiniMax H3's reference-generation shape: one prompt plus up to nine reference images.
|
||||||
|
|
||||||
- `Dumas H3 Shot Length`
|
- `Dumas H3 Shot Length`
|
||||||
- Inputs: `shot_seconds`, `fps`, optional `cap_to_h3_max`
|
- Inputs: `shot_seconds`, `fps`, optional `cap_to_h3_max`
|
||||||
@@ -100,12 +101,17 @@
|
|||||||
- Output: `anchor`
|
- Output: `anchor`
|
||||||
- Offers a large preset dropdown of anchor-style titles such as cinematic action movie, comedy, found footage, 90s sitcom, mobile/cell phone captured, news broadcast, mockumentary, heist thriller, cyberpunk neon, nature documentary, courtroom drama, and more.
|
- Offers a large preset dropdown of anchor-style titles such as cinematic action movie, comedy, found footage, 90s sitcom, mobile/cell phone captured, news broadcast, mockumentary, heist thriller, cyberpunk neon, nature documentary, courtroom drama, and more.
|
||||||
- The preset wording is tuned for H3-safe persistent anchors: camera language, lighting, texture, production treatment, and tone, without naming characters or describing one-off actions.
|
- The preset wording is tuned for H3-safe persistent anchors: camera language, lighting, texture, production treatment, and tone, without naming characters or describing one-off actions.
|
||||||
- Selecting a preset fills the editable description field, and the edited multiline description is the `STRING` value passed downstream into H3 anchor sockets such as `anchor_override`.
|
- Selecting a preset fills the editable description field, and the edited multiline description is the `STRING` value passed downstream.
|
||||||
|
|
||||||
- `Dumas Soundscape Helper`
|
- `Dumas Soundscape Helper`
|
||||||
- Inputs: `soundscape`, `soundscape_description`
|
- Inputs: `soundscape`, `soundscape_description`
|
||||||
- Output: `soundscape`
|
- Output: `soundscape`
|
||||||
- Matching soundscape helper for standalone H3 prompts. Pick a preset such as quiet interior, rainy street, cafe, city night, forest, industrial, or silent, then edit the text that flows into `Dumas H3 Prompt Curator`.
|
- Matching soundscape helper for standalone H3 prompts. Pick a preset such as quiet interior, rainy street, cafe, city night, forest, industrial, or silent; the preset fills the editable textbox, and the edited text flows into `Dumas H3 Prompt Curator`.
|
||||||
|
|
||||||
|
- `Dumas Background Music Helper`
|
||||||
|
- Inputs: `bgm`, `bgm_description`
|
||||||
|
- Output: `bgm`
|
||||||
|
- Matching BGM helper for standalone H3 prompts. Pick a preset such as subtle tension, cinematic suspense, emotional piano, dark ambient, hopeful orchestral, retro synth, action pulse, lo-fi, or no vocals; the preset fills the editable textbox, and the edited text flows into `Dumas H3 Prompt Curator`.
|
||||||
|
|
||||||
- `Dumas JSON String to Object`
|
- `Dumas JSON String to Object`
|
||||||
- Input: `json_string`
|
- Input: `json_string`
|
||||||
@@ -263,7 +269,7 @@ decr -> use index - 1
|
|||||||
|
|
||||||
`Dumas H3 Plan Attach Scene Images` and `Dumas H3 Plan Extract Scene Images` are a companion pair for `ComfyUI-MiniMaxH3-Contex-Loop` and the local `ref2v` lane. The upstream H3 plan node cannot dynamically grow nine new image sockets for every JSON-defined scene, so Dumas stores scene image bindings beside the plan using a lightweight token and an in-memory registry. That keeps `plan.json` archiving intact while still letting you wire up nine IMAGE sockets per scene through chained helper nodes.
|
`Dumas H3 Plan Attach Scene Images` and `Dumas H3 Plan Extract Scene Images` are a companion pair for `ComfyUI-MiniMaxH3-Contex-Loop` and the local `ref2v` lane. The upstream H3 plan node cannot dynamically grow nine new image sockets for every JSON-defined scene, so Dumas stores scene image bindings beside the plan using a lightweight token and an in-memory registry. That keeps `plan.json` archiving intact while still letting you wire up nine IMAGE sockets per scene through chained helper nodes.
|
||||||
|
|
||||||
`Dumas Character Helper` is the restored two-image/text helper for general H3 workflows, and `Dumas Location Helper` mirrors it for scene/environment references. Both helpers also emit structured `REFERENCE` sockets for the curator. The structured `Dumas Character Reference` and `Dumas Location Reference` nodes remain available separately for workflows that want a single `REFERENCE` socket. `Dumas H3 Prompt Curator` consumes those structured references, assigns the final `<Picture N>` numbering, and outputs only the compacted images the prompt actually mentions.
|
`Dumas Character Helper` is the restored two-image/text helper for general H3 workflows, and `Dumas Location Helper` mirrors it for scene/environment references. Both helpers also emit structured `REFERENCE` sockets for the curator. The structured `Dumas Character Reference` and `Dumas Location Reference` nodes remain available separately for workflows that want a single `REFERENCE` socket. `Dumas H3 Prompt Curator` consumes those structured references plus optional anchor, soundscape, and BGM strings, assigns the final `<Picture N>` numbering, and outputs only the compacted images the prompt actually mentions.
|
||||||
|
|
||||||
`Dumas Strip Iteration Suffix` keeps the part before the first underscore and drops the rest. Names like `char123_pose_final.png` become `char123.png`, while names with no underscore such as `char123.png` are left untouched.
|
`Dumas Strip Iteration Suffix` keeps the part before the first underscore and drops the rest. Names like `char123_pose_final.png` become `char123.png`, while names with no underscore such as `char123.png` are left untouched.
|
||||||
|
|
||||||
|
|||||||
+168
-10
@@ -27,6 +27,12 @@ _H3_PLAN_IMAGE_BINDINGS_CAP = 128
|
|||||||
_H3_PLAN_IMAGE_SLOTS = 9
|
_H3_PLAN_IMAGE_SLOTS = 9
|
||||||
_FOLDER_IMAGE_EXTS = (".png", ".jpg", ".jpeg", ".webp", ".bmp", ".gif", ".tiff", ".tif")
|
_FOLDER_IMAGE_EXTS = (".png", ".jpg", ".jpeg", ".webp", ".bmp", ".gif", ".tiff", ".tif")
|
||||||
_ANCHOR_STYLE_H3_NOTE = ""
|
_ANCHOR_STYLE_H3_NOTE = ""
|
||||||
|
_ANCHOR_STYLE_LEGACY_NOTE_RE = re.compile(
|
||||||
|
r"\s*Keep this anchor focused on persistent camera language, lighting, "
|
||||||
|
r"texture, environment treatment, and tone; do not name characters or "
|
||||||
|
r"describe one-off actions\.?",
|
||||||
|
re.I,
|
||||||
|
)
|
||||||
_H3_PROMPT_REF_SLOTS = 9
|
_H3_PROMPT_REF_SLOTS = 9
|
||||||
_H3_PROMPT_MAX_CHARS = 7000
|
_H3_PROMPT_MAX_CHARS = 7000
|
||||||
_PICTURE_TAG_RE = re.compile(r"<\s*picture[\s_\-]*(\d+)\s*>", re.I)
|
_PICTURE_TAG_RE = re.compile(r"<\s*picture[\s_\-]*(\d+)\s*>", re.I)
|
||||||
@@ -392,6 +398,51 @@ _SOUNDSCAPE_PRESETS = OrderedDict(
|
|||||||
("custom", ""),
|
("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():
|
def _soundscape_options():
|
||||||
@@ -400,6 +451,14 @@ def _soundscape_options():
|
|||||||
|
|
||||||
def _soundscape_description(soundscape_name):
|
def _soundscape_description(soundscape_name):
|
||||||
return _SOUNDSCAPE_PRESETS.get(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 = {
|
_LOAD_IMAGES_FOLDER_DEFAULT_STATE = {
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"folder": "",
|
"folder": "",
|
||||||
@@ -420,6 +479,11 @@ def _anchor_style_description(style_name):
|
|||||||
return _ANCHOR_STYLE_PRESETS.get(str(style_name or "").strip().lower(), "")
|
return _ANCHOR_STYLE_PRESETS.get(str(style_name or "").strip().lower(), "")
|
||||||
|
|
||||||
|
|
||||||
|
def _clean_anchor_style_text(text):
|
||||||
|
cleaned = _ANCHOR_STYLE_LEGACY_NOTE_RE.sub("", str(text or ""))
|
||||||
|
return re.sub(r"[ \t]{2,}", " ", cleaned).strip()
|
||||||
|
|
||||||
|
|
||||||
def _clean_input_token_value(value):
|
def _clean_input_token_value(value):
|
||||||
cleaned = ""
|
cleaned = ""
|
||||||
if value is not None:
|
if value is not None:
|
||||||
@@ -1176,6 +1240,7 @@ def curate_h3_prompt(
|
|||||||
action_prompt,
|
action_prompt,
|
||||||
anchor="",
|
anchor="",
|
||||||
soundscape="",
|
soundscape="",
|
||||||
|
bgm="",
|
||||||
refs=(),
|
refs=(),
|
||||||
anatomy_guard="auto",
|
anatomy_guard="auto",
|
||||||
subject_count_guard="auto",
|
subject_count_guard="auto",
|
||||||
@@ -1184,12 +1249,19 @@ def curate_h3_prompt(
|
|||||||
selected = _selected_prompt_refs(action_prompt, normalized_refs)
|
selected = _selected_prompt_refs(action_prompt, normalized_refs)
|
||||||
picture_map = {slot_number: index for index, (slot_number, _ref) in enumerate(selected, 1)}
|
picture_map = {slot_number: index for index, (slot_number, _ref) in enumerate(selected, 1)}
|
||||||
action = _replace_reference_tags(action_prompt, picture_map)
|
action = _replace_reference_tags(action_prompt, picture_map)
|
||||||
|
anchor_text = _reference_text(anchor)
|
||||||
|
soundscape_text = _reference_text(soundscape)
|
||||||
|
bgm_text = _reference_text(bgm)
|
||||||
|
reference_description = ""
|
||||||
|
if selected:
|
||||||
|
reference_description = " ".join(
|
||||||
|
_reference_context(ref, picture_number)
|
||||||
|
for picture_number, (_slot, ref) in enumerate(selected, 1)
|
||||||
|
)
|
||||||
|
|
||||||
prompt_parts = []
|
prompt_parts = []
|
||||||
_append_prompt_section(prompt_parts, "Scene anchor", anchor)
|
_append_prompt_section(prompt_parts, "Scene anchor", anchor_text)
|
||||||
if selected:
|
_append_prompt_section(prompt_parts, "Reference context", reference_description)
|
||||||
contexts = [_reference_context(ref, picture_number) for picture_number, (_slot, ref) in enumerate(selected, 1)]
|
|
||||||
_append_prompt_section(prompt_parts, "Reference context", " ".join(contexts))
|
|
||||||
_append_prompt_section(prompt_parts, "Action", action)
|
_append_prompt_section(prompt_parts, "Action", action)
|
||||||
if anatomy_guard == "on" or (anatomy_guard == "auto" and any(ref.get("kind") == "character" for _slot, ref in selected)):
|
if anatomy_guard == "on" or (anatomy_guard == "auto" and any(ref.get("kind") == "character" for _slot, ref in selected)):
|
||||||
_append_prompt_section(prompt_parts, "Anatomy guard", _ANATOMY_GUARD_TEXT)
|
_append_prompt_section(prompt_parts, "Anatomy guard", _ANATOMY_GUARD_TEXT)
|
||||||
@@ -1197,13 +1269,16 @@ def curate_h3_prompt(
|
|||||||
subject_count_guard == "auto" and any(ref.get("kind") == "character" for _slot, ref in selected)
|
subject_count_guard == "auto" and any(ref.get("kind") == "character" for _slot, ref in selected)
|
||||||
):
|
):
|
||||||
_append_prompt_section(prompt_parts, "Subject count guard", _subject_count_guard_text(selected))
|
_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, "overall_soundscape", soundscape_text)
|
||||||
|
_append_prompt_section(prompt_parts, "background_music", bgm_text)
|
||||||
|
|
||||||
prompt = "\n\n".join(prompt_parts).strip()
|
prompt = "\n\n".join(prompt_parts).strip()
|
||||||
if len(prompt) > _H3_PROMPT_MAX_CHARS:
|
if len(prompt) > _H3_PROMPT_MAX_CHARS:
|
||||||
prompt = prompt[: _H3_PROMPT_MAX_CHARS - 3].rstrip() + "..."
|
prompt = prompt[: _H3_PROMPT_MAX_CHARS - 3].rstrip() + "..."
|
||||||
images = [_reference_image(ref) for _slot, ref in selected]
|
images = [_reference_image(ref) for _slot, ref in selected]
|
||||||
images.extend([None] * (_H3_PROMPT_REF_SLOTS - len(images)))
|
images.extend([None] * (_H3_PROMPT_REF_SLOTS - len(images)))
|
||||||
|
selected_refs = [ref for _slot, ref in selected]
|
||||||
|
selected_refs.extend([None] * (_H3_PROMPT_REF_SLOTS - len(selected_refs)))
|
||||||
debug = (
|
debug = (
|
||||||
f"Selected {len(selected)} reference(s): "
|
f"Selected {len(selected)} reference(s): "
|
||||||
+ ", ".join(
|
+ ", ".join(
|
||||||
@@ -1213,7 +1288,17 @@ def curate_h3_prompt(
|
|||||||
if selected
|
if selected
|
||||||
else "Selected 0 references."
|
else "Selected 0 references."
|
||||||
)
|
)
|
||||||
return (prompt, *images[:_H3_PROMPT_REF_SLOTS], len(selected), debug)
|
return (
|
||||||
|
prompt,
|
||||||
|
*images[:_H3_PROMPT_REF_SLOTS],
|
||||||
|
len(selected),
|
||||||
|
debug,
|
||||||
|
anchor_text,
|
||||||
|
soundscape_text,
|
||||||
|
bgm_text,
|
||||||
|
*selected_refs[:_H3_PROMPT_REF_SLOTS],
|
||||||
|
reference_description,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _parse_positive_int(value):
|
def _parse_positive_int(value):
|
||||||
@@ -2550,14 +2635,63 @@ class DumasSoundscapeHelperNode:
|
|||||||
return (text,)
|
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:
|
class DumasH3PromptCuratorNode:
|
||||||
DESCRIPTION = (
|
DESCRIPTION = (
|
||||||
"Curate one MiniMax H3 prompt from an action textbox, anchor text, "
|
"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> "
|
"compacted so only mentioned names, aliases, or explicit <Picture N>/<refN> "
|
||||||
"tags are sent onward."
|
"tags are sent onward."
|
||||||
)
|
)
|
||||||
RETURN_TYPES = ("STRING",) + ("IMAGE",) * _H3_PROMPT_REF_SLOTS + ("INT", "STRING")
|
RETURN_TYPES = (
|
||||||
|
("STRING",)
|
||||||
|
+ ("IMAGE",) * _H3_PROMPT_REF_SLOTS
|
||||||
|
+ ("INT", "STRING", "STRING", "STRING", "STRING")
|
||||||
|
+ (_REFERENCE_TYPE,) * _H3_PROMPT_REF_SLOTS
|
||||||
|
+ ("STRING",)
|
||||||
|
)
|
||||||
RETURN_NAMES = (
|
RETURN_NAMES = (
|
||||||
"prompt",
|
"prompt",
|
||||||
"ref_image_1",
|
"ref_image_1",
|
||||||
@@ -2571,6 +2705,19 @@ class DumasH3PromptCuratorNode:
|
|||||||
"ref_image_9",
|
"ref_image_9",
|
||||||
"reference_count",
|
"reference_count",
|
||||||
"debug",
|
"debug",
|
||||||
|
"anchor",
|
||||||
|
"sounds",
|
||||||
|
"bgm",
|
||||||
|
"original_ref_1",
|
||||||
|
"original_ref_2",
|
||||||
|
"original_ref_3",
|
||||||
|
"original_ref_4",
|
||||||
|
"original_ref_5",
|
||||||
|
"original_ref_6",
|
||||||
|
"original_ref_7",
|
||||||
|
"original_ref_8",
|
||||||
|
"original_ref_9",
|
||||||
|
"reference_description",
|
||||||
)
|
)
|
||||||
FUNCTION = "curate_prompt"
|
FUNCTION = "curate_prompt"
|
||||||
CATEGORY = "Dumas/MiniMax"
|
CATEGORY = "Dumas/MiniMax"
|
||||||
@@ -2592,6 +2739,13 @@ class DumasH3PromptCuratorNode:
|
|||||||
"tooltip": "Optional soundscape text, usually from Dumas Soundscape Helper.",
|
"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):
|
for slot in range(1, _H3_PROMPT_REF_SLOTS + 1):
|
||||||
optional[f"ref_{slot}"] = (
|
optional[f"ref_{slot}"] = (
|
||||||
@@ -2647,6 +2801,7 @@ class DumasH3PromptCuratorNode:
|
|||||||
subject_count_guard,
|
subject_count_guard,
|
||||||
anchor="",
|
anchor="",
|
||||||
soundscape="",
|
soundscape="",
|
||||||
|
bgm="",
|
||||||
ref_1=None,
|
ref_1=None,
|
||||||
ref_2=None,
|
ref_2=None,
|
||||||
ref_3=None,
|
ref_3=None,
|
||||||
@@ -2661,6 +2816,7 @@ class DumasH3PromptCuratorNode:
|
|||||||
action_prompt,
|
action_prompt,
|
||||||
anchor=anchor,
|
anchor=anchor,
|
||||||
soundscape=soundscape,
|
soundscape=soundscape,
|
||||||
|
bgm=bgm,
|
||||||
refs=(ref_1, ref_2, ref_3, ref_4, ref_5, ref_6, ref_7, ref_8, ref_9),
|
refs=(ref_1, ref_2, ref_3, ref_4, ref_5, ref_6, ref_7, ref_8, ref_9),
|
||||||
anatomy_guard=anatomy_guard,
|
anatomy_guard=anatomy_guard,
|
||||||
subject_count_guard=subject_count_guard,
|
subject_count_guard=subject_count_guard,
|
||||||
@@ -2704,9 +2860,9 @@ class DumasAnchorStyleNode:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def build_anchor(self, anchor_style, style_description):
|
def build_anchor(self, anchor_style, style_description):
|
||||||
text = str(style_description or "").strip()
|
text = _clean_anchor_style_text(style_description)
|
||||||
if not text:
|
if not text:
|
||||||
text = _anchor_style_description(anchor_style)
|
text = _clean_anchor_style_text(_anchor_style_description(anchor_style))
|
||||||
return (text,)
|
return (text,)
|
||||||
|
|
||||||
|
|
||||||
@@ -2719,6 +2875,7 @@ NODE_CLASS_MAPPINGS = {
|
|||||||
"DumasCharacterReference": DumasCharacterReferenceNode,
|
"DumasCharacterReference": DumasCharacterReferenceNode,
|
||||||
"DumasLocationReference": DumasLocationReferenceNode,
|
"DumasLocationReference": DumasLocationReferenceNode,
|
||||||
"DumasSoundscapeHelper": DumasSoundscapeHelperNode,
|
"DumasSoundscapeHelper": DumasSoundscapeHelperNode,
|
||||||
|
"DumasBackgroundMusicHelper": DumasBackgroundMusicHelperNode,
|
||||||
"DumasH3PromptCurator": DumasH3PromptCuratorNode,
|
"DumasH3PromptCurator": DumasH3PromptCuratorNode,
|
||||||
"DumasAnchorStyle": DumasAnchorStyleNode,
|
"DumasAnchorStyle": DumasAnchorStyleNode,
|
||||||
"DumasCharacterHelper": DumasCharacterHelperNode,
|
"DumasCharacterHelper": DumasCharacterHelperNode,
|
||||||
@@ -2735,6 +2892,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
|||||||
"DumasCharacterReference": "Dumas Character Reference",
|
"DumasCharacterReference": "Dumas Character Reference",
|
||||||
"DumasLocationReference": "Dumas Location Reference",
|
"DumasLocationReference": "Dumas Location Reference",
|
||||||
"DumasSoundscapeHelper": "Dumas Soundscape Helper",
|
"DumasSoundscapeHelper": "Dumas Soundscape Helper",
|
||||||
|
"DumasBackgroundMusicHelper": "Dumas Background Music Helper",
|
||||||
"DumasH3PromptCurator": "Dumas H3 Prompt Curator",
|
"DumasH3PromptCurator": "Dumas H3 Prompt Curator",
|
||||||
"DumasAnchorStyle": "Dumas Anchor Style",
|
"DumasAnchorStyle": "Dumas Anchor Style",
|
||||||
"DumasCharacterHelper": "Dumas Character Helper",
|
"DumasCharacterHelper": "Dumas Character Helper",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { app } from "/scripts/app.js";
|
|||||||
const NODE_NAME = "DumasAnchorStyle";
|
const NODE_NAME = "DumasAnchorStyle";
|
||||||
const STYLE_INPUT = "anchor_style";
|
const STYLE_INPUT = "anchor_style";
|
||||||
const DESCRIPTION_INPUT = "style_description";
|
const DESCRIPTION_INPUT = "style_description";
|
||||||
const H3_NOTE = " Keep this anchor focused on persistent camera language, lighting, texture, environment treatment, and tone; do not name characters or describe one-off actions.";
|
const H3_NOTE = "";
|
||||||
const PRESETS = {
|
const PRESETS = {
|
||||||
"cinematic action movie": "Big-screen action cinema with assertive visual storytelling: dynamic camera placement, strong forward momentum, crisp geography, muscular lighting contrast, practical atmosphere, and a sense of physical consequence. Favor heroic framing, controlled handheld energy or motivated tracking moves, dramatic silhouettes, tasteful lens flares, impact-driven pacing, and polished studio spectacle without drifting into comic-book unreality unless the shot explicitly asks for it." + H3_NOTE,
|
"cinematic action movie": "Big-screen action cinema with assertive visual storytelling: dynamic camera placement, strong forward momentum, crisp geography, muscular lighting contrast, practical atmosphere, and a sense of physical consequence. Favor heroic framing, controlled handheld energy or motivated tracking moves, dramatic silhouettes, tasteful lens flares, impact-driven pacing, and polished studio spectacle without drifting into comic-book unreality unless the shot explicitly asks for it." + H3_NOTE,
|
||||||
"comedy": "Play the scene for comedic readability and timing: clear staging, expressive performances, slightly heightened reactions, clean eyelines, and visual beats that leave room for the joke to land. Use bright approachable lighting, grounded but playful production design, readable framing, and a tone that feels observant, awkward, or absurd without becoming broad parody unless the action supports it." + H3_NOTE,
|
"comedy": "Play the scene for comedic readability and timing: clear staging, expressive performances, slightly heightened reactions, clean eyelines, and visual beats that leave room for the joke to land. Use bright approachable lighting, grounded but playful production design, readable framing, and a tone that feels observant, awkward, or absurd without becoming broad parody unless the action supports it." + H3_NOTE,
|
||||||
@@ -51,28 +51,72 @@ const PRESETS = {
|
|||||||
"fantasy adventure": "Rousing fantasy-adventure language: scenic scale, adventurous clarity, tactile costume-and-prop detail, and camera movement that feels exploratory rather than oppressive. Favor storybook geography, weathered materials, golden or stormy atmosphere, and a tone of peril, wonder, and forward motion." + H3_NOTE,
|
"fantasy adventure": "Rousing fantasy-adventure language: scenic scale, adventurous clarity, tactile costume-and-prop detail, and camera movement that feels exploratory rather than oppressive. Favor storybook geography, weathered materials, golden or stormy atmosphere, and a tone of peril, wonder, and forward motion." + H3_NOTE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const SOUNDSCAPE_PRESETS = {
|
||||||
|
"quiet interior": "quiet indoor room tone, faint ventilation and distant household ambience",
|
||||||
|
"rainy street": "steady rain, wet pavement, distant traffic hum",
|
||||||
|
"cafe": "low room tone, faint glassware, cutlery, and muted conversation",
|
||||||
|
"city night": "distant traffic hum, occasional horn, night air",
|
||||||
|
"forest": "wind in leaves, distant birds, soft natural ambience",
|
||||||
|
"industrial": "large interior reverb, distant metal ticks, low machine hum",
|
||||||
|
"silent": "no dialogue, no vocals, only the natural ambient bed of the scene",
|
||||||
|
"custom": "",
|
||||||
|
};
|
||||||
|
|
||||||
|
const BGM_PRESETS = {
|
||||||
|
"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": "",
|
||||||
|
};
|
||||||
|
|
||||||
|
const NODE_CONFIGS = {
|
||||||
|
[NODE_NAME]: {
|
||||||
|
presetInput: STYLE_INPUT,
|
||||||
|
descriptionInput: DESCRIPTION_INPUT,
|
||||||
|
presets: PRESETS,
|
||||||
|
},
|
||||||
|
DumasSoundscapeHelper: {
|
||||||
|
presetInput: "soundscape",
|
||||||
|
descriptionInput: "soundscape_description",
|
||||||
|
presets: SOUNDSCAPE_PRESETS,
|
||||||
|
},
|
||||||
|
DumasBackgroundMusicHelper: {
|
||||||
|
presetInput: "bgm",
|
||||||
|
descriptionInput: "bgm_description",
|
||||||
|
presets: BGM_PRESETS,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
function findWidget(node, name) {
|
function findWidget(node, name) {
|
||||||
return (node.widgets || []).find((widget) => widget?.name === name) || null;
|
return (node.widgets || []).find((widget) => widget?.name === name) || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: "Dumas.AnchorStyle",
|
name: "Dumas.PresetTextHelpers",
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData) {
|
async beforeRegisterNodeDef(nodeType, nodeData) {
|
||||||
if (nodeData?.name !== NODE_NAME) return;
|
const config = NODE_CONFIGS[nodeData?.name];
|
||||||
|
if (!config) return;
|
||||||
|
|
||||||
const originalOnNodeCreated = nodeType.prototype.onNodeCreated;
|
const originalOnNodeCreated = nodeType.prototype.onNodeCreated;
|
||||||
|
|
||||||
nodeType.prototype.onNodeCreated = function onNodeCreated() {
|
nodeType.prototype.onNodeCreated = function onNodeCreated() {
|
||||||
const created = originalOnNodeCreated?.apply(this, arguments);
|
const created = originalOnNodeCreated?.apply(this, arguments);
|
||||||
const styleWidget = findWidget(this, STYLE_INPUT);
|
const styleWidget = findWidget(this, config.presetInput);
|
||||||
const descriptionWidget = findWidget(this, DESCRIPTION_INPUT);
|
const descriptionWidget = findWidget(this, config.descriptionInput);
|
||||||
if (!styleWidget || !descriptionWidget) return created;
|
if (!styleWidget || !descriptionWidget) return created;
|
||||||
|
|
||||||
const originalCallback = styleWidget.callback;
|
const originalCallback = styleWidget.callback;
|
||||||
styleWidget.callback = (...args) => {
|
styleWidget.callback = (...args) => {
|
||||||
const selected = String(styleWidget.value || "");
|
const selected = String(styleWidget.value || "");
|
||||||
if (Object.hasOwn(PRESETS, selected)) {
|
if (Object.hasOwn(config.presets, selected)) {
|
||||||
descriptionWidget.value = PRESETS[selected];
|
descriptionWidget.value = config.presets[selected];
|
||||||
descriptionWidget.inputEl?.dispatchEvent(new Event("input", { bubbles: true }));
|
descriptionWidget.inputEl?.dispatchEvent(new Event("input", { bubbles: true }));
|
||||||
}
|
}
|
||||||
this.setDirtyCanvas?.(true, true);
|
this.setDirtyCanvas?.(true, true);
|
||||||
|
|||||||
@@ -440,6 +440,13 @@ class DumasImageNodeTests(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEqual(result[0], "steady rain, wet pavement, distant traffic hum")
|
self.assertEqual(result[0], "steady rain, wet pavement, distant traffic hum")
|
||||||
|
|
||||||
|
def test_background_music_helper_defaults_to_selected_preset_description(self):
|
||||||
|
node = self.image_nodes.DumasBackgroundMusicHelperNode()
|
||||||
|
|
||||||
|
result = node.build_bgm("subtle tension", "")
|
||||||
|
|
||||||
|
self.assertEqual(result[0], "low, restrained tension bed with sparse pulses and no vocals")
|
||||||
|
|
||||||
def test_h3_prompt_curator_compacts_named_references(self):
|
def test_h3_prompt_curator_compacts_named_references(self):
|
||||||
node = self.image_nodes.DumasH3PromptCuratorNode()
|
node = self.image_nodes.DumasH3PromptCuratorNode()
|
||||||
dave_image = FakeTensorBatch()
|
dave_image = FakeTensorBatch()
|
||||||
@@ -472,6 +479,7 @@ class DumasImageNodeTests(unittest.TestCase):
|
|||||||
subject_count_guard="auto",
|
subject_count_guard="auto",
|
||||||
anchor="grounded handheld thriller",
|
anchor="grounded handheld thriller",
|
||||||
soundscape="steady rain",
|
soundscape="steady rain",
|
||||||
|
bgm="low suspense music",
|
||||||
ref_1=dave,
|
ref_1=dave,
|
||||||
ref_2=van,
|
ref_2=van,
|
||||||
ref_3=cafe,
|
ref_3=cafe,
|
||||||
@@ -483,12 +491,25 @@ class DumasImageNodeTests(unittest.TestCase):
|
|||||||
self.assertIn("Action: Dave runs from the Coffee Shop into the rain.", prompt)
|
self.assertIn("Action: Dave runs from the Coffee Shop into the rain.", prompt)
|
||||||
self.assertIn("Anatomy guard:", prompt)
|
self.assertIn("Anatomy guard:", prompt)
|
||||||
self.assertIn("Subject count guard:", prompt)
|
self.assertIn("Subject count guard:", prompt)
|
||||||
|
self.assertIn("overall_soundscape: steady rain", prompt)
|
||||||
|
self.assertIn("background_music: low suspense music", prompt)
|
||||||
self.assertIn("exactly one named character: <Picture 1> Dave", prompt)
|
self.assertIn("exactly one named character: <Picture 1> Dave", prompt)
|
||||||
self.assertIs(result[1], dave_image)
|
self.assertIs(result[1], dave_image)
|
||||||
self.assertIs(result[2], cafe_image)
|
self.assertIs(result[2], cafe_image)
|
||||||
self.assertIsNone(result[3])
|
self.assertIsNone(result[3])
|
||||||
self.assertEqual(result[10], 2)
|
self.assertEqual(result[10], 2)
|
||||||
self.assertIn("input 3-><Picture 2> Coffee Shop", result[11])
|
self.assertIn("input 3-><Picture 2> Coffee Shop", result[11])
|
||||||
|
self.assertEqual(result[12], "grounded handheld thriller")
|
||||||
|
self.assertEqual(result[13], "steady rain")
|
||||||
|
self.assertEqual(result[14], "low suspense music")
|
||||||
|
self.assertEqual(result[15]["name"], "Dave")
|
||||||
|
self.assertIs(result[15]["image"], dave_image)
|
||||||
|
self.assertEqual(result[16]["name"], "Coffee Shop")
|
||||||
|
self.assertIs(result[16]["image"], cafe_image)
|
||||||
|
self.assertIsNone(result[17])
|
||||||
|
self.assertIn("<Picture 1> Dave", result[24])
|
||||||
|
self.assertIn("<Picture 2> Coffee Shop", result[24])
|
||||||
|
self.assertIn("Location context for <Picture 2> Coffee Shop", result[24])
|
||||||
|
|
||||||
def test_h3_prompt_curator_renumbers_explicit_reference_tags(self):
|
def test_h3_prompt_curator_renumbers_explicit_reference_tags(self):
|
||||||
node = self.image_nodes.DumasH3PromptCuratorNode()
|
node = self.image_nodes.DumasH3PromptCuratorNode()
|
||||||
@@ -616,16 +637,21 @@ class DumasImageNodeTests(unittest.TestCase):
|
|||||||
self.assertIs(mappings["DumasCharacterHelper"], self.image_nodes.DumasCharacterHelperNode)
|
self.assertIs(mappings["DumasCharacterHelper"], self.image_nodes.DumasCharacterHelperNode)
|
||||||
self.assertIs(mappings["DumasLocationHelper"], self.image_nodes.DumasLocationHelperNode)
|
self.assertIs(mappings["DumasLocationHelper"], self.image_nodes.DumasLocationHelperNode)
|
||||||
self.assertIs(mappings["DumasSoundscapeHelper"], self.image_nodes.DumasSoundscapeHelperNode)
|
self.assertIs(mappings["DumasSoundscapeHelper"], self.image_nodes.DumasSoundscapeHelperNode)
|
||||||
|
self.assertIs(mappings["DumasBackgroundMusicHelper"], self.image_nodes.DumasBackgroundMusicHelperNode)
|
||||||
self.assertIs(mappings["DumasH3PromptCurator"], self.image_nodes.DumasH3PromptCuratorNode)
|
self.assertIs(mappings["DumasH3PromptCurator"], self.image_nodes.DumasH3PromptCuratorNode)
|
||||||
self.assertEqual(display["DumasCharacterHelper"], "Dumas Character Helper")
|
self.assertEqual(display["DumasCharacterHelper"], "Dumas Character Helper")
|
||||||
self.assertEqual(display["DumasLocationHelper"], "Dumas Location Helper")
|
self.assertEqual(display["DumasLocationHelper"], "Dumas Location Helper")
|
||||||
self.assertEqual(display["DumasSoundscapeHelper"], "Dumas Soundscape Helper")
|
self.assertEqual(display["DumasSoundscapeHelper"], "Dumas Soundscape Helper")
|
||||||
|
self.assertEqual(display["DumasBackgroundMusicHelper"], "Dumas Background Music Helper")
|
||||||
self.assertEqual(display["DumasH3PromptCurator"], "Dumas H3 Prompt Curator")
|
self.assertEqual(display["DumasH3PromptCurator"], "Dumas H3 Prompt Curator")
|
||||||
|
|
||||||
def test_h3_prompt_curator_uses_documented_reference_limits(self):
|
def test_h3_prompt_curator_uses_documented_reference_limits(self):
|
||||||
node = self.image_nodes.DumasH3PromptCuratorNode()
|
node = self.image_nodes.DumasH3PromptCuratorNode()
|
||||||
self.assertEqual(len(node.RETURN_TYPES), 12)
|
self.assertEqual(len(node.RETURN_TYPES), 25)
|
||||||
self.assertEqual(node.RETURN_NAMES[1:10], tuple(f"ref_image_{i}" for i in range(1, 10)))
|
self.assertEqual(node.RETURN_NAMES[1:10], tuple(f"ref_image_{i}" for i in range(1, 10)))
|
||||||
|
self.assertEqual(node.RETURN_NAMES[12:15], ("anchor", "sounds", "bgm"))
|
||||||
|
self.assertEqual(node.RETURN_NAMES[15:24], tuple(f"original_ref_{i}" for i in range(1, 10)))
|
||||||
|
self.assertEqual(node.RETURN_NAMES[24], "reference_description")
|
||||||
|
|
||||||
def test_normalize_reference_upgrades_generic_summary_with_socket_picture_id(self):
|
def test_normalize_reference_upgrades_generic_summary_with_socket_picture_id(self):
|
||||||
image = FakeTensorBatch()
|
image = FakeTensorBatch()
|
||||||
@@ -688,6 +714,19 @@ class DumasImageNodeTests(unittest.TestCase):
|
|||||||
self.assertIn("real time", result[0])
|
self.assertIn("real time", result[0])
|
||||||
self.assertNotIn("persistent camera language", result[0])
|
self.assertNotIn("persistent camera language", result[0])
|
||||||
|
|
||||||
|
def test_anchor_style_node_strips_legacy_persistent_anchor_note(self):
|
||||||
|
node = self.image_nodes.DumasAnchorStyleNode()
|
||||||
|
legacy = (
|
||||||
|
"Gritty handheld realism. Keep this anchor focused on persistent camera "
|
||||||
|
"language, lighting, texture, environment treatment, and tone; do not "
|
||||||
|
"name characters or describe one-off actions."
|
||||||
|
)
|
||||||
|
|
||||||
|
result = node.build_anchor("cinematic action movie", legacy)
|
||||||
|
|
||||||
|
self.assertEqual(result[0], "Gritty handheld realism.")
|
||||||
|
self.assertNotIn("persistent camera language", result[0])
|
||||||
|
|
||||||
def test_anchor_style_node_prefers_manual_description_edits(self):
|
def test_anchor_style_node_prefers_manual_description_edits(self):
|
||||||
node = self.image_nodes.DumasAnchorStyleNode()
|
node = self.image_nodes.DumasAnchorStyleNode()
|
||||||
custom = "Lo-fi pirate broadcast with smeared highlights and anxious zoom corrections."
|
custom = "Lo-fi pirate broadcast with smeared highlights and anxious zoom corrections."
|
||||||
|
|||||||
Reference in New Issue
Block a user