The easiest setup is to import ../tox/TDCliServer.tox into your TouchDesigner project.
- Open your TouchDesigner project
- Import
tox/TDCliServer.toxinto the root network, or drag the file into the project - Make sure the imported component is named
TDCliServer - Open the component and verify:
webserver1is activewebserver1uses port9500
- Run
td-cli statusin a terminal
If everything is set up correctly, you should see your project info.
The .tox already includes the required network:
/project1/TDCliServer/
├── webserver1 (Web Server DAT, port 9500)
├── callbacks (Text DAT, web server callbacks)
├── handler (Text DAT, request handler)
├── timer1 (Timer CHOP, 1 second loop)
└── chopexec1 (CHOP Execute DAT, heartbeat writer)
If you want to build the component yourself instead of importing the .tox, create a Base COMP named TDCliServer at /project1/TDCliServer and add the following:
- Create Web Server DAT
webserver1 - Set
portto9500 - Set
activetoOn
- Create Text DAT
callbacks - Copy the contents of
webserver_callbacks.pyinto this DAT - On
webserver1, setCallbacks DATtocallbacks
- Create Text DAT
handler - Copy the contents of
td_cli_handler.pyinto this DAT
- Create Timer CHOP
timer1 - Set
Lengthto1second - Set
On DonetoRe-Start - Set
PlaytoOn - Create CHOP Execute DAT
chopexec1 - Set the CHOP parameter to
timer1 - Enable the
Off to Oncallback - Copy the
onTimerPulselogic fromheartbeat.pyinto theonOffToOncallback
- Open a terminal and run
td-cli status - You should see your project info