Skip to main content
andreas.r
Participant
May 20, 2026
Open for Voting

Python scripting improvements

  • May 20, 2026
  • 0 replies
  • 5 views
  1. Many methods still need one to use javascript. Make js and Python 1:1 - so I don't have to write javascript, in python. See setProjectExportPreset/getProjectExportPreset
     
  2. In Python it seems impossible to set export preset settings without actually also exporting. Getting/Setting settings should be possible without side effects.
     
  3. Setting Output Template programattically, does not also update fileFormat field to match.

    ``` python
    import substance_painter.js as js
    js.evaluate(‘alg.mapexport.setProjectExportPreset(“MyPreset”)’)  # MyPreset has fileFormat: tga
    js.evaluate(‘alg.mapexport.getProjectExportOptions()’)
    ```

    Returns {'bitDepth': 8, 'dilation': 16, 'exportShaderParams': False, 'exportUSD': False, 'fileFormat': 'bmp', 'padding': 'Infinite'}

    If I do this through the UI, it will set the field to match the file format in the preset on the otherhand.
     
  4. No option to set File type to use same as template. “Based on output template”

    ```python

    >>> js.evaluate("alg.mapexport.getProjectExportOptions()")

    {'bitDepth': 0, 'dilation': 16, 'exportShaderParams': False, 'exportUSD': False, 'fileFormat': '', 'padding': 'Infinite'}
     

    >>> js.evaluate("alg.mapexport.setProjectExportOptions({'bitDepth': 0, 'dilation': 16, 'exportShaderParams': false, 'exportUSD': false, 'fileFormat': '', 'padding': 'Infinite'})")

    RuntimeError: ExportError: Settings are left unchanged. The object contains invalid attributes. Invalid value '0': must be a string within [16,16f,32,32f,8]File format '' is not supported. The supported formats are bmp,jpg,jif,jpeg,jpe,jng,pgm,png,tga,targa,tif,tiff,psd,psb,hdr,exr,j2k,j2c,jp2,webp

    ```
     
  5. Multiline support for the python console. It is beyond painful to to test python in Painter.