Skip to content

Commit 68a1ac6

Browse files
committed
Precomp Switcher v1.0.0: initial public release
A Nuke plugin that creates a Write + SwitchPrecomp + backdrop with one hotkey, with three colored states (Bypass / Rendering / Precomped) and Node Graph hotkeys for build (Shift+W), render (F7), and read-from-write toggle (Alt+R). Ships with full User and Developer Guides as PDFs.
0 parents  commit 68a1ac6

11 files changed

Lines changed: 3830 additions & 0 deletions

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
5+
# macOS
6+
.DS_Store
7+
8+
# Nuke working files
9+
*.nk
10+
*.nk~
11+
*.nk.autosave
12+
13+
# Markdown (only README.md is public)
14+
*.md
15+
!README.md
16+
17+
# Editor / AI tooling
18+
.claude/
19+
.cursor/
20+
.codex/
21+
.code-review/
22+
.plan/
23+
24+
# Local-only modules
25+
precomp_switcher/reload.py
26+
fake_pipeline/
27+
28+
# Local-only project material
29+
docs/
30+
docs_pdf/
31+
output/
32+
images/
33+
marketing/
34+
35+
# Release / media artifacts
36+
*.pdf
37+
*.zip
38+
*.mp4
39+
*.mov
40+
*.exr
41+
*.abc

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Tony Lyons
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
![Precomp Switcher in action](img/precomp_switcher_demo.gif)
2+
3+
by [Tony Lyons](https://github.com/CreativeLyons) | www.compositingmentor.com
4+
# Precomp Switcher
5+
6+
The Precomp Switcher lets you define important settings of your Write node quickly and intuitively, and creates a **Write + Switch + Backdrop** setup.
7+
8+
There are clear labels and colors, always letting you know the current **"State"** of the precomp.
9+
10+
Toggle between **Precomped** and **Bypass** states, simply by disabling the switch node. The **Rendering** state reminds you to swap out your precomp when it's done rendering.
11+
12+
Stop manually reconnecting. Start Switching.
13+
14+
## Why use it?
15+
16+
- **Consistency.** Every precomp in every script looks and behaves the same.
17+
- **Readability.** Tile color and label tell you at a glance whether a precomp is live, mid-render, or rendered.
18+
- **Speed.** One hotkey to build, one to render, one to read back and flip/toggle.
19+
- **Pipeline-friendly.** If your studio has its own render command, custom Write Node, custom Read Node or read-from-write tool, a TD can configure this tool to use those hooks to their own pipeline commands, instead of native Nuke ones.
20+
21+
## The 3 states at a glance
22+
23+
![The three precomp states at a glance](img/precomp_switcher_different_states.jpeg)
24+
25+
Every precomp sits in one of three states. The Backdrop and Switch tile & colors all track the state together:
26+
27+
| State | Color | What it means |
28+
|---------------|-------|-------------------------------------------------------|
29+
| **Bypass** | White | Live. Switch disabled; downstream sees the live tree. |
30+
| **Rendering** | Blue | The Write is being rendered. Visual-only marker. |
31+
| **Precomped** | Red | Reading the rendered output by the enabled Switch. |
32+
33+
## Quick Start
34+
35+
![Precomp Settings dialog: name entered](img/Precomp_creation_panel_named.jpeg)
36+
37+
1. Start with a saved `.nk` script.
38+
2. Head to the area of the comp tree you want to precomp and press **Shift+W**.
39+
3. Type a precomp name, click **OK**.
40+
4. You should see a new Precomp Switcher backdrop with a Write + Switch.
41+
5. With the precomp Write selected, press **F7** to render. Your Precomp Switcher should turn Blue and say **Rendering**.
42+
6. When the render is done, select only the precomp Write and press **Alt+R** to create and connect a Read.
43+
7. The Precomp Switcher should turn Red and say **Precomped**.
44+
8. Disable/enable the SwitchPrecomp at any time to toggle between Precomped and Bypass. Pressing **Alt+R** with either the Read or the Switch selected will also toggle the Bypass/Precomped states.
45+
46+
For the full walkthrough, see User Guide §4.
47+
48+
## Node Graph Hotkeys
49+
50+
| Key | Action |
51+
|-------------|--------------------------------------------------------------|
52+
| **Shift+W** | Create Precomp Switcher. |
53+
| **F7** | Render selected Writes; each backdrop flips to **Rendering**. |
54+
| **Alt+R** | Read from Write, or toggle between **Bypass** and **Precomped**. |
55+
56+
Defaults can be overridden in [`precomp_config.py`](precomp_switcher/precomp_config.py). See User Guide §7 for the full hotkey behavior, including the optional Linked Read variant.
57+
58+
## Localization (Optional Feature)
59+
60+
![Localization prompt on first Read from Write](img/Localization_Prompt.jpeg)
61+
62+
If you're working with files over a network, there's an optional feature for Localizing your Precomp Reads automatically. If enabled, there will be a prompt on your first Read from Write, where it will ask if you'd like to Localize your precomp. Click **Remember my Choice** to always repeat for later Read from Write actions. The choice is stored in the Write node under a Precomp Tab, so that you can always change later.
63+
64+
This feature is disabled by default.
65+
66+
Set `PRECOMP_LOCALIZATION_FEATURES_ENABLED = True` in the `precomp_config.py` to enable.
67+
68+
## Installation
69+
70+
**Requirements:** Nuke 13+.
71+
72+
Precomp Switcher is a self-loading plugin. Meaning it's designed to load everything it needs by just adding the folder to Nuke's plugin path.
73+
74+
Here is a step by step guide:
75+
76+
1. Simply download the latest Release `.zip`, or clone/download this repo anywhere on disk.
77+
2. Add the `precomp_switcher` folder (the one with all the .py files) to your Nuke plugin path.
78+
79+
**Option A**
80+
- Drop the folder inside your `~/.nuke/` directory
81+
- Open or create your `~/.nuke/init.py` file in a Text Editor
82+
- Then add this line to your `init.py`:
83+
```python
84+
nuke.pluginAddPath('./precomp_switcher')
85+
```
86+
**Option B**
87+
- Or use any other location on disk or over the network:
88+
```python
89+
nuke.pluginAddPath('/path/to/precomp_switcher')
90+
```
91+
- Above is just an example path, so be sure to replace `/path/to/` with the folder path where you placed the precomp_switcher.
92+
93+
That's it! No `menu.py` entry needed.
94+
If you want to remove, add, or change hotkeys of Precomp Switcher, open up the `precomp_config.py` in a Text Editor and there you can assign, change, or disable hotkeys.
95+
96+
See **Developer Guide §2** for more info on customization via the config file.
97+
98+
After Nuke launches, you should see **Edit → Node → Precomp Switcher → Create Precomp Switcher** with **Shift+W** as its hotkey.
99+
100+
## Documentation
101+
102+
- **User Guide (PDF)**: install, quick start, every feature, troubleshooting.
103+
- **Developer Guide (PDF)**: pipeline integration, configuration reference, architecture.
104+
- [**`precomp_config.py`**](precomp_switcher/precomp_config.py): every user setting in one file with inline comments for help.
105+
106+
## License & Credits
107+
108+
MIT License. © 2026 [Tony Lyons](https://github.com/CreativeLyons). See [LICENSE](LICENSE).
109+
110+
www.CompositingMentor.com
111+
Contact: [creativelyons@gmail.com](mailto:creativelyons@gmail.com)
112+
113+
### Special Thanks
114+
115+
A very special thanks to **Alexey Kuchinski** for inspiring the idea, design, and functionality of the Precomp Switcher from his own tool. Full credit for the inception of the idea goes to Alexey. This is my best implementation of that idea, brought to the community.
116+
117+
The User and Dev guides were inspired by three well-loved Nuke tool user guides: **KnobScripter v3.2** (Adrian Pueyo), **Stamps v1.1** (Adrian Pueyo & Alexey Kuchinski), and **W_hotbox v2.0** (Wouter Gilsing). Thanks for showing me how it's done!

img/Localization_Prompt.jpeg

8.27 KB
Loading
22.7 KB
Loading

img/precomp_switcher_demo.gif

1.12 MB
Loading
114 KB
Loading

precomp_switcher/init.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""precomp_switcher plugin bootstrap.
2+
3+
Nuke runs ``init.py`` from each directory on ``NUKE_PATH``. The plugin root is
4+
already on the import path; this file exists so the folder is recognized as a
5+
plugin bundle alongside ``menu.py``.
6+
"""

precomp_switcher/menu.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
"""NUKE_PATH startup: Precomp Switcher menu and Node Graph hotkeys.
2+
3+
Creates the Precomp Switcher menu entry and registers configurable Node Graph hotkeys.
4+
"""
5+
6+
import nuke
7+
8+
import precomp_switcher as ps
9+
10+
11+
def _ensure_precomp_menu():
12+
"""Return ``Edit → Node → Precomp Switcher`` from the first available menu root."""
13+
for root_name in ("Nuke", "Nodes"):
14+
try:
15+
root = nuke.menu(root_name)
16+
if root is None:
17+
continue
18+
return root.addMenu("Edit").addMenu("Node").addMenu("Precomp Switcher")
19+
except Exception:
20+
continue
21+
# Final fallback for unusual hosts.
22+
return nuke.menu("Nuke").addMenu("Edit").addMenu("Node").addMenu("Precomp Switcher")
23+
24+
25+
_create_precomp_switcher_hotkey = ps.cfg_get("CREATE_PRECOMP_SWITCHER_HOTKEY")
26+
27+
if _create_precomp_switcher_hotkey:
28+
_ensure_precomp_menu().addCommand(
29+
"Create Precomp Switcher",
30+
"import precomp_switcher as ps; ps.create_precomp_switcher()",
31+
_create_precomp_switcher_hotkey,
32+
shortcutContext=2,
33+
)
34+
else:
35+
_ensure_precomp_menu().addCommand(
36+
"Create Precomp Switcher",
37+
"import precomp_switcher as ps; ps.create_precomp_switcher()",
38+
shortcutContext=2,
39+
)
40+
41+
ps.register_render_hotkey()
42+
ps.register_read_from_write_hotkey()
43+
ps.register_linked_read_from_write_hotkey()
44+
45+
46+
try:
47+
from PySide6 import QtCore
48+
except ImportError:
49+
from PySide2 import QtCore
50+
51+
52+
def _rereregister_hooks_after_startup():
53+
"""Other scripts can override hotkeys after menu.py; re-apply hooks."""
54+
try:
55+
ps._RENDER_HOTKEY_REGISTERED = False
56+
ps._READ_FROM_WRITE_HOTKEY_REGISTERED = False
57+
ps._LINKED_READ_FROM_WRITE_HOTKEY_REGISTERED = False
58+
ps.register_render_hotkey()
59+
ps.register_read_from_write_hotkey()
60+
ps.register_linked_read_from_write_hotkey()
61+
except Exception:
62+
pass
63+
64+
65+
QtCore.QTimer.singleShot(0, _rereregister_hooks_after_startup)

0 commit comments

Comments
 (0)