Author Topic: python plugins documentation  (Read 716 times)

Hi,
is there documentation or examples how to write plugins for painter using the new python API? I can find docs for designer python API but nothing for the painter? We would love to finally pipeline painter properly and move away from our hacky javascript plugins.
I assume there is way set an env var that points to python plugins so we can load them from a shared location? Current javascript implementation forces us to copy plugins to artist machines and keep them in sync which is far from ideal.

Hello! I don't know if they exist anywhere online, but you can get at the new Painter Python docs from the menu in Painter at Help -> Documentation -> Python API.

We're in the same boat on copying around JS plug-ins. If you look here, there is a way to specify a plug-in path for Python plug-ins in the environment (wahoo!) with the SUBSTANCE_PAINTER_PLUGINS_PATH variable.
Quote
Substance Painter/resources/python-doc/plugins/substance_painter_plugins.html

Do have a look at the substance_painter package docs though -- it doesn't yet support everything available in JS.

Does anyone have an example of SUBSTANCE_PAINTER_PLUGINS_PATH environment variable working?
it doesn't seem to be an environment variable as much as we need to edit the following variable in python...
substance_painter_plugins.path
Senior Technical Artist
Bethesda Game Studios

Carlos you can modify the SUBSTANCE_PAINTER_PLUGINS_PATH programatically if you wish, the documentation says SP stores the system paths in this variable: substance_painter_plugins.path, so you can append a path to the list and then call substance_painter_plugins.update_sys_path(), otherwise you can always change the var from your ENV VARS in your system.

Anyway you can simple call this from the command line inside SP to know where are your plugins located:

import substance_painter_plugins
print(substance_painter_plugins.path)

they also have an example inside called painter_test_automation, it tells how to initialize a plugin.

I have to say, man! finally I was waiting for so long this python thingy, the coolest thing is implemented by default with PySide2, can't wait to write cool stuff in there

Cheers and good coding guys
Last Edit: May 11, 2020, 05:49:23 pm

Does anyone have an example of SUBSTANCE_PAINTER_PLUGINS_PATH environment variable working?
it doesn't seem to be an environment variable as much as we need to edit the following variable in python...
substance_painter_plugins.path

I found that you need to replicate the folder structure inside the folder the env var points to. You need "modules", "plugins" and "startup" folders there (at least the "plugins" one for your plugin). Then substance picks up the plugins and script from startup. not sure what goes to modules though.

Interestingly I thought i tried this, what version of substance are you using?
Senior Technical Artist
Bethesda Game Studios