Copy link to clipboard
Copied
Hi, I am currently try to export my project texture with my own preset by Python.
My Substance Painter version is 8.3.0.0
I found that this line go fine
substance_painter.resource.ResourceID( context="starter_assets", name="Arnold (AiStandard)").
#Result: resource://starter_assets/Arnold (AiStandard)
At the export_config =
"exportPath": "C:/export",
"defaultExportPreset" : export_preset.url() or "resource://starter_assets/Arnold (AiStandard)"
I would like to ask is there any way to get the url to my own preset?
I locate my own preset at \Document\Adobe\Adobe Substance 3D Painter\assets\export-presets
I just figure out how could we do that with the following script below
import substance_painter as sp
#List all of the shelf exist in the current project
exist_shelves = sp.resource.Shelves.all()
#After the result printed in the console
#[Shelf(_name='stater_assets'), Shelf(_name='your_assets')]
#After have the result, we have to check if that shelf available to import resource
sp.resource.Shelf.('shelf_name_from_exist_shelves').can_import_resources()
#If the shelf return 'True' value, we move on
...
Copy link to clipboard
Copied
I just figure out how could we do that with the following script below
import substance_painter as sp
#List all of the shelf exist in the current project
exist_shelves = sp.resource.Shelves.all()
#After the result printed in the console
#[Shelf(_name='stater_assets'), Shelf(_name='your_assets')]
#After have the result, we have to check if that shelf available to import resource
sp.resource.Shelf.('shelf_name_from_exist_shelves').can_import_resources()
#If the shelf return 'True' value, we move on the next step and use that shelf name as the 'shelf_name_from_exist_shelves' below
#Define the usage of the resoure you going to import as the export-preset
sp.resource.Shelf('shelf_name_from_exist_shelves').import_resource(file_path, sp.resource.Usage.EXPORT)
#Define export preset
export_preset = sp.resource.ResourceID(context='shelf_name_from_exist_shelves', name = 'your_export_preset_name')
export_config = {
"exportShaderParams": False,
"exportPath": "your:\export\Path\Here",
"defaultExportPreset" : export_preset.url(),
"exportList": [
{
"rootPath": "01_Head"
},
{
"rootPath": "02_Body"
},
{
"rootPath": "03_Base"
}],
"exportParameters": [
{
"parameters": {
"fileFormat" : "png",
"bitDepth" : "8",
"dithering": True,
"paddingAlgorithm": "infinite"
}
}]
}