├── KnobScripter ├── __init__.py ├── icons │ ├── add.png │ ├── run.png │ ├── adjust.png │ ├── change.png │ ├── delete.png │ ├── enter.png │ ├── export.png │ ├── flash.png │ ├── grid.png │ ├── help.png │ ├── import.png │ ├── insert.png │ ├── pick.png │ ├── play.png │ ├── prefs.png │ ├── prefs2.png │ ├── save.png │ ├── search.png │ ├── ap_tools.png │ ├── backups.png │ ├── compile.png │ ├── download.png │ ├── exitnode.png │ ├── h_expand.png │ ├── history.png │ ├── icon_run.png │ ├── refresh.png │ ├── save_all.png │ ├── snippets.png │ ├── sort_az.png │ ├── sort_za.png │ ├── transfer.png │ ├── v_expand.png │ ├── add_filled.png │ ├── duplicate.png │ ├── fullscreen.png │ ├── h_collapse.png │ ├── help_filled.png │ ├── icon_enter.png │ ├── icon_pick.png │ ├── icon_play.png │ ├── icon_prefs.png │ ├── icon_prefs2.png │ ├── icon_save.png │ ├── icon_search.png │ ├── v_collapse.png │ ├── clear_console.png │ ├── font_decrease.png │ ├── font_increase.png │ ├── icon_backups.png │ ├── icon_compile.png │ ├── icon_download.png │ ├── icon_exitnode.png │ ├── icon_refresh.png │ ├── icon_snippets.png │ ├── knob_scripter.png │ └── icon_clearConsole.png ├── info.py ├── script_output.py ├── config.py ├── letItSnow.py ├── keywordhotbox.py ├── utils.py ├── dialogs.py ├── findreplace.py ├── blinkhighlighter.py ├── content.py ├── widgets.py ├── pythonhighlighter.py ├── snippets.py ├── prefs.py ├── codegallery.py ├── ksscripteditor.py └── ksscripteditormain.py ├── .gitignore ├── KnobScripter v3.1 User Guide.pdf └── README.md /KnobScripter/__init__.py: -------------------------------------------------------------------------------- 1 | from KnobScripter.knob_scripter import * -------------------------------------------------------------------------------- /KnobScripter/icons/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/add.png -------------------------------------------------------------------------------- /KnobScripter/icons/run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/run.png -------------------------------------------------------------------------------- /KnobScripter/icons/adjust.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/adjust.png -------------------------------------------------------------------------------- /KnobScripter/icons/change.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/change.png -------------------------------------------------------------------------------- /KnobScripter/icons/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/delete.png -------------------------------------------------------------------------------- /KnobScripter/icons/enter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/enter.png -------------------------------------------------------------------------------- /KnobScripter/icons/export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/export.png -------------------------------------------------------------------------------- /KnobScripter/icons/flash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/flash.png -------------------------------------------------------------------------------- /KnobScripter/icons/grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/grid.png -------------------------------------------------------------------------------- /KnobScripter/icons/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/help.png -------------------------------------------------------------------------------- /KnobScripter/icons/import.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/import.png -------------------------------------------------------------------------------- /KnobScripter/icons/insert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/insert.png -------------------------------------------------------------------------------- /KnobScripter/icons/pick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/pick.png -------------------------------------------------------------------------------- /KnobScripter/icons/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/play.png -------------------------------------------------------------------------------- /KnobScripter/icons/prefs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/prefs.png -------------------------------------------------------------------------------- /KnobScripter/icons/prefs2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/prefs2.png -------------------------------------------------------------------------------- /KnobScripter/icons/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/save.png -------------------------------------------------------------------------------- /KnobScripter/icons/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/search.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.pyc 3 | .DS_Store 4 | KnobScripter/knob_scripter.sublime-workspace 5 | venv 6 | tab_stats.dat 7 | .idea -------------------------------------------------------------------------------- /KnobScripter/icons/ap_tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/ap_tools.png -------------------------------------------------------------------------------- /KnobScripter/icons/backups.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/backups.png -------------------------------------------------------------------------------- /KnobScripter/icons/compile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/compile.png -------------------------------------------------------------------------------- /KnobScripter/icons/download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/download.png -------------------------------------------------------------------------------- /KnobScripter/icons/exitnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/exitnode.png -------------------------------------------------------------------------------- /KnobScripter/icons/h_expand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/h_expand.png -------------------------------------------------------------------------------- /KnobScripter/icons/history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/history.png -------------------------------------------------------------------------------- /KnobScripter/icons/icon_run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/icon_run.png -------------------------------------------------------------------------------- /KnobScripter/icons/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/refresh.png -------------------------------------------------------------------------------- /KnobScripter/icons/save_all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/save_all.png -------------------------------------------------------------------------------- /KnobScripter/icons/snippets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/snippets.png -------------------------------------------------------------------------------- /KnobScripter/icons/sort_az.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/sort_az.png -------------------------------------------------------------------------------- /KnobScripter/icons/sort_za.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/sort_za.png -------------------------------------------------------------------------------- /KnobScripter/icons/transfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/transfer.png -------------------------------------------------------------------------------- /KnobScripter/icons/v_expand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/v_expand.png -------------------------------------------------------------------------------- /KnobScripter v3.1 User Guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter v3.1 User Guide.pdf -------------------------------------------------------------------------------- /KnobScripter/icons/add_filled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/add_filled.png -------------------------------------------------------------------------------- /KnobScripter/icons/duplicate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/duplicate.png -------------------------------------------------------------------------------- /KnobScripter/icons/fullscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/fullscreen.png -------------------------------------------------------------------------------- /KnobScripter/icons/h_collapse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/h_collapse.png -------------------------------------------------------------------------------- /KnobScripter/icons/help_filled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/help_filled.png -------------------------------------------------------------------------------- /KnobScripter/icons/icon_enter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/icon_enter.png -------------------------------------------------------------------------------- /KnobScripter/icons/icon_pick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/icon_pick.png -------------------------------------------------------------------------------- /KnobScripter/icons/icon_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/icon_play.png -------------------------------------------------------------------------------- /KnobScripter/icons/icon_prefs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/icon_prefs.png -------------------------------------------------------------------------------- /KnobScripter/icons/icon_prefs2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/icon_prefs2.png -------------------------------------------------------------------------------- /KnobScripter/icons/icon_save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/icon_save.png -------------------------------------------------------------------------------- /KnobScripter/icons/icon_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/icon_search.png -------------------------------------------------------------------------------- /KnobScripter/icons/v_collapse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/v_collapse.png -------------------------------------------------------------------------------- /KnobScripter/icons/clear_console.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/clear_console.png -------------------------------------------------------------------------------- /KnobScripter/icons/font_decrease.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/font_decrease.png -------------------------------------------------------------------------------- /KnobScripter/icons/font_increase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/font_increase.png -------------------------------------------------------------------------------- /KnobScripter/icons/icon_backups.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/icon_backups.png -------------------------------------------------------------------------------- /KnobScripter/icons/icon_compile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/icon_compile.png -------------------------------------------------------------------------------- /KnobScripter/icons/icon_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/icon_download.png -------------------------------------------------------------------------------- /KnobScripter/icons/icon_exitnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/icon_exitnode.png -------------------------------------------------------------------------------- /KnobScripter/icons/icon_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/icon_refresh.png -------------------------------------------------------------------------------- /KnobScripter/icons/icon_snippets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/icon_snippets.png -------------------------------------------------------------------------------- /KnobScripter/icons/knob_scripter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/knob_scripter.png -------------------------------------------------------------------------------- /KnobScripter/icons/icon_clearConsole.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adrianpueyo/KnobScripter/HEAD/KnobScripter/icons/icon_clearConsole.png -------------------------------------------------------------------------------- /KnobScripter/info.py: -------------------------------------------------------------------------------- 1 | """ Version/author information """ 2 | __version__ = "3.1" 3 | __author__ = "Adrian Pueyo" 4 | __date__ = "Jan 15 2024" 5 | __mail__ = "pueyovfx@gmail.com" 6 | __web__ = "www.adrianpueyo.com" -------------------------------------------------------------------------------- /KnobScripter/script_output.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ ScriptOutputWidget: Output utput console. 3 | 4 | The Script Output Widget is a basic QTextEdit that works as the main output 5 | window of the KnobScripter's Script Editor. Simple module that can grow 6 | as needed in the future. 7 | 8 | adrianpueyo.com 9 | 10 | """ 11 | 12 | import nuke 13 | import math 14 | from KnobScripter import config 15 | 16 | try: 17 | if nuke.NUKE_VERSION_MAJOR < 11: 18 | from PySide import QtCore, QtGui, QtGui as QtWidgets 19 | from PySide.QtCore import Qt 20 | else: 21 | from PySide2 import QtWidgets, QtGui, QtCore 22 | from PySide2.QtCore import Qt 23 | except ImportError: 24 | from Qt import QtCore, QtGui, QtWidgets 25 | 26 | 27 | class ScriptOutputWidget(QtWidgets.QTextEdit): 28 | """ 29 | Script Output Widget 30 | The output logger works the same way as Nuke's python script editor output window 31 | """ 32 | 33 | def __init__(self, parent=None): 34 | super(ScriptOutputWidget, self).__init__(parent) 35 | self.knobScripter = parent 36 | self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) 37 | self.setMinimumHeight(20) 38 | #self.font = QtGui.QFont() 39 | #self.setFont(self.font) 40 | self.setFont(config.script_editor_font) 41 | 42 | 43 | def keyPressEvent(self, event): 44 | # ctrl = ((event.modifiers() and Qt.ControlModifier) != 0) 45 | ctrl = bool(event.modifiers() & Qt.ControlModifier) 46 | # alt = ((event.modifiers() and Qt.AltModifier) != 0) 47 | # shift = ((event.modifiers() and Qt.ShiftModifier) != 0) 48 | key = event.key() 49 | if type(event) == QtGui.QKeyEvent: 50 | #print(event.key()) 51 | # If ctrl + +, increase font size 52 | if ctrl and key == Qt.Key_Plus: 53 | self.zoomIn() 54 | # If ctrl + -, decrease font size 55 | elif ctrl and key == Qt.Key_Minus: 56 | self.zoomOut() 57 | elif key in [32]: # Space 58 | return self.knobScripter.keyPressEvent(event) 59 | elif key in [Qt.Key_Backspace, Qt.Key_Delete]: 60 | self.knobScripter.clearConsole() 61 | return QtWidgets.QTextEdit.keyPressEvent(self, event) 62 | -------------------------------------------------------------------------------- /KnobScripter/config.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | KS_DIR = os.path.dirname(__file__) 4 | ICONS_DIR = os.path.join(KS_DIR, "icons") 5 | CODE_GALLERY_DEFAULT_FILE = os.path.join(KS_DIR, "code_gallery_dict.json") 6 | KS_ICON_PATH = os.path.join(ICONS_DIR, "knob_scripter.png") 7 | 8 | prefs = { 9 | "ks_directory" : "KS3", 10 | "ks_py_scripts_directory": "Scripts", 11 | "ks_blink_directory": "Scripts", 12 | "ks_snippets_file": "snippets.txt", 13 | "ks_codegallery_file": "code_gallery_dict.json", 14 | "ks_prefs_file": "prefs.txt", 15 | "ks_py_state_file": "py_state.txt", 16 | "ks_knob_state_file": "knob_state.txt", 17 | "ks_default_size": [800,500], 18 | "ks_run_in_context": True, 19 | "ks_show_knob_labels": True, 20 | "ks_blink_autosave_on_compile": False, 21 | "ks_save_knob_state": 1, 22 | "ks_save_py_state": 2, 23 | "code_style_python": "monokai", 24 | "code_style_blink": "default", 25 | "se_style": "default", 26 | "se_font_family": "Monospace", 27 | "se_font_size": 10, 28 | "se_tab_spaces": 4, 29 | "qt_btn_size": 24, 30 | "qt_icon_size": 17, 31 | } 32 | 33 | script_editor_styles = { 34 | "default": { 35 | "stylesheet": 'background:#282828;color:#EEE;', 36 | "selected_line_color": (62, 62, 62, 255), 37 | "lineNumberAreaColor": (36, 36, 36), 38 | "lineNumberColor": (110, 110, 110), 39 | "currentLineNumberColor": (255, 170, 0), # TODO: add scrollbar color 40 | }, 41 | "blink_default": { 42 | "stylesheet": 'background:#505050;color:#DEDEDE;', 43 | "selected_line_color": (110, 110, 110, 255), 44 | "lineNumberAreaColor": (72, 72, 72), 45 | "lineNumberColor": (34, 34, 34), 46 | "currentLineNumberColor": (255, 255, 255), 47 | } 48 | } 49 | 50 | code_gallery_files = [CODE_GALLERY_DEFAULT_FILE,] # json files. TODO Make the extension of this list available as a function right after importing KS3 51 | 52 | # Initialized at runtime 53 | all_knobscripters = [] 54 | ks_multipanel = "" 55 | py_scripts_dir = None 56 | blink_dir = None 57 | snippets_txt_path = None 58 | codegallery_user_txt_path = None 59 | prefs_txt_path = None 60 | 61 | py_state_txt_path = None 62 | knob_state_txt_path = None 63 | py_state_dict = {} # In case of storing in memory 64 | knob_state_dict = {} # In case of storing in memory 65 | 66 | script_editor_font = None 67 | 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KnobScripter 2 | **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. 3 | 4 | **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. 5 | 6 | - **Video Tutorial**: You can watch a [full video tutorial of the tool here](https://adrianpueyo.com/ks3-video). 7 | - **Docs**: A complete user guide can be found at https://adrianpueyo.com/ks3-docs 8 | 9 | ![KS3_overview-768x374](https://user-images.githubusercontent.com/24983260/165090431-b179f3a0-8e22-4e92-b544-5d6f10e677fc.png) 10 |
11 | 12 | ## Features 13 | - **Full scripting mode for .py files.** 14 | You can create, browse, modify or toggle between python files and folders. 15 | - **Node editing mode**, to script directly on python buttons or callback knobs, as well as BlinkScript. 16 | - **Python output console:** Same as the one from Nuke’s default script editor, where you can execute any code. 17 | - **Find-Replace.** A proper find-replace widget as you’d expect in a python editor. 18 | - **Snippets!** They are short codes you can assign to longer pieces of codes, so that by writing the short code and pressing tab you’ll get the long code. 19 | - **Code Gallery.** 20 | 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. 21 | - Python syntax highlighting, line numbers, auto-intending, auto-completer. 22 | - Syntax helpers, multi-line commenting, moving/duplicating lines, and more! 23 |
24 | 25 | ## Installation 26 | 27 | ### A. Fresh install 28 | 1. Copy the `KnobScripter` folder and paste it somewhere in your Nuke plugin path. For example, inside `Users/YourUser/.nuke` directory. 29 | 2. Open with a text editor the file `menu.py` that lives next to your `KnobScripter` folder, or create one if it doesn’t exist. 30 | 3. Add the following line: 31 | ```python 32 | import KnobScripter 33 | ``` 34 | 4. Restart Nuke. 35 | 36 | ### B. Updating KnobScripter 37 | 1. Replace the `KnobScripter` folder with the updated one. 38 | 2. Restart Nuke. 39 |
40 | 41 | ## Usage 42 | In Nuke, you can open the **KnobScripter** both as a floating window or as a dockable pane. 43 | - To open the KnobScripter as a **floating window**, simply press `Alt+Z` on the Node 44 | Graph. 45 | - In order to bring the **dockable pane** you need to do the following: 46 | Right click on the pane selection bar, and go to: 47 | `Windows -> Custom -> KnobScripter`. 48 | Then, a KnobScripter pane will get created. Now you can even save the workspace, so the KnobScripter will be created by default when you open nuke. 49 |
50 | 51 | ## Contributing 52 | Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. 53 | 54 | Please make sure to update tests as appropriate. 55 | 56 | Thanks to the awesome Nuke community! Hope you enjoy this. 57 | -------------------------------------------------------------------------------- /KnobScripter/letItSnow.py: -------------------------------------------------------------------------------- 1 | """ 2 | file: letItSnow.py 3 | info: A PySide2 widget that allows you to add snow to any other widget 4 | """ 5 | import sys 6 | from random import randint 7 | from PySide2 import QtWidgets, QtCore, QtGui 8 | 9 | 10 | class Snowflake(QtWidgets.QGraphicsItem): 11 | def __init__(self, diameter=5, startX=0.0): 12 | # type: (int, float) -> None 13 | super(Snowflake, self).__init__() 14 | self.loops = 0 15 | self.diameter = diameter 16 | self._startX = startX 17 | self._startY = -self.diameter * float(randint(1, 20)) 18 | self.speed = float(randint(10, 50)) / 50.0 19 | self.drift = float(randint(-5, 5)) / 5.0 20 | 21 | @property 22 | def startX(self): 23 | return self._startX * self.scene().width() 24 | 25 | @property 26 | def startY(self): 27 | return self._startY 28 | 29 | @property 30 | def startPos(self): 31 | return QtCore.QPointF(self.startX, self.startY) 32 | 33 | def boundingRect(self): 34 | penWidth = 1.0 35 | return QtCore.QRectF(-10 - penWidth / 2, -10 - penWidth / 2, 20 + penWidth, 20 + penWidth) 36 | 37 | def paint(self, painter, option, *args, **kwargs): 38 | snowColor = QtGui.QColor(200, 200, 200, 255) 39 | center = QtCore.QPointF(self.pos().x() + self.diameter / 2.0, self.pos().y() + self.diameter / 2.0) 40 | gradient = QtGui.QRadialGradient() 41 | gradient.setCenter(center) 42 | gradient.setCenterRadius(self.diameter / 2) 43 | gradient.setFocalPoint(center) 44 | # gradient.setFocalRadius(self.diameter / 10) 45 | gradient.setColorAt(0, snowColor) 46 | gradient.setColorAt(1, QtGui.QColor(0, 0, 0, 0)) 47 | snowBrush = QtGui.QBrush(gradient) 48 | painter.setBrush(snowBrush) 49 | painter.setPen(QtCore.Qt.NoPen) 50 | painter.drawEllipse(self.pos().x(), self.pos().y(), self.diameter, self.diameter) 51 | 52 | def advance(self, phase): 53 | # type: (int) -> None 54 | if not phase == 1: 55 | return 56 | xPos = self.pos().x() 57 | yPos = self.pos().y() 58 | if self.loops == 0: 59 | xPos = self.startX 60 | yPos = self.startY 61 | self.loops += 1 62 | pos = QtCore.QPointF(xPos, yPos) 63 | pos.setX(pos.x() + self.drift * self.speed) 64 | pos.setY(pos.y() + 1 * self.speed) 65 | # Move to top if outside of scene bounds 66 | # NOTE: mapToScene(pos) != scenePos() 67 | scenePos = self.mapToScene(self.pos()).y() 68 | if scenePos >= self.scene().height(): 69 | pos = self.startPos 70 | self.loops += 1 71 | self.setPos(pos) 72 | 73 | 74 | class LetItSnow(QtWidgets.QWidget): 75 | def __init__(self, snowFlakeCount=100, parent=None): 76 | # type: (int, QtWidgets.QWidget) -> None 77 | super(LetItSnow, self).__init__(parent=parent) 78 | # ATTRIBUTES 79 | # -------------------- 80 | self.snowFlakeCount = snowFlakeCount 81 | self.spawnRate = 1 # How many snowFlakes are emitted per frame 82 | # UI 83 | # -------------------- 84 | self.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents) 85 | self._graphicsScene = QtWidgets.QGraphicsScene() 86 | self._graphicsScene.setItemIndexMethod(QtWidgets.QGraphicsScene.NoIndex) 87 | self._graphicsView = QtWidgets.QGraphicsView(self._graphicsScene) 88 | self._graphicsView.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) 89 | self._graphicsView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) 90 | self._graphicsView.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) 91 | bgColor = QtGui.QColor(0, 0, 0, 0) 92 | bgBrush = QtGui.QBrush(bgColor) 93 | self._graphicsScene.setBackgroundBrush(bgBrush) 94 | self._graphicsView.setStyleSheet("border: 0px") 95 | self.setStyleSheet('''QWidget{background: transparent;}''') 96 | # Assemble 97 | layout = QtWidgets.QVBoxLayout(self) 98 | layout.setContentsMargins(0, 0, 0, 0) 99 | layout.setSpacing(0) 100 | layout.addWidget(self._graphicsView) 101 | # EVENTS 102 | # -------------------- 103 | self.timeline = QtCore.QTimeLine() 104 | self.timeline.setFrameRange(0, 100) 105 | self.timeline.setLoopCount(0) 106 | self.timeline.setEasingCurve(QtCore.QEasingCurve.Linear) 107 | self.timeline.valueChanged.connect(self._update) 108 | 109 | def showEvent(self, event): 110 | if self.timeline.state() is not QtCore.QTimeLine.State.Running: 111 | self.timeline.start() 112 | self._fitScene() 113 | 114 | def hideEvent(self, event): 115 | self.timeline.stop() 116 | 117 | def resizeEvent(self, event): 118 | self._fitScene() 119 | 120 | def paintEvent(self, event): 121 | parent = self.parent() 122 | if parent: 123 | parentSize = parent.size() 124 | if self.size() != parentSize: 125 | self.resize(parentSize) 126 | 127 | def _fitScene(self): 128 | self._graphicsScene.setSceneRect(self.rect()) 129 | self._graphicsView.setResizeAnchor(QtWidgets.QGraphicsView.AnchorViewCenter) 130 | 131 | def _update(self): 132 | snowFlakes = self._graphicsScene.items(self._graphicsScene.sceneRect()) 133 | if len(snowFlakes) < self.snowFlakeCount: 134 | diameter = randint(3, 10) 135 | startX = float(randint(0, int(self.width()))) / self.width() 136 | snowFlake = Snowflake(diameter=diameter, startX=startX) 137 | self._graphicsScene.addItem(snowFlake) 138 | self._graphicsScene.update() 139 | self._graphicsScene.advance() 140 | 141 | 142 | if __name__ == "__main__": 143 | app = QtWidgets.QApplication() 144 | widget = LetItSnow() 145 | widget.show() 146 | sys.exit(app.exec_()) 147 | -------------------------------------------------------------------------------- /KnobScripter/keywordhotbox.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ KeywordHotbox: KnobScripter's floating panel for word suggestions while scripting. 3 | 4 | adrianpueyo.com 5 | 6 | """ 7 | import nuke 8 | from functools import partial 9 | 10 | try: 11 | if nuke.NUKE_VERSION_MAJOR < 11: 12 | from PySide import QtCore, QtGui, QtGui as QtWidgets 13 | from PySide.QtCore import Qt 14 | else: 15 | from PySide2 import QtWidgets, QtGui, QtCore 16 | from PySide2.QtCore import Qt 17 | except ImportError: 18 | from Qt import QtCore, QtGui, QtWidgets 19 | 20 | 21 | class KeywordHotbox(QtWidgets.QDialog): 22 | """ 23 | Floating panel with word suggestions 24 | Based on the given keywords dictionary of lists. Example: 25 | keyword_dict = { 26 | "Access method": { 27 | "keywords": ["eAccessPoint","eAccessRanged1D"], 28 | "help": "Full help!