Namespace vendored H3 nodes under Dumas
This commit is contained in:
@@ -9,11 +9,19 @@ upstream packs used by the MiniMax H3 workflow:
|
|||||||
- `vendor/dumas_minimax_h3_refmod/`
|
- `vendor/dumas_minimax_h3_refmod/`
|
||||||
- `vendor/dumas_h3_refmod_picker/`
|
- `vendor/dumas_h3_refmod_picker/`
|
||||||
|
|
||||||
Their registrations and browser extensions are loaded by DUMAS, and their
|
Their registrations and browser extensions are loaded by DUMAS. Every vendored
|
||||||
display names are prefixed with `DUMAS`. The upstream node IDs are retained so
|
node is registered with a stable DUMAS-prefixed ID and under a DUMAS category:
|
||||||
the full upstream UI and saved workflows remain compatible. Do not install the
|
|
||||||
three original packs at the same time as this vendored copy, or ComfyUI will
|
- `DumasH3Continuum_*` → `Dumas/MiniMax H3/Continuum`
|
||||||
load duplicate node IDs and duplicate server routes.
|
- `DumasMiniMaxH3RefMod_*` → `Dumas/MiniMax H3/RefMod`
|
||||||
|
- `DumasH3RefModPicker_*` → `Dumas/MiniMax H3/RefMod Picker`
|
||||||
|
|
||||||
|
This prevents the vendored nodes from replacing or colliding with an upstream
|
||||||
|
node of the same name. Existing workflows that use the upstream IDs are not
|
||||||
|
silently rewritten; they must continue to use the upstream pack or be
|
||||||
|
reconnected to the DUMAS nodes. The original packs should still not be loaded
|
||||||
|
alongside this copy because their server routes can overlap even though the
|
||||||
|
node IDs are now isolated.
|
||||||
|
|
||||||
The upstream source is imported as git subtrees, making future reviews and
|
The upstream source is imported as git subtrees, making future reviews and
|
||||||
selective updates possible without losing provenance. DUMAS-specific changes
|
selective updates possible without losing provenance. DUMAS-specific changes
|
||||||
|
|||||||
+74
-9
@@ -10,12 +10,15 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
import logging
|
import logging
|
||||||
|
import copy
|
||||||
|
import dataclasses
|
||||||
|
import types
|
||||||
|
|
||||||
|
|
||||||
_PACKAGES = (
|
_PACKAGES = (
|
||||||
(".vendor.dumas_h3_continuum", "H3 Continuum"),
|
(".vendor.dumas_h3_continuum", "H3 Continuum", "DumasH3Continuum", "Dumas/MiniMax H3/Continuum"),
|
||||||
(".vendor.dumas_minimax_h3_refmod", "MiniMax H3 RefMod"),
|
(".vendor.dumas_minimax_h3_refmod", "MiniMax H3 RefMod", "DumasMiniMaxH3RefMod", "Dumas/MiniMax H3/RefMod"),
|
||||||
(".vendor.dumas_h3_refmod_picker", "H3 RefMod Picker"),
|
(".vendor.dumas_h3_refmod_picker", "H3 RefMod Picker", "DumasH3RefModPicker", "Dumas/MiniMax H3/RefMod Picker"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -29,10 +32,68 @@ def _load_pack(package_name):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _patch_schema(schema, *, node_id, category, display_name):
|
||||||
|
"""Return an upstream schema with DUMAS identity and category.
|
||||||
|
|
||||||
|
Comfy's modern schema objects have changed from mutable dataclasses to
|
||||||
|
immutable value objects across API revisions. Support both forms so the
|
||||||
|
vendored nodes remain usable on the same Comfy versions as their source
|
||||||
|
packs.
|
||||||
|
"""
|
||||||
|
changes = {"node_id": node_id, "category": category, "display_name": display_name}
|
||||||
|
if dataclasses.is_dataclass(schema):
|
||||||
|
try:
|
||||||
|
return dataclasses.replace(schema, **changes)
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
pass
|
||||||
|
patched = copy.copy(schema)
|
||||||
|
for name, value in changes.items():
|
||||||
|
try:
|
||||||
|
setattr(patched, name, value)
|
||||||
|
except (AttributeError, TypeError):
|
||||||
|
try:
|
||||||
|
object.__setattr__(patched, name, value)
|
||||||
|
except (AttributeError, TypeError):
|
||||||
|
raise TypeError(
|
||||||
|
f"Cannot namespace Comfy schema {type(schema).__name__}.{name}"
|
||||||
|
) from None
|
||||||
|
return patched
|
||||||
|
|
||||||
|
|
||||||
|
def _namespace_class(node_class, *, node_id, category, display_name):
|
||||||
|
"""Wrap an upstream class without changing its execution implementation."""
|
||||||
|
define_schema = getattr(node_class, "define_schema", None)
|
||||||
|
if define_schema is None:
|
||||||
|
namespaced = types.new_class(node_class.__name__, (node_class,))
|
||||||
|
namespaced.CATEGORY = category
|
||||||
|
namespaced.NODE_CATEGORY = category
|
||||||
|
else:
|
||||||
|
def _define_schema(cls):
|
||||||
|
schema = node_class.define_schema()
|
||||||
|
return _patch_schema(
|
||||||
|
schema,
|
||||||
|
node_id=node_id,
|
||||||
|
category=category,
|
||||||
|
display_name=display_name,
|
||||||
|
)
|
||||||
|
|
||||||
|
namespaced = types.new_class(node_class.__name__, (node_class,))
|
||||||
|
namespaced.define_schema = classmethod(_define_schema)
|
||||||
|
# Older Comfy builds still inspect these class attributes while
|
||||||
|
# constructing the node search index.
|
||||||
|
namespaced.CATEGORY = category
|
||||||
|
namespaced.NODE_CATEGORY = category
|
||||||
|
namespaced.__module__ = __name__
|
||||||
|
namespaced.__qualname__ = node_class.__qualname__
|
||||||
|
namespaced.__name__ = node_class.__name__
|
||||||
|
namespaced.__dumas_upstream_id__ = node_id
|
||||||
|
return namespaced
|
||||||
|
|
||||||
|
|
||||||
def _namespaced_mappings():
|
def _namespaced_mappings():
|
||||||
mappings = {}
|
mappings = {}
|
||||||
display = {}
|
display = {}
|
||||||
for relative_name, label in _PACKAGES:
|
for relative_name, label, prefix, category in _PACKAGES:
|
||||||
package_name = (f"{__package__}{relative_name}" if __package__
|
package_name = (f"{__package__}{relative_name}" if __package__
|
||||||
else relative_name.lstrip("."))
|
else relative_name.lstrip("."))
|
||||||
pack = _load_pack(package_name)
|
pack = _load_pack(package_name)
|
||||||
@@ -41,12 +102,16 @@ def _namespaced_mappings():
|
|||||||
source_mappings = getattr(pack, "NODE_CLASS_MAPPINGS", {}) or {}
|
source_mappings = getattr(pack, "NODE_CLASS_MAPPINGS", {}) or {}
|
||||||
source_display = getattr(pack, "NODE_DISPLAY_NAME_MAPPINGS", {}) or {}
|
source_display = getattr(pack, "NODE_DISPLAY_NAME_MAPPINGS", {}) or {}
|
||||||
for node_id, node_class in source_mappings.items():
|
for node_id, node_class in source_mappings.items():
|
||||||
# Keep upstream IDs so the complete upstream web UI and saved
|
dumas_id = f"{prefix}_{node_id}"
|
||||||
# workflows remain functional. The original packs must not also be
|
|
||||||
# installed, otherwise ComfyUI will see duplicate node IDs.
|
|
||||||
mappings[node_id] = node_class
|
|
||||||
original_name = source_display.get(node_id, node_id)
|
original_name = source_display.get(node_id, node_id)
|
||||||
display[node_id] = f"DUMAS {label} · {original_name}"
|
dumas_name = f"DUMAS {label} · {original_name}"
|
||||||
|
mappings[dumas_id] = _namespace_class(
|
||||||
|
node_class,
|
||||||
|
node_id=dumas_id,
|
||||||
|
category=category,
|
||||||
|
display_name=dumas_name,
|
||||||
|
)
|
||||||
|
display[dumas_id] = dumas_name
|
||||||
return mappings, display
|
return mappings, display
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app.js";
|
||||||
|
|
||||||
const NODE_CLASS = "H3DecodeCacheHelper";
|
const NODE_CLASS = "DumasH3Continuum_H3DecodeCacheHelper";
|
||||||
const MAX_TOKEN = 2147483647;
|
const MAX_TOKEN = 2147483647;
|
||||||
|
|
||||||
function isJapanese() {
|
function isJapanese() {
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app.js";
|
||||||
import { configureEasyBypassToggleNode } from "./easy_bypass_toggle.js";
|
import { configureEasyBypassToggleNode } from "./easy_bypass_toggle.js";
|
||||||
|
|
||||||
const EASY_LOAD_AUDIO_CLASS = "H3EasyLoadAudio";
|
const EASY_LOAD_AUDIO_CLASS = "DumasH3Continuum_H3EasyLoadAudio";
|
||||||
|
|
||||||
function configureEasyLoadAudioNode(node) {
|
function configureEasyLoadAudioNode(node) {
|
||||||
if (
|
if (
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app.js";
|
||||||
import { configureEasyBypassToggleNode } from "./easy_bypass_toggle.js";
|
import { configureEasyBypassToggleNode } from "./easy_bypass_toggle.js";
|
||||||
|
|
||||||
const EASY_LOAD_IMAGE_CLASS = "H3EasyLoadImage";
|
const EASY_LOAD_IMAGE_CLASS = "DumasH3Continuum_H3EasyLoadImage";
|
||||||
|
|
||||||
function configureEasyLoadImageNode(node) {
|
function configureEasyLoadImageNode(node) {
|
||||||
configureEasyBypassToggleNode(node, {
|
configureEasyBypassToggleNode(node, {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app.js";
|
||||||
|
|
||||||
const EASY_NODE_CLASS = "H3ContinuumEasyV38";
|
const EASY_NODE_CLASS = "DumasH3Continuum_H3ContinuumEasyV38";
|
||||||
const CUSTOM_PRESET = "Custom";
|
const CUSTOM_PRESET = "Custom";
|
||||||
const STORAGE_ENABLED = "Save + Auto Resume";
|
const STORAGE_ENABLED = "Save + Auto Resume";
|
||||||
|
|
||||||
|
|||||||
+286
-286
@@ -3,31 +3,31 @@ import { api } from "../../scripts/api.js";
|
|||||||
import { normalizeReferenceAudioLabels } from "./reference_audio_ui.js";
|
import { normalizeReferenceAudioLabels } from "./reference_audio_ui.js";
|
||||||
import { configureV39ReferenceImages, connectedV39LegacyReferenceInputs, pruneV39LegacyReferenceInputs, refreshV39ReferenceImagesForSampler } from "./reference_images_v39.js";
|
import { configureV39ReferenceImages, connectedV39LegacyReferenceInputs, pruneV39LegacyReferenceInputs, refreshV39ReferenceImagesForSampler } from "./reference_images_v39.js";
|
||||||
import { migrateReferenceImageInputs } from "./reference_image_ui.js";
|
import { migrateReferenceImageInputs } from "./reference_image_ui.js";
|
||||||
|
|
||||||
const PRODUCTION_NODE_CLASS = "H3ContinuumSamplerProduction";
|
const PRODUCTION_NODE_CLASS = "DumasH3Continuum_H3ContinuumSamplerProduction";
|
||||||
const TIMELINE_NODE_CLASS = "H3ContinuumSamplerTimelineVideo";
|
const TIMELINE_NODE_CLASS = "DumasH3Continuum_H3ContinuumSamplerTimelineVideo";
|
||||||
const ASSEMBLE_SEAM_NODE_CLASS = "H3ContinuumAssembleSeamExperimental";
|
const ASSEMBLE_SEAM_NODE_CLASS = "DumasH3Continuum_H3ContinuumAssembleSeamExperimental";
|
||||||
const V34_NODE_CLASS = "H3ContinuumSamplerV34";
|
const V34_NODE_CLASS = "DumasH3Continuum_H3ContinuumSamplerV34";
|
||||||
const V34_ASSEMBLE_SEAM_NODE_CLASS = "H3ContinuumAssembleSeamV34";
|
const V34_ASSEMBLE_SEAM_NODE_CLASS = "DumasH3Continuum_H3ContinuumAssembleSeamV34";
|
||||||
const V35_NODE_CLASS = "H3ContinuumSamplerV35";
|
const V35_NODE_CLASS = "DumasH3Continuum_H3ContinuumSamplerV35";
|
||||||
const V36_NODE_CLASS = "H3ContinuumSamplerV36";
|
const V36_NODE_CLASS = "DumasH3Continuum_H3ContinuumSamplerV36";
|
||||||
const V37_NODE_CLASS = "H3ContinuumSamplerV37";
|
const V37_NODE_CLASS = "DumasH3Continuum_H3ContinuumSamplerV37";
|
||||||
const V38_NODE_CLASS = "H3ContinuumSamplerV38";
|
const V38_NODE_CLASS = "DumasH3Continuum_H3ContinuumSamplerV38";
|
||||||
const V39_NODE_CLASS = "H3ContinuumSamplerV39";
|
const V39_NODE_CLASS = "DumasH3Continuum_H3ContinuumSamplerV39";
|
||||||
const isModernSamplerClass = (name) => name === V38_NODE_CLASS || name === V39_NODE_CLASS;
|
const isModernSamplerClass = (name) => name === V38_NODE_CLASS || name === V39_NODE_CLASS;
|
||||||
const V39_PLAN_WIDGET = "Reference Plan Inspector";
|
const V39_PLAN_WIDGET = "Reference Plan Inspector";
|
||||||
const V39_UNVERIFIED_PLAN = "Configured only — Queue has not verified the effective Reference Plan.";
|
const V39_UNVERIFIED_PLAN = "Configured only — Queue has not verified the effective Reference Plan.";
|
||||||
const V35_ASSEMBLE_SEAM_NODE_CLASS = "H3ContinuumAssembleSeamV35";
|
const V35_ASSEMBLE_SEAM_NODE_CLASS = "DumasH3Continuum_H3ContinuumAssembleSeamV35";
|
||||||
const PROJECT_WIDGET = "project_id";
|
const PROJECT_WIDGET = "project_id";
|
||||||
const LEGACY_RUN_NAME_WIDGET = "run_name";
|
const LEGACY_RUN_NAME_WIDGET = "run_name";
|
||||||
const CHUNKS_WIDGET = "chunks";
|
const CHUNKS_WIDGET = "chunks";
|
||||||
const REGENERATE_WIDGET = "reroll_from_chunk";
|
const REGENERATE_WIDGET = "reroll_from_chunk";
|
||||||
const REROLL_NONCE_WIDGET = "reroll_nonce";
|
const REROLL_NONCE_WIDGET = "reroll_nonce";
|
||||||
const REGENERATE_INTENT_PROPERTY = "h3_continuum_regenerate_from";
|
const REGENERATE_INTENT_PROPERTY = "h3_continuum_regenerate_from";
|
||||||
const RUN_STORAGE_WIDGET = "run_storage";
|
const RUN_STORAGE_WIDGET = "run_storage";
|
||||||
const REFERENCE_SIZE_WIDGET = "reference_size";
|
const REFERENCE_SIZE_WIDGET = "reference_size";
|
||||||
const TIMELINE_SIZE_WIDGET = "timeline_video_size";
|
const TIMELINE_SIZE_WIDGET = "timeline_video_size";
|
||||||
const VIDEO_REFERENCE_SIZE_WIDGET = "video_reference_size";
|
const VIDEO_REFERENCE_SIZE_WIDGET = "video_reference_size";
|
||||||
const PROMPT_OVERRIDES_INPUT = "prompt_overrides";
|
const PROMPT_OVERRIDES_INPUT = "prompt_overrides";
|
||||||
const RESOLUTION_PRESET_WIDGET = "preset";
|
const RESOLUTION_PRESET_WIDGET = "preset";
|
||||||
const CUSTOM_MP_WIDGET = "custom_mp";
|
const CUSTOM_MP_WIDGET = "custom_mp";
|
||||||
@@ -215,135 +215,135 @@ const V38_VIEW_PROPERTY = "H3 Continuum View";
|
|||||||
const V38_VIEW_BASIC = "Basic";
|
const V38_VIEW_BASIC = "Basic";
|
||||||
const V38_VIEW_PRODUCTION = "Production";
|
const V38_VIEW_PRODUCTION = "Production";
|
||||||
const V38_VIEW_OPTIONS = [V38_VIEW_BASIC, V38_VIEW_PRODUCTION];
|
const V38_VIEW_OPTIONS = [V38_VIEW_BASIC, V38_VIEW_PRODUCTION];
|
||||||
const SETTINGS = {
|
const SETTINGS = {
|
||||||
detailedReport: "H3Continuum.DetailedReport",
|
detailedReport: "H3Continuum.DetailedReport",
|
||||||
developerDiagnostics: "H3Continuum.DeveloperDiagnostics",
|
developerDiagnostics: "H3Continuum.DeveloperDiagnostics",
|
||||||
samplingPreview: "H3Continuum.SamplingPreview",
|
samplingPreview: "H3Continuum.SamplingPreview",
|
||||||
};
|
};
|
||||||
|
|
||||||
function createProjectId() {
|
function createProjectId() {
|
||||||
if (globalThis.crypto?.randomUUID) {
|
if (globalThis.crypto?.randomUUID) {
|
||||||
return globalThis.crypto.randomUUID();
|
return globalThis.crypto.randomUUID();
|
||||||
}
|
}
|
||||||
const bytes = new Uint8Array(16);
|
const bytes = new Uint8Array(16);
|
||||||
globalThis.crypto.getRandomValues(bytes);
|
globalThis.crypto.getRandomValues(bytes);
|
||||||
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
||||||
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
||||||
const hex = Array.from(bytes, (value) => value.toString(16).padStart(2, "0")).join("");
|
const hex = Array.from(bytes, (value) => value.toString(16).padStart(2, "0")).join("");
|
||||||
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function findWidget(node, name) {
|
function findWidget(node, name) {
|
||||||
return node.widgets?.find((widget) => widget.name === name);
|
return node.widgets?.find((widget) => widget.name === name);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWidgetVisible(widget, visible) {
|
function setWidgetVisible(widget, visible) {
|
||||||
if (!widget) {
|
if (!widget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!widget.__h3ContinuumOriginal) {
|
if (!widget.__h3ContinuumOriginal) {
|
||||||
widget.__h3ContinuumOriginal = {
|
widget.__h3ContinuumOriginal = {
|
||||||
type: widget.type,
|
type: widget.type,
|
||||||
computeSize: widget.computeSize,
|
computeSize: widget.computeSize,
|
||||||
hidden: widget.hidden,
|
hidden: widget.hidden,
|
||||||
optionsHidden: widget.options?.hidden,
|
optionsHidden: widget.options?.hidden,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
widget.options ||= {};
|
widget.options ||= {};
|
||||||
if (visible) {
|
if (visible) {
|
||||||
const original = widget.__h3ContinuumOriginal;
|
const original = widget.__h3ContinuumOriginal;
|
||||||
widget.type = original.type;
|
widget.type = original.type;
|
||||||
widget.computeSize = original.computeSize;
|
widget.computeSize = original.computeSize;
|
||||||
widget.hidden = original.hidden;
|
widget.hidden = original.hidden;
|
||||||
if (original.optionsHidden === undefined) {
|
if (original.optionsHidden === undefined) {
|
||||||
delete widget.options.hidden;
|
delete widget.options.hidden;
|
||||||
} else {
|
} else {
|
||||||
widget.options.hidden = original.optionsHidden;
|
widget.options.hidden = original.optionsHidden;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
widget.hidden = true;
|
widget.hidden = true;
|
||||||
widget.type = "converted-widget";
|
widget.type = "converted-widget";
|
||||||
widget.options.hidden = true;
|
widget.options.hidden = true;
|
||||||
widget.computeSize = () => [0, -4];
|
widget.computeSize = () => [0, -4];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hidePersistentWidget(widget) {
|
function hidePersistentWidget(widget) {
|
||||||
setWidgetVisible(widget, false);
|
setWidgetVisible(widget, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function settingValue(id, fallback) {
|
function settingValue(id, fallback) {
|
||||||
try {
|
try {
|
||||||
return app.ui?.settings?.getSettingValue?.(id) ?? fallback;
|
return app.ui?.settings?.getSettingValue?.(id) ?? fallback;
|
||||||
} catch {
|
} catch {
|
||||||
return fallback;
|
return fallback;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyRuntimeSettings(node) {
|
function applyRuntimeSettings(node) {
|
||||||
const detailed = Boolean(settingValue(SETTINGS.detailedReport, false));
|
const detailed = Boolean(settingValue(SETTINGS.detailedReport, false));
|
||||||
const debug = Boolean(settingValue(SETTINGS.developerDiagnostics, false));
|
const debug = Boolean(settingValue(SETTINGS.developerDiagnostics, false));
|
||||||
const preview = Boolean(settingValue(SETTINGS.samplingPreview, true));
|
const preview = Boolean(settingValue(SETTINGS.samplingPreview, true));
|
||||||
const diagnosticsWidget = findWidget(node, "diagnostics");
|
const diagnosticsWidget = findWidget(node, "diagnostics");
|
||||||
const debugWidget = findWidget(node, "debug");
|
const debugWidget = findWidget(node, "debug");
|
||||||
const previewWidget = findWidget(node, "show_preview");
|
const previewWidget = findWidget(node, "show_preview");
|
||||||
const strictWidget = findWidget(node, "strict_compatibility");
|
const strictWidget = findWidget(node, "strict_compatibility");
|
||||||
if (diagnosticsWidget) diagnosticsWidget.value = detailed ? "Detailed Report" : "Basic";
|
if (diagnosticsWidget) diagnosticsWidget.value = detailed ? "Detailed Report" : "Basic";
|
||||||
if (debugWidget) debugWidget.value = debug;
|
if (debugWidget) debugWidget.value = debug;
|
||||||
if (previewWidget) previewWidget.value = preview;
|
if (previewWidget) previewWidget.value = preview;
|
||||||
if (strictWidget) strictWidget.value = false;
|
if (strictWidget) strictWidget.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeUnusedInput(node, name) {
|
function removeUnusedInput(node, name) {
|
||||||
const index = node.inputs?.findIndex((input) => input.name === name) ?? -1;
|
const index = node.inputs?.findIndex((input) => input.name === name) ?? -1;
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const input = node.inputs[index];
|
const input = node.inputs[index];
|
||||||
if (input.link != null) {
|
if (input.link != null) {
|
||||||
app.graph?.removeLink(input.link);
|
app.graph?.removeLink(input.link);
|
||||||
}
|
}
|
||||||
node.removeInput(index);
|
node.removeInput(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
function regenerateOptions(chunks) {
|
function regenerateOptions(chunks) {
|
||||||
const count = Math.max(1, Math.min(16, Number.parseInt(chunks, 10) || 1));
|
const count = Math.max(1, Math.min(16, Number.parseInt(chunks, 10) || 1));
|
||||||
return ["Auto", ...Array.from({ length: count }, (_, index) => `Chunk ${index + 1}`)];
|
return ["Auto", ...Array.from({ length: count }, (_, index) => `Chunk ${index + 1}`)];
|
||||||
}
|
}
|
||||||
|
|
||||||
function configureRegenerateFrom(node) {
|
function configureRegenerateFrom(node) {
|
||||||
const chunksWidget = findWidget(node, CHUNKS_WIDGET);
|
const chunksWidget = findWidget(node, CHUNKS_WIDGET);
|
||||||
const regenerateWidget = findWidget(node, REGENERATE_WIDGET);
|
const regenerateWidget = findWidget(node, REGENERATE_WIDGET);
|
||||||
if (!chunksWidget || !regenerateWidget) {
|
if (!chunksWidget || !regenerateWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const refresh = () => {
|
const refresh = () => {
|
||||||
const values = regenerateOptions(chunksWidget.value);
|
const values = regenerateOptions(chunksWidget.value);
|
||||||
regenerateWidget.options ||= {};
|
regenerateWidget.options ||= {};
|
||||||
regenerateWidget.options.values = values;
|
regenerateWidget.options.values = values;
|
||||||
const numeric = typeof regenerateWidget.value === "number"
|
const numeric = typeof regenerateWidget.value === "number"
|
||||||
? regenerateWidget.value
|
? regenerateWidget.value
|
||||||
: Number.parseInt(String(regenerateWidget.value).replace(/^Chunk\s+/, ""), 10);
|
: Number.parseInt(String(regenerateWidget.value).replace(/^Chunk\s+/, ""), 10);
|
||||||
if (regenerateWidget.value === "Auto" || numeric === 0) {
|
if (regenerateWidget.value === "Auto" || numeric === 0) {
|
||||||
regenerateWidget.value = "Auto";
|
regenerateWidget.value = "Auto";
|
||||||
} else if (Number.isInteger(numeric) && numeric >= 1 && numeric < values.length) {
|
} else if (Number.isInteger(numeric) && numeric >= 1 && numeric < values.length) {
|
||||||
regenerateWidget.value = `Chunk ${numeric}`;
|
regenerateWidget.value = `Chunk ${numeric}`;
|
||||||
} else {
|
} else {
|
||||||
regenerateWidget.value = "Auto";
|
regenerateWidget.value = "Auto";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (!chunksWidget.__h3ContinuumRegenerateCallback) {
|
if (!chunksWidget.__h3ContinuumRegenerateCallback) {
|
||||||
const previous = chunksWidget.callback;
|
const previous = chunksWidget.callback;
|
||||||
chunksWidget.callback = function(value, ...args) {
|
chunksWidget.callback = function(value, ...args) {
|
||||||
const result = previous?.call(this, value, ...args);
|
const result = previous?.call(this, value, ...args);
|
||||||
refresh();
|
refresh();
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
chunksWidget.__h3ContinuumRegenerateCallback = true;
|
chunksWidget.__h3ContinuumRegenerateCallback = true;
|
||||||
}
|
}
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
function linkedInput(node, names) {
|
function linkedInput(node, names) {
|
||||||
return node.inputs?.some((input) => names.includes(input.name) && input.link != null) ?? false;
|
return node.inputs?.some((input) => names.includes(input.name) && input.link != null) ?? false;
|
||||||
}
|
}
|
||||||
@@ -365,7 +365,7 @@ function activeLinkedInput(node, names) {
|
|||||||
const source = app.graph?.getNodeById?.(link.origin_id);
|
const source = app.graph?.getNodeById?.(link.origin_id);
|
||||||
if (!source) return true;
|
if (!source) return true;
|
||||||
if ([2, 4].includes(Number(source.mode))) return false;
|
if ([2, 4].includes(Number(source.mode))) return false;
|
||||||
if (source.comfyClass === "H3ContinuumReferenceImages") {
|
if (source.comfyClass === "DumasH3Continuum_H3ContinuumReferenceImages") {
|
||||||
return activeLinkedInput(source, source.inputs.filter(
|
return activeLinkedInput(source, source.inputs.filter(
|
||||||
(item) => /^reference_image_[4-9]$/.test(item.name),
|
(item) => /^reference_image_[4-9]$/.test(item.name),
|
||||||
).map((item) => item.name));
|
).map((item) => item.name));
|
||||||
@@ -388,17 +388,17 @@ function activeLinkedInput(node, names) {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function attachRefresh(widget, key, refresh) {
|
function attachRefresh(widget, key, refresh) {
|
||||||
if (!widget || widget[key]) {
|
if (!widget || widget[key]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const previous = widget.callback;
|
const previous = widget.callback;
|
||||||
widget.callback = function(value, ...args) {
|
widget.callback = function(value, ...args) {
|
||||||
const result = previous?.call(this, value, ...args);
|
const result = previous?.call(this, value, ...args);
|
||||||
refresh();
|
refresh();
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
widget[key] = true;
|
widget[key] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2972,27 +2972,27 @@ function configureConditionalWidgets(node) {
|
|||||||
? ["reference_images"]
|
? ["reference_images"]
|
||||||
: ["reference_image_1", "reference_image_2", "reference_image_3", "reference_image_4", "reference_image_5", "image_references"]),
|
: ["reference_image_1", "reference_image_2", "reference_image_3", "reference_image_4", "reference_image_5", "image_references"]),
|
||||||
);
|
);
|
||||||
setWidgetVisible(
|
setWidgetVisible(
|
||||||
findWidget(node, TIMELINE_SIZE_WIDGET),
|
findWidget(node, TIMELINE_SIZE_WIDGET),
|
||||||
linkedInput(node, ["timeline_video"]),
|
linkedInput(node, ["timeline_video"]),
|
||||||
);
|
);
|
||||||
setWidgetVisible(
|
setWidgetVisible(
|
||||||
findWidget(node, VIDEO_REFERENCE_SIZE_WIDGET),
|
findWidget(node, VIDEO_REFERENCE_SIZE_WIDGET),
|
||||||
productionView && linkedInput(node, ["reference_video_1"]),
|
productionView && linkedInput(node, ["reference_video_1"]),
|
||||||
);
|
);
|
||||||
node.setDirtyCanvas?.(true, true);
|
node.setDirtyCanvas?.(true, true);
|
||||||
};
|
};
|
||||||
attachRefresh(storageWidget, "__h3ContinuumStorageCallback", refresh);
|
attachRefresh(storageWidget, "__h3ContinuumStorageCallback", refresh);
|
||||||
attachRefresh(regenerateWidget, "__h3ContinuumRegenerateVisibilityCallback", refresh);
|
attachRefresh(regenerateWidget, "__h3ContinuumRegenerateVisibilityCallback", refresh);
|
||||||
if (!node.__h3ContinuumConnectionCallback) {
|
if (!node.__h3ContinuumConnectionCallback) {
|
||||||
const previous = node.onConnectionsChange;
|
const previous = node.onConnectionsChange;
|
||||||
node.onConnectionsChange = function(...args) {
|
node.onConnectionsChange = function(...args) {
|
||||||
const result = previous?.apply(this, args);
|
const result = previous?.apply(this, args);
|
||||||
setTimeout(refresh, 0);
|
setTimeout(refresh, 0);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
node.__h3ContinuumConnectionCallback = true;
|
node.__h3ContinuumConnectionCallback = true;
|
||||||
}
|
}
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3305,26 +3305,26 @@ function configureReviewControls(node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function configureAssembler(node) {
|
function configureAssembler(node) {
|
||||||
if (
|
if (
|
||||||
node.comfyClass !== ASSEMBLE_SEAM_NODE_CLASS
|
node.comfyClass !== ASSEMBLE_SEAM_NODE_CLASS
|
||||||
&& node.comfyClass !== V34_ASSEMBLE_SEAM_NODE_CLASS
|
&& node.comfyClass !== V34_ASSEMBLE_SEAM_NODE_CLASS
|
||||||
&& node.comfyClass !== V35_ASSEMBLE_SEAM_NODE_CLASS
|
&& node.comfyClass !== V35_ASSEMBLE_SEAM_NODE_CLASS
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const exactDuration = findWidget(node, "exact_total_duration");
|
const exactDuration = findWidget(node, "exact_total_duration");
|
||||||
if (exactDuration) exactDuration.value = true;
|
if (exactDuration) exactDuration.value = true;
|
||||||
applyRuntimeSettings(node);
|
applyRuntimeSettings(node);
|
||||||
hidePersistentWidget(exactDuration);
|
hidePersistentWidget(exactDuration);
|
||||||
hidePersistentWidget(findWidget(node, "diagnostics"));
|
hidePersistentWidget(findWidget(node, "diagnostics"));
|
||||||
node.setDirtyCanvas?.(true, true);
|
node.setDirtyCanvas?.(true, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function configureNode(node) {
|
function configureNode(node) {
|
||||||
const isProduction = node.comfyClass === PRODUCTION_NODE_CLASS;
|
const isProduction = node.comfyClass === PRODUCTION_NODE_CLASS;
|
||||||
const isTimeline = node.comfyClass === TIMELINE_NODE_CLASS;
|
const isTimeline = node.comfyClass === TIMELINE_NODE_CLASS;
|
||||||
const isV34 = node.comfyClass === V34_NODE_CLASS;
|
const isV34 = node.comfyClass === V34_NODE_CLASS;
|
||||||
const isV35 = node.comfyClass === V35_NODE_CLASS;
|
const isV35 = node.comfyClass === V35_NODE_CLASS;
|
||||||
const isV36 = node.comfyClass === V36_NODE_CLASS;
|
const isV36 = node.comfyClass === V36_NODE_CLASS;
|
||||||
const isV37 = node.comfyClass === V37_NODE_CLASS;
|
const isV37 = node.comfyClass === V37_NODE_CLASS;
|
||||||
@@ -3332,27 +3332,27 @@ function configureNode(node) {
|
|||||||
if (node.comfyClass === V39_NODE_CLASS) pruneV39LegacyReferenceInputs(node);
|
if (node.comfyClass === V39_NODE_CLASS) pruneV39LegacyReferenceInputs(node);
|
||||||
if (!isProduction && !isTimeline && !isV34 && !isV35 && !isV36 && !isV37 && !isV38) {
|
if (!isProduction && !isTimeline && !isV34 && !isV35 && !isV36 && !isV37 && !isV38) {
|
||||||
configureV39ReferenceImages(node);
|
configureV39ReferenceImages(node);
|
||||||
if (node.comfyClass === "H3ContinuumReferenceAudios") {
|
if (node.comfyClass === "DumasH3Continuum_H3ContinuumReferenceAudios") {
|
||||||
normalizeReferenceAudioLabels(node);
|
normalizeReferenceAudioLabels(node);
|
||||||
}
|
}
|
||||||
configureAssembler(node);
|
configureAssembler(node);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const projectWidget = findWidget(node, PROJECT_WIDGET);
|
const projectWidget = findWidget(node, PROJECT_WIDGET);
|
||||||
if (isProduction || isV34 || isV35 || isV36 || isV37 || isV38) {
|
if (isProduction || isV34 || isV35 || isV36 || isV37 || isV38) {
|
||||||
if (projectWidget && !String(projectWidget.value || "").trim()) {
|
if (projectWidget && !String(projectWidget.value || "").trim()) {
|
||||||
projectWidget.value = createProjectId();
|
projectWidget.value = createProjectId();
|
||||||
}
|
}
|
||||||
if (!isV38) removeUnusedInput(node, PROMPT_OVERRIDES_INPUT);
|
if (!isV38) removeUnusedInput(node, PROMPT_OVERRIDES_INPUT);
|
||||||
}
|
}
|
||||||
applyRuntimeSettings(node);
|
applyRuntimeSettings(node);
|
||||||
if (isV35 || isV36 || isV37 || isV38) {
|
if (isV35 || isV36 || isV37 || isV38) {
|
||||||
normalizeReferenceAudioLabels(node);
|
normalizeReferenceAudioLabels(node);
|
||||||
}
|
}
|
||||||
removeUnusedLegacyInputs(node);
|
removeUnusedLegacyInputs(node);
|
||||||
hidePersistentWidget(findWidget(node, "diagnostics"));
|
hidePersistentWidget(findWidget(node, "diagnostics"));
|
||||||
hidePersistentWidget(findWidget(node, "strict_compatibility"));
|
hidePersistentWidget(findWidget(node, "strict_compatibility"));
|
||||||
hidePersistentWidget(findWidget(node, "debug"));
|
hidePersistentWidget(findWidget(node, "debug"));
|
||||||
hidePersistentWidget(findWidget(node, "show_preview"));
|
hidePersistentWidget(findWidget(node, "show_preview"));
|
||||||
hidePersistentWidget(projectWidget);
|
hidePersistentWidget(projectWidget);
|
||||||
hidePersistentWidget(findWidget(node, TAKE_GROUP_WIDGET));
|
hidePersistentWidget(findWidget(node, TAKE_GROUP_WIDGET));
|
||||||
@@ -3368,9 +3368,9 @@ function configureNode(node) {
|
|||||||
configureV39ReferenceUx(node);
|
configureV39ReferenceUx(node);
|
||||||
applyV38View(node);
|
applyV38View(node);
|
||||||
node.setDirtyCanvas?.(true, true);
|
node.setDirtyCanvas?.(true, true);
|
||||||
return projectWidget;
|
return projectWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
let reviewGraphEpoch = 0;
|
let reviewGraphEpoch = 0;
|
||||||
let reviewGraphHydrating = false;
|
let reviewGraphHydrating = false;
|
||||||
|
|
||||||
@@ -3411,8 +3411,8 @@ function configureNodeAfterSetup(node) {
|
|||||||
configureNode(node);
|
configureNode(node);
|
||||||
return pending.promise;
|
return pending.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: "H3Continuum.ProjectId",
|
name: "H3Continuum.ProjectId",
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
@@ -3430,32 +3430,32 @@ app.registerExtension({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
const settings = app.ui?.settings;
|
const settings = app.ui?.settings;
|
||||||
settings?.addSetting?.({
|
settings?.addSetting?.({
|
||||||
id: SETTINGS.samplingPreview,
|
id: SETTINGS.samplingPreview,
|
||||||
name: "H3 Continuum: Sampling Preview",
|
name: "H3 Continuum: Sampling Preview",
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
defaultValue: true,
|
defaultValue: true,
|
||||||
tooltip: "Show live sampling previews. Disable only to reduce preview overhead.",
|
tooltip: "Show live sampling previews. Disable only to reduce preview overhead.",
|
||||||
onChange: () => refreshConfiguredNodes(),
|
onChange: () => refreshConfiguredNodes(),
|
||||||
});
|
});
|
||||||
settings?.addSetting?.({
|
settings?.addSetting?.({
|
||||||
id: SETTINGS.developerDiagnostics,
|
id: SETTINGS.developerDiagnostics,
|
||||||
name: "H3 Continuum: Developer Diagnostics",
|
name: "H3 Continuum: Developer Diagnostics",
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
tooltip: "Enable developer-only Continuum logging and assertions.",
|
tooltip: "Enable developer-only Continuum logging and assertions.",
|
||||||
onChange: () => refreshConfiguredNodes(),
|
onChange: () => refreshConfiguredNodes(),
|
||||||
});
|
});
|
||||||
settings?.addSetting?.({
|
settings?.addSetting?.({
|
||||||
id: SETTINGS.detailedReport,
|
id: SETTINGS.detailedReport,
|
||||||
name: "H3 Continuum: Detailed Report",
|
name: "H3 Continuum: Detailed Report",
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
tooltip: "Include detailed diagnostics in status and assembly reports.",
|
tooltip: "Include detailed diagnostics in status and assembly reports.",
|
||||||
onChange: () => refreshConfiguredNodes(),
|
onChange: () => refreshConfiguredNodes(),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeConfigureGraph() {
|
beforeConfigureGraph() {
|
||||||
reviewGraphEpoch++;
|
reviewGraphEpoch++;
|
||||||
reviewGraphHydrating = true;
|
reviewGraphHydrating = true;
|
||||||
@@ -3469,17 +3469,17 @@ app.registerExtension({
|
|||||||
},
|
},
|
||||||
|
|
||||||
nodeCreated(node) {
|
nodeCreated(node) {
|
||||||
configureNodeAfterSetup(node);
|
configureNodeAfterSetup(node);
|
||||||
},
|
},
|
||||||
|
|
||||||
loadedGraphNode(node) {
|
loadedGraphNode(node) {
|
||||||
if (node.comfyClass === V39_NODE_CLASS) {
|
if (node.comfyClass === V39_NODE_CLASS) {
|
||||||
node.__h3ContinuumReferencePlan = null;
|
node.__h3ContinuumReferencePlan = null;
|
||||||
}
|
}
|
||||||
normalizeReviewActionOnLoad(node);
|
normalizeReviewActionOnLoad(node);
|
||||||
configureNodeAfterSetup(node);
|
configureNodeAfterSetup(node);
|
||||||
},
|
},
|
||||||
|
|
||||||
async afterConfigureGraph() {
|
async afterConfigureGraph() {
|
||||||
// API graph loading can call this hook without beforeConfigureGraph.
|
// API graph loading can call this hook without beforeConfigureGraph.
|
||||||
const epoch = reviewGraphEpoch;
|
const epoch = reviewGraphEpoch;
|
||||||
@@ -3497,11 +3497,11 @@ app.registerExtension({
|
|||||||
if (!isModernSamplerClass(node.comfyClass) || !reviewNodeAttached(node)) continue;
|
if (!isModernSamplerClass(node.comfyClass) || !reviewNodeAttached(node)) continue;
|
||||||
void loadTakeHistory(node, { force: true, reviewedSettings: reviewSettingsSnapshot(node) });
|
void loadTakeHistory(node, { force: true, reviewedSettings: reviewSettingsSnapshot(node) });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async beforeQueuePrompt(prompt) {
|
async beforeQueuePrompt(prompt) {
|
||||||
const seen = new Set();
|
const seen = new Set();
|
||||||
for (const node of app.graph?._nodes || []) {
|
for (const node of app.graph?._nodes || []) {
|
||||||
const projectWidget = configureNode(node);
|
const projectWidget = configureNode(node);
|
||||||
const apiNode = prompt.output?.[String(node.id)];
|
const apiNode = prompt.output?.[String(node.id)];
|
||||||
if (node.comfyClass === V39_NODE_CLASS && apiNode?.inputs) {
|
if (node.comfyClass === V39_NODE_CLASS && apiNode?.inputs) {
|
||||||
@@ -3509,9 +3509,9 @@ app.registerExtension({
|
|||||||
configureV39ReferenceUx(node);
|
configureV39ReferenceUx(node);
|
||||||
}
|
}
|
||||||
if (apiNode?.inputs) {
|
if (apiNode?.inputs) {
|
||||||
if (
|
if (
|
||||||
node.comfyClass === PRODUCTION_NODE_CLASS
|
node.comfyClass === PRODUCTION_NODE_CLASS
|
||||||
|| node.comfyClass === TIMELINE_NODE_CLASS
|
|| node.comfyClass === TIMELINE_NODE_CLASS
|
||||||
|| node.comfyClass === V34_NODE_CLASS
|
|| node.comfyClass === V34_NODE_CLASS
|
||||||
|| node.comfyClass === V35_NODE_CLASS
|
|| node.comfyClass === V35_NODE_CLASS
|
||||||
|| node.comfyClass === V36_NODE_CLASS
|
|| node.comfyClass === V36_NODE_CLASS
|
||||||
@@ -3523,40 +3523,40 @@ app.registerExtension({
|
|||||||
normalizeRunStorageState(node, apiNode.inputs);
|
normalizeRunStorageState(node, apiNode.inputs);
|
||||||
}
|
}
|
||||||
apiNode.inputs.diagnostics = settingValue(SETTINGS.detailedReport, false)
|
apiNode.inputs.diagnostics = settingValue(SETTINGS.detailedReport, false)
|
||||||
? "Detailed Report"
|
? "Detailed Report"
|
||||||
: "Basic";
|
: "Basic";
|
||||||
apiNode.inputs.debug = Boolean(settingValue(SETTINGS.developerDiagnostics, false));
|
apiNode.inputs.debug = Boolean(settingValue(SETTINGS.developerDiagnostics, false));
|
||||||
apiNode.inputs.show_preview = Boolean(settingValue(SETTINGS.samplingPreview, true));
|
apiNode.inputs.show_preview = Boolean(settingValue(SETTINGS.samplingPreview, true));
|
||||||
apiNode.inputs.strict_compatibility = false;
|
apiNode.inputs.strict_compatibility = false;
|
||||||
} else if (
|
} else if (
|
||||||
node.comfyClass === ASSEMBLE_SEAM_NODE_CLASS
|
node.comfyClass === ASSEMBLE_SEAM_NODE_CLASS
|
||||||
|| node.comfyClass === V34_ASSEMBLE_SEAM_NODE_CLASS
|
|| node.comfyClass === V34_ASSEMBLE_SEAM_NODE_CLASS
|
||||||
|| node.comfyClass === V35_ASSEMBLE_SEAM_NODE_CLASS
|
|| node.comfyClass === V35_ASSEMBLE_SEAM_NODE_CLASS
|
||||||
) {
|
) {
|
||||||
apiNode.inputs.diagnostics = settingValue(SETTINGS.detailedReport, false)
|
apiNode.inputs.diagnostics = settingValue(SETTINGS.detailedReport, false)
|
||||||
? "Detailed Report"
|
? "Detailed Report"
|
||||||
: "Basic";
|
: "Basic";
|
||||||
apiNode.inputs.exact_total_duration = true;
|
apiNode.inputs.exact_total_duration = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!projectWidget) {
|
if (!projectWidget) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let projectId = String(projectWidget.value || "").trim();
|
let projectId = String(projectWidget.value || "").trim();
|
||||||
if (!projectId || seen.has(projectId)) {
|
if (!projectId || seen.has(projectId)) {
|
||||||
projectId = createProjectId();
|
projectId = createProjectId();
|
||||||
projectWidget.value = projectId;
|
projectWidget.value = projectId;
|
||||||
}
|
}
|
||||||
seen.add(projectId);
|
seen.add(projectId);
|
||||||
if (apiNode?.inputs) {
|
if (apiNode?.inputs) {
|
||||||
apiNode.inputs.project_id = projectId;
|
apiNode.inputs.project_id = projectId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function refreshConfiguredNodes() {
|
function refreshConfiguredNodes() {
|
||||||
for (const node of app.graph?._nodes || []) {
|
for (const node of app.graph?._nodes || []) {
|
||||||
configureNodeAfterSetup(node);
|
configureNodeAfterSetup(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -11,14 +11,14 @@ export function normalizeReferenceAudioLabels(node) {
|
|||||||
if (!node) {
|
if (!node) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (node.comfyClass === "H3ContinuumReferenceAudios") {
|
if (node.comfyClass === "DumasH3Continuum_H3ContinuumReferenceAudios") {
|
||||||
const output = node.outputs?.find((item) => item.name === "audio_references");
|
const output = node.outputs?.find((item) => item.name === "audio_references");
|
||||||
if (output) output.label = "Reference Audios";
|
if (output) output.label = "Reference Audios";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (const input of node.inputs || []) {
|
for (const input of node.inputs || []) {
|
||||||
const label = input.name === "reference_video_1"
|
const label = input.name === "reference_video_1"
|
||||||
&& node.comfyClass === "H3ContinuumSamplerV38"
|
&& node.comfyClass === "DumasH3Continuum_H3ContinuumSamplerV38"
|
||||||
? "Timeline Video Frames"
|
? "Timeline Video Frames"
|
||||||
: NORMALIZED_INPUT_LABELS[input.name];
|
: NORMALIZED_INPUT_LABELS[input.name];
|
||||||
if (label) {
|
if (label) {
|
||||||
|
|||||||
+2
-2
@@ -1,11 +1,11 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app.js";
|
||||||
|
|
||||||
const BUNDLE_NODE = "H3ContinuumReferenceImages";
|
const BUNDLE_NODE = "DumasH3Continuum_H3ContinuumReferenceImages";
|
||||||
const BUNDLE_INPUT = "image_references";
|
const BUNDLE_INPUT = "image_references";
|
||||||
const BUNDLE_TYPE = "H3_CONTINUUM_IMAGE_REFERENCES";
|
const BUNDLE_TYPE = "H3_CONTINUUM_IMAGE_REFERENCES";
|
||||||
|
|
||||||
export function migrateReferenceImageInputs(node) {
|
export function migrateReferenceImageInputs(node) {
|
||||||
if (node.comfyClass !== "H3ContinuumSamplerV38") return;
|
if (node.comfyClass !== "DumasH3Continuum_H3ContinuumSamplerV38") return;
|
||||||
const graph = node.graph || app.graph;
|
const graph = node.graph || app.graph;
|
||||||
const legacy = (node.inputs || []).filter(
|
const legacy = (node.inputs || []).filter(
|
||||||
(input) => ["reference_image_4", "reference_image_5"].includes(input.name),
|
(input) => ["reference_image_4", "reference_image_5"].includes(input.name),
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
const CLASS = "H3ContinuumReferenceImagesV39";
|
const CLASS = "DumasH3Continuum_H3ContinuumReferenceImagesV39";
|
||||||
const SAMPLER = "H3ContinuumSamplerV39";
|
const SAMPLER = "DumasH3Continuum_H3ContinuumSamplerV39";
|
||||||
const MAX = 16;
|
const MAX = 16;
|
||||||
const LEGACY_SAMPLER_INPUTS = new Set([
|
const LEGACY_SAMPLER_INPUTS = new Set([
|
||||||
...Array.from({ length: 5 }, (_, index) => `reference_image_${index + 1}`),
|
...Array.from({ length: 5 }, (_, index) => `reference_image_${index + 1}`),
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app.js";
|
||||||
|
|
||||||
const NODE_CLASS = "H3ContinuumSamplerV38";
|
const NODE_CLASS = "DumasH3Continuum_H3ContinuumSamplerV38";
|
||||||
const MODE = "video_reference_mode";
|
const MODE = "video_reference_mode";
|
||||||
const REPEAT = "Repeat Reference";
|
const REPEAT = "Repeat Reference";
|
||||||
const FOLLOW = "Follow Timeline";
|
const FOLLOW = "Follow Timeline";
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app.js";
|
||||||
|
|
||||||
const TARGET_NODES = new Set([
|
const TARGET_NODES = new Set([
|
||||||
"H3RefModCreateFromFolder",
|
"DumasH3RefModPicker_H3RefModCreateFromFolder",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const MIN_NODE_WIDTH = 320;
|
const MIN_NODE_WIDTH = 320;
|
||||||
@@ -98,7 +98,7 @@ const COMMON_PRESET_FIELDS = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const PRESET_CONFIG = {
|
const PRESET_CONFIG = {
|
||||||
H3RefModCreateFromFolder: {
|
DumasH3RefModPicker_H3RefModCreateFromFolder: {
|
||||||
manual: {
|
manual: {
|
||||||
values: {
|
values: {
|
||||||
concept_type: "identity",
|
concept_type: "identity",
|
||||||
@@ -283,7 +283,7 @@ function syncPresetValues(node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function applyFolderNamingVisibility(node) {
|
function applyFolderNamingVisibility(node) {
|
||||||
if (String(node.comfyClass || "") !== "H3RefModCreateFromFolder") return;
|
if (String(node.comfyClass || "") !== "DumasH3RefModPicker_H3RefModCreateFromFolder") return;
|
||||||
const useSubfoldersWidget = findWidget(node, "use_subfolders");
|
const useSubfoldersWidget = findWidget(node, "use_subfolders");
|
||||||
const useFolderAsNameWidget = findWidget(node, "use_folder_as_name");
|
const useFolderAsNameWidget = findWidget(node, "use_folder_as_name");
|
||||||
const nameWidget = findWidget(node, "name");
|
const nameWidget = findWidget(node, "name");
|
||||||
|
|||||||
+2
-2
@@ -65,7 +65,7 @@ async function refreshLoaderVisibility(node) {
|
|||||||
const data = await fetchLoaderCapabilities(mod);
|
const data = await fetchLoaderCapabilities(mod);
|
||||||
applyModalityVisibility(node, data.ok ? data : { has_visual: true, has_audio: true });
|
applyModalityVisibility(node, data.ok ? data : { has_visual: true, has_audio: true });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn("[H3RefModLoader] Could not refresh capabilities:", error);
|
console.warn("[DumasH3RefModPicker_H3RefModLoader] Could not refresh capabilities:", error);
|
||||||
applyModalityVisibility(node, { has_visual: true, has_audio: true });
|
applyModalityVisibility(node, { has_visual: true, has_audio: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ app.registerExtension({
|
|||||||
name: "H3RefModPicker.RefModLoader",
|
name: "H3RefModPicker.RefModLoader",
|
||||||
|
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData) {
|
async beforeRegisterNodeDef(nodeType, nodeData) {
|
||||||
if (nodeData?.name !== "H3RefModLoader") return;
|
if (nodeData?.name !== "DumasH3RefModPicker_H3RefModLoader") return;
|
||||||
|
|
||||||
const onNodeCreated = nodeType.prototype.onNodeCreated;
|
const onNodeCreated = nodeType.prototype.onNodeCreated;
|
||||||
nodeType.prototype.onNodeCreated = function () {
|
nodeType.prototype.onNodeCreated = function () {
|
||||||
|
|||||||
@@ -622,7 +622,7 @@ app.registerExtension({
|
|||||||
name: "H3RefModPicker.VisualRefModPicker",
|
name: "H3RefModPicker.VisualRefModPicker",
|
||||||
|
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData) {
|
async beforeRegisterNodeDef(nodeType, nodeData) {
|
||||||
if (nodeData?.name !== "H3RefModVisualPicker") return;
|
if (nodeData?.name !== "DumasH3RefModPicker_H3RefModVisualPicker") return;
|
||||||
|
|
||||||
const onNodeCreated = nodeType.prototype.onNodeCreated;
|
const onNodeCreated = nodeType.prototype.onNodeCreated;
|
||||||
nodeType.prototype.onNodeCreated = function () {
|
nodeType.prototype.onNodeCreated = function () {
|
||||||
|
|||||||
+1
-1
@@ -29,6 +29,6 @@ export function installRefModApply(nodeType) {
|
|||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: "MiniMaxH3.ApplyCanvasCompatibility",
|
name: "MiniMaxH3.ApplyCanvasCompatibility",
|
||||||
beforeRegisterNodeDef(nodeType, nodeData) {
|
beforeRegisterNodeDef(nodeType, nodeData) {
|
||||||
if (nodeData.name === "MiniMaxH3RefModApply") installRefModApply(nodeType);
|
if (nodeData.name === "DumasMiniMaxH3RefMod_MiniMaxH3RefModApply") installRefModApply(nodeType);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ function updateLabels(node) {
|
|||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: "MiniMaxH3.CreationLabels",
|
name: "MiniMaxH3.CreationLabels",
|
||||||
beforeRegisterNodeDef(nodeType, nodeData) {
|
beforeRegisterNodeDef(nodeType, nodeData) {
|
||||||
if (!["MiniMaxH3RefModExtract", "MiniMaxH3RefModMasterExtract"].includes(nodeData.name)) return;
|
if (!["DumasMiniMaxH3RefMod_MiniMaxH3RefModExtract", "DumasMiniMaxH3RefMod_MiniMaxH3RefModMasterExtract"].includes(nodeData.name)) return;
|
||||||
for (const hook of ["onNodeCreated", "onConfigure"]) {
|
for (const hook of ["onNodeCreated", "onConfigure"]) {
|
||||||
const previous = nodeType.prototype[hook];
|
const previous = nodeType.prototype[hook];
|
||||||
nodeType.prototype[hook] = function(...args) {
|
nodeType.prototype[hook] = function(...args) {
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ export function updateRefModChoices(node, entries) {
|
|||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: "MiniMaxH3.RefModLibrary",
|
name: "MiniMaxH3.RefModLibrary",
|
||||||
beforeRegisterNodeDef(nodeType, nodeData) {
|
beforeRegisterNodeDef(nodeType, nodeData) {
|
||||||
if (!["MiniMaxH3RefModsLoader", "MiniMaxH3RefModsAxis"].includes(nodeData.name)) return;
|
if (!["DumasMiniMaxH3RefMod_MiniMaxH3RefModsLoader", "DumasMiniMaxH3RefMod_MiniMaxH3RefModsAxis"].includes(nodeData.name)) return;
|
||||||
const removed = nodeType.prototype.onRemoved;
|
const removed = nodeType.prototype.onRemoved;
|
||||||
nodeType.prototype.onRemoved = function(...args) {
|
nodeType.prototype.onRemoved = function(...args) {
|
||||||
this._refmodRefresh?.abort();
|
this._refmodRefresh?.abort();
|
||||||
|
|||||||
+1
-1
@@ -151,7 +151,7 @@ function setupSlots(node) {
|
|||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: "MiniMaxH3.AdditiveSlots",
|
name: "MiniMaxH3.AdditiveSlots",
|
||||||
beforeRegisterNodeDef(nodeType, nodeData) {
|
beforeRegisterNodeDef(nodeType, nodeData) {
|
||||||
if (["MiniMaxH3RefModsLoader", "MiniMaxH3RefModsAxis"].includes(nodeData.name)) {
|
if (["DumasMiniMaxH3RefMod_MiniMaxH3RefModsLoader", "DumasMiniMaxH3RefMod_MiniMaxH3RefModsAxis"].includes(nodeData.name)) {
|
||||||
installRefModSlots(nodeType);
|
installRefModSlots(nodeType);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
import dataclasses
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
import dumas_vendored_nodes as vendored
|
||||||
|
|
||||||
|
|
||||||
|
@dataclasses.dataclass(frozen=True)
|
||||||
|
class _Schema:
|
||||||
|
node_id: str
|
||||||
|
category: str
|
||||||
|
display_name: str
|
||||||
|
|
||||||
|
|
||||||
|
class _LegacyNode:
|
||||||
|
CATEGORY = "Upstream"
|
||||||
|
|
||||||
|
|
||||||
|
class _ModernNode:
|
||||||
|
@classmethod
|
||||||
|
def define_schema(cls):
|
||||||
|
return _Schema("UpstreamModern", "Upstream", "Modern")
|
||||||
|
|
||||||
|
|
||||||
|
class VendoredNamespaceTests(unittest.TestCase):
|
||||||
|
def test_legacy_and_modern_nodes_get_distinct_dumas_identity(self):
|
||||||
|
original_packages = vendored._PACKAGES
|
||||||
|
original_loader = vendored._load_pack
|
||||||
|
try:
|
||||||
|
vendored._PACKAGES = (
|
||||||
|
(".one", "One", "DumasOne", "Dumas/Test"),
|
||||||
|
)
|
||||||
|
vendored._load_pack = lambda _name: type(
|
||||||
|
"Pack",
|
||||||
|
(),
|
||||||
|
{
|
||||||
|
"NODE_CLASS_MAPPINGS": {
|
||||||
|
"UpstreamLegacy": _LegacyNode,
|
||||||
|
"UpstreamModern": _ModernNode,
|
||||||
|
},
|
||||||
|
"NODE_DISPLAY_NAME_MAPPINGS": {},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
mappings, display = vendored._namespaced_mappings()
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
set(mappings), {"DumasOne_UpstreamLegacy", "DumasOne_UpstreamModern"}
|
||||||
|
)
|
||||||
|
self.assertNotIn("UpstreamLegacy", mappings)
|
||||||
|
self.assertEqual(mappings["DumasOne_UpstreamLegacy"].CATEGORY, "Dumas/Test")
|
||||||
|
self.assertEqual(
|
||||||
|
mappings["DumasOne_UpstreamModern"].define_schema(),
|
||||||
|
_Schema("DumasOne_UpstreamModern", "Dumas/Test", "DUMAS One · UpstreamModern"),
|
||||||
|
)
|
||||||
|
self.assertTrue(all(name.startswith("DUMAS ") for name in display.values()))
|
||||||
|
finally:
|
||||||
|
vendored._PACKAGES = original_packages
|
||||||
|
vendored._load_pack = original_loader
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
Reference in New Issue
Block a user