Home

Awesome

TVPaint RPC server plugin

This TVPaint plugin runs a WebSocket server which listens for JSON-RPC messages mainly for executing George commands and getting the result.

It's used as a communication layer for Pytvpaint which is the Python library that wraps George commands.

Setup

To install the build dependencies, we use Conan which is a C/C++ package manager.

To install it, use the virtualenv provided by Poetry:

$ poetry install --no-root # Installs Conan
$ poetry shell # Enter a new venv shell

Then configure your Conan compilation profile:

(venv) $ conan profile detect

To compile the project with MSVC, an example configuration would be:

# C:\Users\$USER\.conan2\profiles\default

[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=17
compiler.runtime=static
compiler.version=193
os=Windows

To check if your profile is correct, use:

(venv) $ conan profile show

Install dependencies

Install the dependencies specified in conanfile.txt:

(venv) $ conan install . --output-folder=build --build=missing

The above command generates CMake build files that helps finding those libraries.

Build

You first need to download the TVPaint C/C++ SDK in a local folder.

Configure the project with CMake and Conan by going into the build folder:

$ cd build
$ cmake .. -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DTVPAINT_SDK_FOLDER="/path/to/TVPaint_SDK"

(the above command assumes you are using Visual Studio 17, if not match that with your Conan profile)

Build the project in release mode:

$ cmake --build . --config Release

Install

You can find the generated .dll file under ./build/Release/tvpaint-ws-server.dll after compilation.

To install it, copy the DLL into your plugins folder (depending on your TVPaint version):

Usage

The WebSocket server is launched at TVPaint's startup.

By default it listens on the port 3000 but you can set the TVP_RPC_WS_PORT environment variable to set another port.

The protocol used is JSON RPC. It allows us to send a request that contains a method and some params to execute.

For example:

--> {"jsonrpc": "2.0", "method": "execute_george", "params": ["tv_version"], "id": 0}
<-- {'id': 0, 'jsonrpc': '2.0', 'result': '"TVP Animation 11 Pro" 11.5.3 fr'}

--> {"jsonrpc": "2.0", "method": "unknown_method", "params": [], "id": 0}
<-- {'error': {'code': -32601, 'message': 'Method not found'}, 'id': 0, 'jsonrpc': '2.0'}

You can use the TVP_RPC_LOG_PATH environment variable to set the log file directory (named .tvpaint-rpc.log). By default they are not logged to a file.

Limitations

Libraries

Ressources

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

<hr>

Made with ❤️ at BRUNCH Studio 🥐🍳