NukeServerSocket v1.1


 
This location is for Registered Users Only.
Perhaps you need to login or register.
Contributor: Virgil Sisoe
A Nuke plugin that will allow code execution from the local network and more.
Requirements:
13.1, 12.2, 11.3 or later
Linux, Mac, Windows
23 Sep 2021
30

Changelog

v0.1.0 2021-09-23

  • Execute BlinkScript code.
  • Send/Receive Nodes from another instance.
  • New About widget.
  • API now accepts also simple strings when sending a request.
  • Under the hood optimizations.

1. NukeServerSocket README

A Nuke plugin that will allow code execution from the local network and more.

This is primarily a companion plugin for Nuke Tools.

1.1. Tools

Tools that are using NukeServerSocket:

1.2. Features

  • Send Python or BlinkScript code to be executed inside Nuke from your local network.
  • Multiple computers can connect to the same Nuke instance.
  • Receive/Send nodes from another Nuke instance in your local network.
  • Not bound to any application. (more on Extendibility)

1.3. Installation

Save the plugin in your .nuke directory or in a custom directory and then import NukeServerSocket in your menu.py.
Remember: If you use a custom plugin path, add the path in your init.py: nuke.pluginAddPath('custom/path').

N.B. if your downloaded zip folder has a different name (NukeServerSocket-master, NukeServerSocket-0.0.2 etc._), then you need to rename it to just NukeServerSocket.

1.4. Usage

1.4.1. Receive incoming request

Open the NukeServerSocket panel and with the mode on Receiver, start the server by clicking Connect.

If you receive a message: 'Server did not initiate. Error: The bound address is already in use', just change the Port to a random number between 49152 and 65535 and try again. It means that probably you have a connection listening on that port already. Also when connected, you could test the receiver with the Test Receiver button, otherwise you are done.

When connected, NukeServerSocket will listen for incoming request on the IP Address and Port shown in the plugin.

Now you can send code from Visual Studio Code with Nuke Tools or any other method you prefer.

1.4.2. Receive/Send nodes

1.4.2.1. Send

When sending nodes, switch the mode from Receiver to Sender and be sure that there is another NukeServerSocket instance listening for incoming network request (Receive incoming request). Select the nodes you want to send a click Send Selected Nodes.

By default, the IP Address on the sender points to the local IP address, so if you want to send nodes between the same computer you should only specify the Port. When sending nodes to another computer you will also need to specify the IP Address of the NukeServerSocket computer you want the nodes to be sended.

1.4.2.2. Receive

When receiving nodes just follow the steps for Receive incoming request for the receiving instance and the Send steps for the sending instances.

1.5. Settings

The plugin offers some minor settings like output text to internal script editor, format text and so on.

1.6. Extendibility

At its core, the plugin is just a server socket that awaits for an incoming request, performs the operations inside Nuke and returns the result. Nothing ties it to any application per se.

The only requirement is that the code received should be inside a string.

From the client point of view, the code can be sended either inside a stringified associative array or inside a simple string, with the latter being valid only when sending Python code.

The associative array should have the following keys: text and an optional file.

  • text: Must contain the code to be executed as a string.
  • file: Could contain the file path of the script that is being executed.

Although the associative array is optional when executing Python code, it is a requirement when executing BlinkScript. The key file must contain a valid file extension: .cpp or .blink in order for the plugin to know where to delegate the job.

When sending a stringified array, the plugin will try to deserialize it with json.loads().

1.6.1. Code Sample

Please see Github Readme #Code Samples section for more information.

1.6.2. Port & Host address

NukeServerSocket by default will listen on any host address.

When connecting locally (same computer) you can just specify the local host address (eg.127.0.0.1) in your socket client code. When connecting from a different computer you also specify the exact IP Address (eg 192.168.1.10).

The port value is written to .nuke/NukeServerSocket.ini inside the server/port field. Each time the user changes it, it gets update automatically. If used locally, this can be used from your extension to pick at which port to connect.

This is pretty much all you need to start your own extension for your favorite text editor or any other method you prefer.

If you still have some problems, please feel free to reach out for any questions.

1.7. Known Issues

  • Settings window doesn't display the tooltip text.
  • When changing workspace with an active open connection, Nuke will load a new plugin instance with the default UI state. This would look as if the previous connection has been closed, where in reality is still open and listening. The only way to force close all of the connections is to restart Nuke.

1.8. Compatibility

Nuke version: 11,12, 13.

Because Nuke 11 uses an early version of PySide2, future compatibility is not a guarantee.

While it should work the same on all platforms, it has been currently only tested on:

  • Linux:
    • CentOS 8
  • MacOS:
    • Mojave 10.14.06
    • Catalina 10.15.06
  • Windows 10

1.9. Test plugin locally

This works only on Linux and Mac. Probably Windows WSL but haven't tested it yet.

While limited in some regards, the plugin can be tested outside Nuke environment.

  1. Clone the github repo into your machine.
  2. pipenv install --ignore-pipfile for normal installation or pipenv install --ignore-pipfile --dev -e . if you want to test the code with pytest (No tests are provided at the time of writing).
  3. Launch the app via terminal python -m tests.run_app or vscode task: RunApp

The local plugin offers a simple emulation of the Nuke's internal Script Editor layout. It just basic enough to test some simple code.

When the application starts it will:

  1. Click the connect button
  2. Send a test message
  3. Display the received message or error if any.
  4. Override input/output widgets if settings allowed it.

It is a very basic and simple test but because the PySide2 and Python version are pretty much identical to Nuke's one will likely function the same way inside Nuke.

1.10. Overview

MIT License Copyright (c) 2021 Virgil Sisoe Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please login in order to download these files.

Comments   

 
# mani di 2021-08-01 09:45
Amazing stuff! Thank you!

note: you have a misspell a bit github link (colon missing)
 

You have no rights to post comments

We have 2364 guests and 36 members online