API reference

TouchDesigner Python API

Native Python interface for controlling Lightpath from inside TouchDesigner.

Native Python interface for controlling Lightpath from inside TouchDesigner. The LightpathAPI.tox component (provided by Digital Ambiance) wraps the HTTP API and exposes everything two ways: as custom parameters you can wire in the editor, and as extension methods you can call from any DAT via op.LIGHTPATH_API.MethodName().

Setup

  1. Load LightpathAPI.tox into your .toe. The component self-installs the LIGHTPATH_API global op shortcut, so you can reach it from anywhere as op.LIGHTPATH_API.

  2. Configure the server. On the component's Server page, set:

    • Host — the Lightpath server hostname or IP. Leave as localhost if you're running on the same machine.
    • Port — defaults to 3001. Leave as-is unless your install overrides it.
  3. Log in. Lightpath's content routes are auth-gated, so the component needs to hold a valid token before it can do anything:

    • Enter your Username and Password on the Server page.
    • Pulse Login. On success, the Status page's Logged In field shows yes (expires …).
  4. Sync data. Pulse Sync Data to query the server for all looks, scenes, sequences, playlists, outputs, and actions, and populate the dropdown menus on every page. Now you can pick things by name from a dropdown instead of typing them.

    Sync Data auto-fires whenever Host or Port changes, so once you're configured you rarely need to pulse it manually.

That's it — you can now drive Lightpath either by pulsing the parameter buttons on the component, or by calling the extension methods from Python:

op.LIGHTPATH_API.ActivateLook("Sunset")
op.LIGHTPATH_API.FireAction("All Lights On")
op.LIGHTPATH_API.SetDimmer("Facade", 0.75)

Configuration

MethodDescription
SetServer(host="localhost", port=3001)Set the Lightpath server address
GetServer()Returns { "host": "...", "port": ... }
Login(username, password)Authenticate and store the returned JWT
Logout()Clear the stored token

Content activation

MethodDescription
ActivateLook(name)Activate a look on its configured output
ActivateSequence(name)Start a sequence on its assigned output
ActivateScene(name)Activate a scene across all of its outputs
ActivatePlaylist(name)Start a global playlist (scene rotation)
op.LIGHTPATH_API.ActivateLook("Sunset")
op.LIGHTPATH_API.ActivateScene("Evening")

Each look is bound to one output at design time, so ActivateLook doesn't take a target — the look already knows where it goes. Use scenes or playlists when you want one trigger to drive several outputs at once.

Playlist control

Per-output and global playlists share the same methods — pass output="Name" to control a specific output's sequence, omit it to control the global scene-rotation playlist.

MethodDescription
PausePlaylist(output=None)Pause a playlist
ResumePlaylist(output=None)Resume a playlist
StopPlaylist(output=None)Stop a playlist
SetTrack(index, output=None)Jump to a specific track (0-based)
ToggleLoop(output=None)Toggle loop mode
NextTrack(output)Advance to next track (per-output only)
PrevTrack(output)Go to previous track (per-output only)
# Per-output
op.LIGHTPATH_API.NextTrack("Output 1")
op.LIGHTPATH_API.SetTrack(2, output="Output 1")
op.LIGHTPATH_API.PausePlaylist(output="Output 1")
 
# Global
op.LIGHTPATH_API.PausePlaylist()
op.LIGHTPATH_API.SetTrack(2)

PauseSequence, ResumeSequence, StopSequence are kept as aliases for backward compatibility.

Actions

MethodDescription
FireAction(name, targetState=None)Execute an action. For toggles, pass targetState=True/False
SetActionState(name, state)Set a toggle action state (True/False or "on"/"off")
op.LIGHTPATH_API.FireAction("All Lights On")
op.LIGHTPATH_API.FireAction("Projector", targetState=True)
op.LIGHTPATH_API.SetActionState("Projector", True)

Output control

MethodDescription
SetDimmer(outputName, value)Set output brightness (0.0 – 1.0)
SetOutputEnabled(outputName, enabled)Power toggle
op.LIGHTPATH_API.SetDimmer("Output 1", 0.75)
op.LIGHTPATH_API.SetOutputEnabled("Output 1", False)

Global playback

MethodDescription
StopAll()Stop all playback across all outputs
GetPlaybackStatus()Get playback status for all playlists
status = op.LIGHTPATH_API.GetPlaybackStatus()
print(status)

State queries

MethodDescription
GetState()Get full current system state
GetLooks()Get all looks
GetSequences()Get all playlists (per-output)
GetScenes()Get all scenes
GetPlaylists()Get all global playlists
GetOutputs()Get all outputs
GetActions()Get all actions
looks = op.LIGHTPATH_API.GetLooks()
for look in looks.get("looks", []):
    print(look["name"])

On this page