Question
Importing Substance files using Blender Python bpy
I'm trying to load a Substance .sbsar file into Blender 4.2.1 LTS using the 'Adoby Substance 3D add-on for Blender' 2.3.0 using the Python bpy library.
file_path = "/Users/xxx/sbsar/lemon_skin.sbsar"
bpy.ops.mesh.primitive_uv_sphere_add(segments=128, ring_count=64)
ob = bpy.data.objects["Sphere"]
ob.select_set(True)
bpy.context.view_layer.objects.active = ob
file_abs = str(Path(file_path).absolute())
file_name = str(Path(file_path).name)
file_parent = str(Path(file_path).parent.absolute()) + "/"
bpy.ops.substance.load_sbsar(filepath=file_abs, files=[{"name":file_name},{"name":file_name}], directory=file_parent)
however I get the error:
Substance 3D in Blender: Substance file [lemon_skin.sbsar] located at [/Users/xxx/sbsar/lemon_skin.sbsar] could not be loaded
Strangley if I open the 'Substance 3D' panel, click the 'Load' button, then 'Cancel' the file dialog (without selecting anything) the load_sbsar command works!
Please can you help.
Kind regards,
Paul
