API to use ComfyUI nodes inside Nuke, talking to a ComfyUI server.
This is a personal fork of vinavfx/ComfyUI-for-Nuke with a batch of fixes that make real-world workflows actually import and run, plus initial support for ComfyUI's v3 node API (COMFY_DYNAMICCOMBO_V3, COMFY_AUTOGROW_V3).
All fixes live on the fix/v3-api-and-import-robustness branch — main is intentionally kept identical to upstream so you can pull updates from vinavfx without conflicts.
- Auto-connect during import is disabled. Upstream
create_nodeinteractively chains every new Group to whatever node Nuke had selected when it was created. During a workflow import this pollutes inputs and blocks the subsequent wire pass — JSON node order suddenly mattered, and some workflows imported broken while logically identical ones imported fine. A module-leveldisable_auto_connectflag held only for the duration ofimport_workflowneutralizes this. force_outputis stamped automatically during the wire pass, read from each link'ssource_slotin the JSONlinksarray. Eliminates the "Connected to node with duplicate outputs, Connect now?" prompts for sources likeApplyAdvancedControlNet(positive+negative, both CONDITIONING) orImageResizeKJ(width+height, both INT).- Stale node cache is cleared.
update_menu.update()now wipescomfyui_nodesbefore refilling. Without this, nodes renamed or removed on the server kept their old templates in Nuke memory, and workflows referencing the old name spawned ghost groups from the stale template instead of falling toNoOp+ "not installed" warning. - Node rename alias map. Workflows authored against legacy node names transparently retarget to the current type. Initial entry:
OpenAIGPTImage2→OpenAIGPTImageNodeV2. Extendupdate_menu.NODE_ALIASESas you hit more renames. - ComfyUI v3 node API support —
COMFY_DYNAMICCOMBO_V3andCOMFY_AUTOGROW_V3:- DynamicCombo (e.g.
OpenAIGPTImageNodeV2.model) is flattened into a plain COMBO over the option keys + the union of all per-option sub-inputs. - Autogrow lists (e.g.
images→image_1..image_16) expose the first 4 template slots as optional inputs. TuneAUTOGROW_EXPOSE_COUNTinupdate_menu.py. - v3 nested ids use dots (
model.images.image_1), which Nuke knob names can't contain — encoded as__and translated back to.when building the prompt.
- DynamicCombo (e.g.
- UTF-8 file IO in
python_util/util.py. Workflow JSONs containing any non-ASCII byte (em-dashes in notes, accented model paths, emoji) no longer crash withUnicodeDecodeErroron Windows where the default codec is cp1252. Could not set knob Xpopup → stdout log. Schema mismatches no longer block import with a modal — they print to Script Editor as[c2n] could not set knob ...and the import continues.mykey.txtAPI key injection.connection.pyandrun.pyread a gitignoredsrc/mykey.txtand pass it asapi_key_comfy_orginextra_datafor Partner / ComfyUI API nodes. Drop a one-line file with your key, never commit it.
- ComfyUI 0.21.1
- Nuke 17.0v2 (Windows 11)
- ComfyUI workflow format
version: 0.4,frontendVersion: 1.42.x – 1.43.x
Should work on Nuke 11+ and any ComfyUI ≥ 0.3 in principle (the v3 schema flattening kicks in only when the server actually emits v3 types, so older nodes go through the original code path unchanged).
- Nuke 11 or higher.
websocket-clientPython library (installed into Nuke's Python — see step 3 below).- A running ComfyUI server (local or remote).
ComfyUI-VideoHelperSuitecustom node (needed to load images and sequences).ComfyUI-HQ-Image-Savecustom node (if you want to work in EXR).
⚠️ The repo uses git submodules (python_util,nuke_util).git clonealone leaves those folders empty and the plugin will fail to import. You must init submodules, or use--recurse-submodules.
⚠️ GitHub's "Download ZIP" button does not include submodule contents — don't use it. Clone with git.
cd ~/.nuke # Linux/Mac
cd "C:\Users\<username>\.nuke" # Windows
git clone --recurse-submodules -b fix/v3-api-and-import-robustness \
https://github.com/markitzeroo/ComfyUI-for-Nuke.git comfyui2nukeIf you already cloned without --recurse-submodules or are switching to the fix branch from main:
cd comfyui2nuke
git checkout fix/v3-api-and-import-robustness
git submodule update --init --recursiveThe python_util submodule points to markitzeroo/python_util on its fix/utf8-encoding branch — the recorded commit pointer pulls the right code automatically once submodules are initialized.
Adjust the Nuke version to whatever you have installed:
# Linux/Mac
/usr/local/Nuke17.0v2/python3 -m pip install websocket-client
# Windows (Run cmd as Administrator)
"C:\Program Files\Nuke17.0v2\python.exe" -m pip install websocket-clientIf you installed websocket-client as a non-root user (in ~/.local/...), add this to your Nuke menu.py before the comfyui import block so Nuke can find it:
import os, sys, nuke
nuke.pluginAddPath('{}/.local/lib/python{}.{}/site-packages'.format(
os.path.expanduser('~'), sys.version_info.major, sys.version_info.minor))Add these two lines to your Nuke menu.py:
import comfyui2nuke as comfyui
comfyui.setup()Open settings.py and set:
COMFYUI_DIR = 'C:/ComfyUI/ComfyUI/' # absolute path to ComfyUI install
URL = 'localhost:8188' # or 'host:port' of remote serverOr set the env vars NUKE_COMFYUI_DIR and NUKE_COMFYUI_URL before launching Nuke and leave settings.py alone.
If you use Partner nodes (OpenAI, Anthropic, Veo, Sora, Kling, etc.) that need a api_key_comfy_org:
- Create the file
src/mykey.txtinside the plugin folder. - Put your API key on a single line, save.
- That's it —
connection.pyreads it on every prompt submission and injects it intoextra_data.
The file is gitignored, will never end up in commits.
cd C:/ComfyUI/ComfyUI
python main.pyOpen Nuke. You should see a ComfyUI menu in the Nodes menu. First time around it will populate from the server's object_info. From then on you can import workflows via Nodes → ComfyUI → Import Workflow.
git fetch upstream
git checkout main
git merge upstream/main # main stays identical to upstream
git push origin mainThen rebase the fix branch on the new main if you want:
git checkout fix/v3-api-and-import-robustness
git rebase main
git push --force-with-lease origin fix/v3-api-and-import-robustnessIn Nuke: Nodes → ComfyUI → 🔄 Update all ComfyUI. This clears the cache and re-reads object_info from the server. Restart Nuke if a menu item still feels stuck.
- When connecting any image or roto from Nuke, the FrameRange of the output is the batch size that ComfyUI receives.
- To work with pixel values >1 or <0, set the
SaveEXRnode'stonemapknob to linear. - Latent operations only accept dimensions that are multiples of 8. Insert the MultipleOf node before the latent stage, and use its "create restore node" button to undo the resize after inference.
- To load every ComfyUI node at Nuke startup, set
UPDATE_MENU_AT_START = Trueinsettings.py. - For static branching inside a ComfyUI graph use SwitchAny; otherwise use ComfyUI's own switches.
- To run ComfyUI on a different machine, share the install directory over the network and set
COMFYUI_DIRto the mapped path.
| Symptom | Likely cause | Fix |
|---|---|---|
ImportError: cannot import name 'jread' at startup |
Submodules not initialized | git submodule update --init --recursive |
| Workflow imports with broken / missing connections | Old version of the plugin (no disable_auto_connect) |
Make sure you're on the fix/v3-api-and-import-robustness branch |
Imported node has only a fraction of expected knobs (model, n, seed and nothing else for OpenAIGPTImageNodeV2) |
Server's object_info is stale |
Restart ComfyUI server, then 🔄 Update all ComfyUI in Nuke |
Could not set the knob 'X' value for this node 'Y' ! popup |
Pre-fork build — fork routes this to stdout instead | Ensure you're on the fix branch |
'NoneType' object has no attribute 'shape' from KSampler at runtime |
ControlNet image branch is empty / wrong ControlNet model | Check ControlNet model is the ProMax variant; verify image chain reaches ApplyAdvancedControlNet.image |
OpenAIGPTImage2.execute() got an unexpected keyword argument 'model.image_1' |
Plugin built with old (incomplete) v3 prefix path | Ensure you're on the fix branch (3-level prefix model.images.image_1) |
- Original plugin: Francisco Contreras / vinavfx.
- Fork maintenance & v3 / robustness fixes: @markitzeroo.
