NukeServerSocket v1.6
This location is for Registered Users Only.
Perhaps you need to login or register.
14.0, 13.2, 13.1, 12.2, 11.3 or later
Linux, Mac, Windows


1. NukeServerSocket README
Changelog
v0.6.0 2023-03-12
- Fixed Nuke 14 compatibility issues by removing WebSocket connection.
- Switchable log panels.
- Under the hood refactoring.
A Nuke plugin to run code from external applications.
1.1. Features
- Receive Python or BlinkScript code from any client in your local network. (More on Extendibility)
- Connect more than one client to the same Nuke instance.
- Receive/Send nodes from another Nuke instance in your local network.
- WebSocket-ready for browser-based text editors.
Note: WebSocket connection does not work in Nuke 14.
1.2. Client applications
Client applications that use NukeServerSocket:
- Nuke Tools - Visual Studio Code extension.
- Nuke Tools ST - Sublime Text package.
- DCC WebSocket - Visual Studio Code Web extension.
1.3. Installation
- Download the repository via the releases page or by cloning it from GitHub.
- Place the folder inside the ~/.nuke directory or into a custom one.
- Write
import NukeServerSocket
into your menu.py.
NOTES
- If you use a custom plugin path, add the path in your init.py:
nuke.pluginAddPath('custom/path')
- The folder name must be named NukeServerSocket.
- If you use Nuke Tools, use the command
Nuke Tools: Add NukeServerSocket
.
1.4. Usage
1.4.1. Execute code
- Open the NukeServerSocket panel inside Nuke, and with the mode on Receiver, start the server by clicking Connect.
- You can now send code from Visual Studio Code with Nuke Tools or any other method you prefer.
NOTES:
- You can troubleshoot the connection by using the Test Receiver button.
- If you receive a message: 'Server did not initiate. Error: The bound address is already in use', change the port to a random number between
49152
and65535
and try again. It probably means that you have a connection listening on that port already.
1.4.2. Receive/Send nodes
-
Receive nodes
When receiving nodes, start the server with the mode on Receiver.
-
Sending nodes
- Switch the mode from Receiver to Sender and be sure that there is another NukeServerSocket instance listening for incoming network requests.
- Select the nodes you wish to send a click Send Selected Nodes.
NOTES:
- When sending nodes to the same computer, only the Port value must match the two Nuke instances.
- When sending nodes between different computers, both IP Address and Port must match the two Nuke instances.
1.5. Settings
You access the settings from the plugin toolbar.
-
Code Execution Engine: Change the engine that will executing the code.
- Nuke Internal: Nuke
executeInMainThread
function. [Default] - Script Editor: Nuke Script Editor widget.
Why use one over the other?
- Nuke Internal is a more direct and fast approach, but it uses
exec
under the hood, which might cause some issues. - Nuke Script Editor its a safer approach overall but it does require slightly more work behind scene.
- Nuke Internal: Nuke
-
Connection Type: Change the internal connection protocol for the client-server (Not present in Nuke 14, which defaults to TCP).
- TCP: The default type of connection. If unsure, use this. [Default]
- WebSocket: This allows a two-way interactive communication session between the user's browser and the internal server. Use this when using a browser-based text editor.
-
Mirror To Script Editor: Allows mirroring the input/output code to the internal script editor.
- Override Output Editor: Mirror output to the internal script editor.
- Format Text: The script editor output window will receive a formatted version of the code result.
- Clear Output: The script editor output window will clear the code after each execution.
- Show File Path: The script editor output window will display the full path for the executed file.
- Show Unicode: The script editor output window will display a Unicode character `` that indicates the start of the code execution result.
- Override Input Editor: Mirror input to the internal script editor.
-
Timeout: Terminate the connection when the Server is inactive or did not establish a successful contact in the time specified.
- Server: Set the Timeout when clicking the Connect button. The default value is
10
minutes. - Receiver: Set the Timeout for when clicking the Test Receiver button. The default value is
10
seconds. - Send Nodes: Set the Timeout when clicking Send Nodes button. The default value is
30
seconds.
- Server: Set the Timeout when clicking the Connect button. The default value is
1.6. Extendibility
At its core, the plugin is just a server socket that waits for an incoming request, performs the operations inside Nuke, and returns the result. Nothing ties it to any application per se.
This makes it very easy to implement a new client, without the need to modify the NukeServerSocket source code. The client needs only to send the data at the specified address inside NukeServerSocket.
You can find more information and examples on the wiki page.
1.7. Test plugin locally
You can run the plugin locally outside the Nuke application. This method is handy for testing code and implementing new features faster.
You can find more information and examples on the wiki page.
1.8. Known Issues
- Nuke 14 does not ship with QWebSocket module so the WebSocket connection is not enabled.
- Creating a modal window with the Nuke internal code execution engine will cause Nuke to freeze. A workaround is to switch to the Script Editor engine.
- Settings window doesn't display the tooltip text.
- Changing workspace with an active open connection makes Nuke load a new plugin instance with the default UI state. So it would look as if the previous connection has been closed, whereas in reality is still open and listening. To force close all of the listening connections, you can:
- Restart the Nuke instance.
- Wait for the connection timeout.
1.9. Compatibility
Nuke version: 11,12, 13, 14
Because Nuke 11 uses an early version of PySide2, future compatibility is not a guarantee.
While it should work the same on all platforms, I have tested the plugin only on:
- Linux:
- CentOS 8
- macOS:
- Mojave 10.14.06
- Catalina 10.15.07
- Monterey 12.6.3
- Windows 10
Comments
note: you have a misspell a bit github link (colon missing)
Traceback (most recent call last):
File "C:/Users/[Hidd en]/.nuke/menu. py", line 2, in
import NukeServerSocke t
File "C:\Program Files\Nuke14.0v 1\pythonextensi ons\site-packag es\shiboken2\fi les.dir\shiboke nsupport\__feat ure__.py", line 142, in _import
return original_import (name, *args, **kwargs)
File "C:\Users/[Hidden]/.nuke\NukeServerSocke t\__init__.py", line 2, in
from . import src
File "C:\Program Files\Nuke14.0v 1\pythonextensi ons\site-packag es\shiboken2\fi les.dir\shiboke nsupport\__feat ure__.py", line 142, in _import
return original_import (name, *args, **kwargs)
File "C:\Users/[Hidden]/.nuke\NukeServerSocke t\src\__init__.py", line 15, in
from . import main
File "C:\Program Files\Nuke14.0v 1\pythonextensi ons\site-packag es\shiboken2\fi les.dir\shiboke nsupport\__feat ure__.py", line 142, in _import
return original_import (name, *args, **kwargs)
File "C:\Users/[Hidden]/.nuke\NukeServerSocke t\src\main.py", line 16, in
from .connection import QServer, SendTestClient, SendNodesClient
File "C:\Program Files\Nuke14.0v 1\pythonextensi ons\site-packag es\shiboken2\fi les.dir\shiboke nsupport\__feat ure__.py", line 142, in _import
return original_import (name, *args, **kwargs)
File "C:\Users/[Hidden]/.nuke\NukeServerSocke t\src\connection\__init__.py", line 3, in
from .nss_server import QServer
File "C:\Program Files\Nuke14.0v 1\pythonextensi ons\site-packag es\shiboken2\fi les.dir\shiboke nsupport\__feat ure__.py", line 142, in _import
return original_import (name, *args, **kwargs)
File "C:\Users/[Hidden]/.nuke\NukeServerSocke t\src\connection\nss_server.py", line 8, in
from PySide2.QtWebSo ckets import QWebSocketServe r
File "C:\Program Files\Nuke14.0v 1\pythonextensi ons\site-packag es\shiboken2\fi les.dir\shiboke nsupport\__feat ure__.py", line 142, in _import
return original_import (name, *args, **kwargs)
ModuleNotFoundError: No module named 'PySide2.QtWebSo ckets'
Or is there a way to bypass this?
Thanks!
It looks like it's trying to load the QtWebSockets module, which for some reason, doesn't exist in Nuke 14's PySide.
If you don't need a websocket, which I am guessing you don't if you aren't interacting through a browser based text editor (you are using either VSCode or Sublime), you can simply turn all those parts off.
It looks like websockets is just used in 3 files : nss_client, nss_server, nss_socket
Just go in there and comment out or delete the import at the top of all three files since QtWebSockets doesn't exist to import.
from PySide2.QtWebSo ckets import QWebSocket
and then you have to make sure to deal with QWebSocket everywhere it's mentioned.
Twice it's returned so just return None instead
return QWebSocket()
and
return QWebSocketServe r('NukeServerSo cket', QWebSocketServer.NonSecureMode)
to
return None
and set the possibility of it trying to use a websocket to False
in nss_socket.py
self.is_websock et = isinstance(self .socket, QWebSocket)
to this
self.is_websock et = False
Save up your files and you should be back in business. That is as long as you aren't using web based editing.
Cheers!
Michael, thanks for taking out the time to help others. You are more than welcome to open a pull request next time you find a solution to a problem.
RSS feed for comments to this post