https://github.com/acdvs/td-obswebsocket
A packaged TouchDesigner component that connects to an OBS WebSocket server to send requests and receive events.
https://github.com/acdvs/td-obswebsocket
obs python touchdesigner websocket
Last synced: about 1 month ago
JSON representation
A packaged TouchDesigner component that connects to an OBS WebSocket server to send requests and receive events.
- Host: GitHub
- URL: https://github.com/acdvs/td-obswebsocket
- Owner: acdvs
- Created: 2023-08-09T09:26:47.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-04T23:07:11.000Z (over 1 year ago)
- Last Synced: 2024-05-02T04:22:01.270Z (about 1 year ago)
- Topics: obs, python, touchdesigner, websocket
- Language: Python
- Homepage:
- Size: 148 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TD-OBSWebSocket
A packaged TouchDesigner component that connects to an [obs-websocket][5] server and receives all available events.
## Basic Usage
1. Download the .tox file from the [Releases][4] page and place it in a location convenient for your project.
2. Drag and drop it into your project.
3. Set the Address and Port of the server in the Connection parameters tab. Set the Password if there is one.
4. If Auto-Reconnect is enabled, the component will connect to the server automatically.
If Auto-Reconnect is disabled, enable the Active switch to connect to the server.Once connected, any event data received will be set in the corresponding parameter. This makes the data easy to consume by, for example, connecting a Parameter Execute DAT to the OBSWebSocket component.
## Features
### High-Volume Events
Several events are considered "high-volume" and must be individually opted into to receive them. You can do this in the Connection parameters tab. These events are:
- Input Volume Meters
- Input Active State Changed
- Input Show State Changed
- Scene Item Transform ChangedIt's possible to enable or disable high-volume events while connected to the server, though doing so will force a reconnect.
### Sending Requests
Two methods on the OBSWebSocket component can be used to send requests to OBS.
`SendRequest(requestType, requestId, requestData)`
Sends a single request| Parameter | Data type | Default value | Description | Optional |
| -- | -- | -- | -- | -- |
| `requestType` | [RequestType][2] | | The type of the request | |
| `requestId` | string | \ | A custom ID used to track the request | :white_check_mark: |
| `requestData` | dict | None | Any input the request requires | :white_check_mark: |`SendRequestBatch(data, executionType, haltOnFailure)`
Sends one or more requests together| Parameter | Data type | Default value | Description | Optional |
| -- | -- | -- | -- | -- |
| `data` | list[dict[str, Any]] | | A list of payloads taking the form of `SendRequest`'s parameters | |
| `executionType` | [RequestBatchExecutionType][3] | SERIAL_REALTIME | The request execution type | :white_check_mark: |
| `haltOnFailure` | bool | False | Stops the batch if one request fails | :white_check_mark: |The `RequestType` and `RequestBatchExecutionType` enums are promoted by the extension and can be easily accessed on the component with `op.OBSWebSocket.[EnumName]`. See the [source](scripts/OBSEnums.py) for all enums and values.
Each request type's input for `requestData` can be found in the [obs-websocket documentation][1].
For batch requests, it's recommended to provide a custom `requestId` with each request. This will help you identify responses in the results table (found at OBSWebSocket/out1) where each one is logged until the next request is sent.
## Contributing
If you are considering adding a new feature or change to the project, first create a feature request issue to document it and get feedback before proceeding. If you are considering fixing a bug, first open a bug report issue or search for an existing one.
[1]: https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#general-requests
[2]: scripts/OBSEnums.py#L96
[3]: scripts/OBSEnums.py#L32
[4]: https://github.com/acdvs/TD-OBSWebSocket/releases
[5]: https://github.com/obsproject/obs-websocket