Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - fabricio.chamon

Pages: [1]
1
Substance PainterSubstance Painter - Scripting - Export config generator
 on: November 12, 2020, 09:28:03 am 
Download: python script and sample yaml preset.

I was tired of having to manually translate all my export presets into a single .json config file (for using with the python api), so made this little tool to convert from YAML files inside a folder.

Usage: python create_export_config_file.py C:\path\to\dir
(*needs pyyaml module installed)

It will generate a file that you can use with:  substance_painter.export.export_project_textures(export_config)

YAML presets are expected to follow this format, which helps readability + shortening the files:

name: Basic Preset
maps:

  - fileName: $mesh_$textureSet_BaseColor
    channels:
     - R R documentMap baseColor
     - G G documentMap baseColor
     - B B documentMap baseColor

    parameters:
     dithering: false
     fileFormat: png
     bitDepth: 8
     paddingAlgorithm: infinite
     dilationDistance: 16

  - fileName: $mesh_$textureSet_Normal
    channels:
     - R R virtualMap Normal_OpenGL
     - G G virtualMap Normal_OpenGL
     - B B virtualMap Normal_OpenGL
     - A A virtualMap Normal_OpenGL

  - fileName: $mesh_$textureSet_Roughness
    channels:
     - L L documentMap roughness

  - fileName: $mesh_$textureSet_Metallic
    channels:
     - L L documentMap metallic


...In the above case, "parameters" will be cloned from the first block onto all other maps, but you can optionally define a block for each map repeating the same syntax.

Channel lines expect this formatting:
destChannel srcChannel srcMapType srcMapName (example: "R R documentMap baseColor")

Multiple YAML files will generate multiple presets inside a single export config file. The default preset is set to be the first yaml found on folder (or the one defined inside the .py file, if not empty).

Finally you can inspect the .py file to change a couple defaults for the config, on these lines:

# CHANGE YOUR PRESET FILE DEFAULTS HERE
#---------------------------------------
preset_file = {
   'exportPath': '',
   'exportShaderParams': False,
   'defaultExportPreset': '',
   'exportList': [],
   'exportParameters': [],
}
#---------------------------------------


Hope it helps.


2
+1 to this.

Also sorry to hijack the thread, but do we get any roadmap for the python API? It's really limited at the moment.

3
is it possible ? does not seem to be listed here: https://docs.substance3d.com/spdoc/command-lines-98959411.html

thanks.

4
this works for me (launching from houdini, on windows):

sbsExePath = 'C:/Program Files/Allegorithmic/Substance Painter/Substance Painter.exe'
subprocess.Popen([sbsExePath, "--mesh", pathToFbx, "--export-path", exportPath], executable=sbsExePath)

5
ok thanks.

6
Hi,

I need to automate these steps, wondering if the current API has support for:

1) create an empty folder
2) add mask with color selection
3) set color mask RGB values

thanks

Pages: [1]