Look into the Latest DAT Viewer

The new experimental release of TouchDesigner now includes DAT syntax highlighting for the TouchDesigner languages python, GLSL, JSON, XML, all inside the DAT Viewer. In addition, there are also options for custom zooming. Now within the DAT viewer, it will be easier to debug and sort your code without using a third-party code editor.

How it works

In the DAT parameters’ Common page, under Language parameters, there are options for Input, Node, Plain Text, Python, Tscript, GLSL, JSON, XML. Currently in the Stable TouchDesigner build the Language parameter on a DAT only has the option of ‘Input’ or ‘Node’ with no syntax highlighting.

Experimental Built
Stable Built


The default Language for a Text DAT is Plain Text. Upon changing the Language parameter, you should see different syntax colors in the DAT Viewer.

When using a DAT that already has an assigned language, such as an Execute DAT or a GLSL Multi TOP, the DAT Language is automatically assigned for you so the highlighting automatically happens. This means that the Execute DAT will be set to Python and GLSL TOP to GLSL.

If you’re not sure what language the DAT is, you can use the auto-set DAT function to scan the contents and auto-detect the scripting language. This is a new feature in TouchDesigner so you’ve likely never seen it before. You can do this by selecting the DAT, going to the Edit menu on the top left corner, and selecting Auto Set Language. The color syntax will automatically be set to the correct language! One thing to note about this setting is that it’s project wide, so clicking the Auto Set Language button will actually scan your whole project all at once.

If you want to edit the DAT outside the Viewer window, you can still have syntax highlighting when you open a new viewer. You can open the viewer by right-clicking the DAT operator and selecting View… This can be helpful if you’re used to coding outside of the operator window and you’re working on a system that doesn’t have your normal code editor installed.

Color Syntax

The different colors of the syntax represent different elements of code. For the green syntax, it refers to comments and number values. The yellows syntax refers to functions. The purple syntax is for elements like conditional statements and control flow.  The red syntax represents string data and the grey syntax refers to variables and assigned operators. Here’s an example of the syntax highlighting compared to a code editor like Sublime Text:

Get Our 7 Core TouchDesigner Templates, FREE

We’re making our 7 core project file templates available – for free.

These templates shed light into the most useful and sometimes obtuse features of TouchDesigner.

They’re designed to be immediately applicable for the complete TouchDesigner beginner, while also providing inspiration for the advanced user.

Zooming

You now have the option for custom zooming in the RMB menu of the viewer. This is great for giving you flexibility when it comes to quickly coding within TouchDesigner. When you make the DAT Viewer active by clicking the + button in the bottom right corner, right-click inside the DAT, and under Zoom… there are options Auto, 50%, 75%, 100%, 125%,150%, 200%, 400%. Auto is the default that you’re used to, where the text size will change as you zoom in and out in your network. Setting any of the values locks the text size to that regardless of your zoom level in the network. The ability to zoom in and out of your DAT will allow you to view your code in different scales to your fitting especially as you’re working in busier networks and if you have trouble with small text.

Wrap up

If you don’t have a third-party code editor, such as Sublime Text, it can be difficult to differentiate between the variables and elements in your code. In this new experimental, now you can have the syntax highlighting function within TouchDesigner. It can be helpful when using a machine on a site that does not have access to a third-party code editor. Yet I personally still recommend using a third-party code editor when possible since many third-party code editors often include additional IDE (Integrated development environment) capabilities, such as code completion and plugins that the DAT Viewer currently does not. All in all the new DAT viewer update will make it handier to code on the fly within the TouchDesigner network! Enjoy!