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.
To install the build dependencies, we use Conan which is a C/C++ package manager.
To install it, use Hatch.
If you do not have Hatch, you can install it via Python pip :
❯ pip install hatchThen configure your Conan compilation profile:
$ hatch run conan profile detectTo 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- On MSVC, to check your
compiler.version, run the commandclin a Developer Command Prompt for VS and check theC/C++ Optimizing Compiler Versionfor example19.35.32215
To check if your profile is correct, use:
$ hatch run conan profile showInstall the dependencies specified in conanfile.txt:
$ hatch run conan install . --output-folder=build --build=missingThe above command generates CMake build files that helps to find those libraries.
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 ReleaseYou can find the generated .dll file under ./build/Release/tvpaint-rpc.dll after compilation.
To install it, copy the DLL into your plugins folder (depending on your TVPaint version):
- On Windows:
C:/Program Files/TVPaint Developpement/TVPaint Animation 11.5 Pro (64bits)/plugins
The WebSocket server is launched at TVPaint's startup.
By default, the server listens on the port 3000 but you can set the PYTVPAINT_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 PYTVPAINT_LOG_LEVEL environment variable to set the log file directory. By default, the server does not log to a file.
- This plugin is Windows only, the CMake configuration would need to be tested and updated
- Due to UTF-8 handling when receiving results from TVPaint's George commands, some characters outside UTF-16 range are not recognized (example: emoji characters in a layer name)
- TVPaint SDK (get it from customer support)
- JSON for Modern C++ (nlohmann/json)
- WebSocket++ (websocketpp)
- spdlog: Very fast, header-only/compiled, C++ logging library
- Build a simple CMake project with Conan.
- Ynput's OpenPype TVPaint plugin was a great inspiration
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.
Made with ❤️ at BRUNCH Studio