Textport

From Derivative
Jump to: navigation, search


Textport is the dialog box in which commands can entered manually. There are two scripting languages in TouchDesigner: Python and Tscript. For Tscript, all commands are described in Tscript Commands and Tscript Expressions, and its scripting syntax is found in Tscript.

Dialogs -> Textport brings up the main textport, but you can also put textports in panes by setting the Pane Type menu to Textport and DATs.

textport is a Tscript command that can be used to manipulate the contents of the dialog.


Textport Dialog[edit]

The textport can be opened from the Dialogs menu or by using the Alt+Shift+T keyboard shortcut. Textport can also be opened as a Pane.

The simplest method to input Python scripts is through the textport. The textport, like all scripting in TouchDesigner, allows scripts to be specified in either Python or Tscript.

After opening the textport, make sure it is set to Python language. This is controlled by the small toggle button in the upper left side of the textport.

When it is set to Py, all input is interpreted as Python. When set to T it is interpreted as tscript.

In addition the textport prompt and text color have different values for each language, making it easier to identify which state the textport is in:

TextportPython.png TextportTscript.png

Text DAT contents can be edited directly in the textport as well. Dragging a Text DAT onto the Textport will give you the following options:

  • Run DAT - paste the command to execute the DAT as a script into the Textport. This option is only available in the main Textport tab.
  • Open DAT - open the contents of the DAT in a new tab in the Textport. You can switch between tabs by clicking on the tab header near the top of the dialog box.
  • Paste Text - pastes in the DAT's path name just like other OPs.

Additionally, any selected text can be dragged onto the Textport from anywhere on the interface.

Shortcut: Textport History

A history or recent commands can be brought up by right-clicking anywhere in the textport. Pressing the "up" arrow key will step back through the command history. Pressing the down arrow key will step forward through command history.

Textport Search

The search field at the top of the textport can be used to find strings in the scrollable text of the textport.

Textport History

When working with DATs in the textport, a history of viewed DATs will be available on the right side of the Textport header.

Tips for Working in the Textport[edit]

  • Holding shift and clicking on textport text will select the text between the cursor and the mouse position instead of just moving the cursor.

Python in the Textport[edit]

In the textport, you can enter help for a list of available commands or help(object) for any python object.

Script errors and messages from print() commands are also output to this dialog box.

The main textport also receives the error messages and print() commands from all scripts that are run in DATs.

However startup and system errors are output to Dialogs -> Console.

You can save typing OP path names by simply dragging any OP onto the Textport. Just drag the OP onto the Textport using the left mouse button.


As a simple test type the following into the textport:

help(op)

This will output all help related to the op() method found in the td Module.

The td Module is the main module containing all TouchDesigner related classes and objects. It is imported by default when the application begins.
Another useful module is the tdu Module. This module contains some specific TouchDesigner utility functions useful during scripting.

TScript in the Textport[edit]

In the textport, you can enter help for a list of available commands or exhelp for a list of available expression functions. You can also access Tscript commands and expressions from the Help menu by selecting Commands and Expressions.

Script errors and messages from echo commands are also output to this dialog box.

The main textport also receives the error messages and echo commands from all scripts that are run in DATs.

However startup and system errors are output to Dialogs -> Console.

You can save typing OP path names by simply dragging any OP onto the Textport. Just drag the OP onto the Textport using the left mouse button.

Textport.jpg

textport Command (Tscript only)[edit]

The textport command is used to manipulate the Textport dialog. One of the advantages of using textport is the ability to load DATs without having to navigate to them through the Network pane. For example, to load a DAT in a floating Textport, the following code can be used:

 textport -l /datpath/datname

This can be particularly useful while debugging scripts or monitoring network performance.

A dialog box in which commands and scripts can entered manually. Script errors and python print() messages are also output to the textport.

TouchDesigner's original built-in Command scripting language prior to Python.

There are 8 pane types; Network, Panel, Textport, Geometry Viewer, TOP Viewer, CHOP Viewer, Parameters, Graph Editor for CHOP Channels, or a Geometry Spreadsheet.

Any floating window that is not a Pane or Viewer.

An Operator Family that manipulates text strings: multi-line text or tables. Multi-line text is often a command Script, but can be any multi-line text. Tables are rows and columns of cells, each containing a text string.

There are four types of shortcuts: Application Shortcuts that are built-in to TouchDesigner's authoring interface, Panel Shortcuts that you create for any custom built panels, Parent Shortcuts for accessing a component from within that component, and Global OP Shortcuts that access a unique component from anywhere in TouchDesigner.

A set of commands located in a Text DAT that are triggered to run under certain conditions. There are two scripting languages in TouchDesigner: Python and the original Tscript. Scripts and single-line commands can also be run in the Textport.