Complete python and blink script editor for Nuke.
KnobScripter
Updated: 16 January 2024
Author: adrianpueyo
Compatible Nuke versions: 11.0 or later
Compatibility: Linux, Mac, Windows
KnobScripter v3.1 (or KS3) is a full script editor for Nuke that can script python on .py files and knobs as well as BlinkScript, with all the functionality from the default script editor in Nuke plus syntax helpers, predictions, snippets and other handy features.
KS3 is the next major step for this tool, and it features a greatly optimized code, Python 3 compatibility, BlinkScript mode, a Code Gallery and many other features and fixes.
KnobScripter was designed as a simple python script editor for Nuke, and its main goal is to let you interact with Nuke’s python API in a more pleasant way than Nuke’s default methods. It doesn’t intend to replace a fully featured IDE, but it proves enough for most common python tasks and quick work with snippets, basically anything that needs quick interaction with Nuke’s python console.
With this in mind, I focused its development in the aspects that I love about IDEs regarding efficiency (such as syntax helpers), in covering everything the default Script Editor in Nuke currently offers, and last but not least, in covering the python aspects of Nuke that are generally tedious, such as adding python or blink code to nodes/knobs.
Full scripting mode for .py files.
You can create, browse, modify or toggle between python files and folders.
Node editing mode.
In node mode, you can script directly on python buttons or callback knobs, as well as BlinkScript.
Snippets.
Snippets are short codes you can assign to longer pieces of code, so that by writing the short code and pressing tab you’ll get the long code.
You can also choose where you’ll want your cursor to appear with the convenient $$.
Code Gallery.
The Code Gallery is a new way to store and browse through codes that you might want to revisit many times as reference.
It includes a basic system of archiving. Then you can quickly browse and sort through the different codes you saved, while folding categories and reading descriptions.
Python output console.
Same as the one from Nuke’s default script editor, where you can execute any code and read the python output log.
Find-Replace.
A proper find-replace widget as you’d expect in a python editor.
Syntax highlighting, line numbers, auto-intending, auto-completer...
You can choose between two code highlighting styles (including one inspired by sublime’s popular Monokai theme).
Auto-completions on tab read from the available modules and the actual functions and variables in your script.
Installation:
A. Fresh install
- Copy the KnobScripter folder and paste it somewhere in your Nuke plugin path. For example, inside Users/YourUser/.nuke directory.
- Open with a text editor the file menu.py that lives next to your KnobScripter folder, or create one if it doesn’t exist.
- Add the following line:
import KnobScripter - Restart Nuke.
B. Updating KnobScripter
- Replace the KnobScripter folder with the updated one.
- Restart Nuke.
Update Log:
KnobScripter v3.1 - 15 Jan 2024
New features:
- Nuke 14 & 15 compatible.
- Ctrl + +/- to change font size on both editor and output console.
- Multi-line codes can be run on knobs as well (thanks pancho!)
Bug fixes and enhancements:
- Fixed character movement error (thanks itaki!)
- Removed python package ‘six’ (thanks itaki!)
- Esc behaviour limited to floating panels only (thanks pancho!)
- Other little bug fixes.
KnobScripter v3.0 - 25 April 2022
New features:
- Blinkscript mode.
- Compatible with python 2 and 3 (Nuke 13+) and Win/Mac/Lin.
- Code Gallery.
- Fully redesigned Snippets, with a new Snippet Editor, default snippets and a simplified workflow.
- Preferences Panel redone, and new settings added.
- Keyword Hotbox for double clicking on keywords and showing alternatives.
- Storing the knob and .py editor state, for quickly jumping back to your edit point on new KnobScripters.
- New code helpers such as Ctrl/Cmd + and Ctrl/Cmd - for changing font size.
- Method placeholders.
- Parentheses wrappers.
Bug fixes and enhancements:
- Whole code refactored, and improved py import scheme.
- Fixed predictor tab with custom words in Nuke 13.
- Fixed backspace crash on indented lines.
- Snippet behaviour improvements.
- Fixed syntax highlighting errors.
KnobScripter v2.4 - 7 December 2020
New features:
- Run in Context mode.
- “Grab current dimensions” button.
Bug fixes and enhancements:
- Improved modal window behavior (thanks Jed Smith!).
- Ctrl+Backspace now clears output log.
- Improved how Nuke’s Script Editor widgets are found (thanks Jed Smith!)
- Modified (*) property now shows properly on the knob dropdown.
- Picker (“change to Node”) crashing fixed.
- Unicode encoding works with both .py scripts and nodes now.
- Compatible with Nuke 12.2
- Add snippet button scrolls to top.
KnobScripter v2.3 - 12 December 2019
Bug fixes and enhancements:
- Fixed bracket and brace closing behaviour.
- Added QStringListModel compatibility on Nuke 12.
- Symlink error hidden on Windows.
KnobScripter v2.2 - 24 August 2019
Bug fixes and enhancements:
- Variable placeholders error fixed (bug introduced on v2.1).
- PySide import switch including Qt.
KnobScripter v2.1 - 10 August 2019
New features:
- New Sublime color style. You can now choose between sublime or Nuke style in the Preferences.
- Font selector in the Preferences, where you can set any available font.
- Option to display the knob labels too (and not only names) on the knob dropdown.
- Now accepting special characters (like accents or symbols) through utf-8 encoding.
- New Snippets functionality: A snippet containing “hello $$world$$” will write “hello world” and the word “world” will be selected straightaway.
- Auto-completer (when pressing tab) now also includes the functions, variables, classes etc live from the current script you’re writing.
Bug fixes and enhancements:
- Python syntax highlighting improved.
- Snippet editor now includes syntax highlighting.
- Parenthesis/brackets auto-closing behavior improved when written inside each other.
- Fixed error that prevented opening a new KnobScripter when a Blinkscript node properties were open too.
- Tested on Windows OS (Nuke 11.3) and a few minor bugs fixed.
- Improved auto-scroll to cursor behavior when duplicating, moving or unindenting lines.
I hope KS3 will help improve your scripting experience! Bugs and suggestions always appreciated :)
Copyright (c) 2016-2023, Adrian Pueyo
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Credit goes to Wouter Gilsing for the script editor widget part, which he made for his tool W_Hotbox.
It can be downloaded here: http://www.nukepedia.com/python/ui/w_hotbox