• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

[Python] How to export project texture with my own preset?

Community Beginner ,
May 23, 2023 May 23, 2023

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

TOPICS
Discussion , Scripting

Views

235

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , May 23, 2023 May 23, 2023

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
...

Votes

Translate

Translate
Community Beginner ,
May 23, 2023 May 23, 2023

Copy link to clipboard

Copied

LATEST

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"
            }
        }]
    }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources