Copy link to clipboard
Copied
I want to load a sbsar file and attach the material to any objects using Python API.
Like following pseudo codes,
import bpy
import substance3d
path = '<path/to/sbsar_file>'
substance3d.obj.load(path)
material = bpy.context.materials['name_of_sbsar']
object = bpy.context.selected_objects[0]
object.data.materials.append(material)
I have used Blender 4.0 and new Substance 3D Plugin for Blender.
Does anyone have any good advices?
Copy link to clipboard
Copied
Sorry, that wasn't hard.
import bpy
bpy.ops.substance.load_sbsar(filepath="<path>/hoge.sbsar", files=[{"name":"hoge.sbsar"}], directory="<path>")
Copy link to clipboard
Copied
Thanks for sharing this! We'll capture it in our documentation
Copy link to clipboard
Copied
But.... It wasn't that easy, again.
Addon initializer and SBSAR loading function are executed on another thread.
I want to attach the material which is created from sbsar file to any objects, but materials are still empy after loading a SBSAR file.
I do not know how to wait these threads....
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more