Automation scripting help
Hi, I'm trying to write a script to process some images but I'm finding the whole process very difficult. My script isnt working and to debug it I do Help->export log and then open the log file and scroll to the bottom. Running the script via console using`"C:\Program Files\Adobe\Adobe Substance 3D Sampler\Adobe Substance 3D Sampler.exe" --run-script <script.py>` doesnt work. I just want to write a script that batches a set of images in a directory through a material asset and exports the result. This is what I have so far
import substance_sampler as ssa
from random import randrange
from pathlib import Path
IMAGE_PATH = "C:/Users/sava/Maps"
OUTPUT_PATH = "C:/Users/sava/Output"
input_images = Path(IMAGE_PATH).glob("*.jpg")
my_asset = ssa.get_selected_asset()
my_asset_layers = my_asset.get_layers()
#Go through the layers list
for layer in my_asset_layers:
# find input image layer
if layer.type is ssa.layer_image_import:
# go through all our input images
for input_image in input_images:
# find input image parameter
for parameter in layer.parameters:
if parameter.type == "Input Image":
# set input image parameter
parameter.value = str(input_image)
ssa.wait_for_computation()
[blender_export_preset] = ssa.get_export_presets("Blender Cycles/Eevee")
my_asset.export_material(path = OUTPUT_PATH, name = input_image.stem, format=ssa.png, channels=["basecolor", "normal", "roughness", "metallic"], preset=blender_export_preset)
ssa.ExportController.wait()
Is there a better way to develop scripts for substance 3d sampler?

