Skip to main content
Participating Frequently
September 22, 2024

Substance Painter 10.1 Python JS API does not support optional arguments

  • September 22, 2024
  • 0 replies
  • 273 views

Starting in Subtance Painter 10.1 suddenly it seems that the `'alg.mapexport.getPathsExportDocumentMaps` javascript command requires the `stackPaths` argument which has always been optional and is still depicted as optional in the documentation:

 

 

For example this fails:

```python

substance_painter.js.evaluate('alg.mapexport.getPathsExportDocumentMaps("export-preset-generator://viewport2d", "/path/to", "png")')

```

 

Stack trace:

```python

RuntimeError: TypeError: Passing incompatible arguments to C++ functions from JavaScript is not allowed.

 

At:

C:\Program Files/Adobe/Adobe Substance 3D Painter/resources/python/modules\substance_painter\js.py(56): evaluate

<string>(2): <module>

```

 

But this works:

```python

substance_painter.js.evaluate('alg.mapexport.getPathsExportDocumentMaps("export-preset-generator://viewport2d", "/path/to", "png", [])')

```

 

Even though the first command worked fine in Substance Painter 10.0 and below.

 

---

 

For more details, see [this issue](https://github.com/ynput/ayon-substance-painter/issues/13).