Skip to main content
New Participant
March 27, 2022
Question

Creating custom nodes with scripting API?

  • March 27, 2022
  • 1 reply
  • 2304 views

Using the scripting API is it possible to create a custom node that outputs an image? I want to create some random curves and pass it onto the distance node. If it's possible, are there any tutorials or examples that would explain how to do it?

This topic has been closed for replies.

1 reply

Luca Giarrizzo
Community Manager
Community Manager
March 28, 2022

Hello,

 

This is indeed possible with the Python API. I have attached a sample script which performs the following operations:

 

  1. Create Uniform color and Levels nodes
  2. Set the value of the Output color property of the Uniform Color node
  3. Set the value of the Level Out Low and Level Out High properties of the Levels node
  4. Connect the Uniform color node's output to the Levels' node input

 

 

Remove the .txt extension from the script's filename to run it as a Python script in Designer's Python Editor window, which you can find in the Windows menu.

 

The Scripting section of Designer's documentation includes sample scripts for accessing node and their properties. Additionally, the Help menu lets you access the API Scripting Reference, which lists all classes, methods and modules available in the Python API.

 

I hope this is helpful and informative!

 

Best regards.

 

Luca Giarrizzo | Quality Engineer, 3D & Immersive | Adobe
New Participant
March 28, 2022

Thanks for that. I was hoping to create a node from scratch rather than creating a graph with code. Currently I use the HTML5 canvas API to create images with code and import them into Substance Designer. It would be great if you could create the custom image generator in Substance Designer using some sort of graphics API and expose some parameters for the user to tweak. Is that possible?

Luca Giarrizzo
Community Manager
Community Manager
March 28, 2022

Hello,

 

Thank you for clarifying your request. It is currently not possible to pass the output of a graphics API as a node in Designer.

 

The closest thing would be the Pixel Processor node, which executes a Function graph on each pixel of an image as a compiled shader. Along with the FX-Map node, it is one of the most complex yet powerful nodes in Designer. You can get started learning about using this node with this tutorial.

 

Best regards.

 

Luca Giarrizzo | Quality Engineer, 3D & Immersive | Adobe