Debugging plugins using Visual Studio Code

As a workflow standard for many developers, the Visual Studio Code IDE is available to debug Python plugins for Substance Designer.

In order to set up the synergy between Visual Studio Code and Substance Designer, please follow these steps:

  • Install the ptvsd Python module;
    • Important: Make sure that the Python interpreter in Designer can find the 'ptvsd' module. The easiest way to do it is to add the directory where the 'ptvsd' module is to the PYTHONPATH environment variable.
  • Launch Substance Designer, open the Python Editor and run the following code:

Enable VSCode debugging
import ptvsd

  • In Visual Studio Code, open the file or directory that contains the source code of your plugin. Click on the Debug icon, create or edit your debugger configuration, if needed.
  • Select the Python: Remote Attach configuration and click on Start Debugging.

You are now able to set breakpoints, step trough the code, and use all the other features of Visual Studio Code's debugger.