Copy link to clipboard
Copied
Is there access to the list of preset output templates available to the Export textures window via python API?
I have tried
substance_painter.resource.search('u:export')
and
substance_painter.resource.search('u:EXPORT')
to no avail. Further, this snippet:
resources=substance_painter.resource.search('')
for resource in resources:
substance_painter.logging.log(
substance_painter.logging.INFO,
'testing',
'resource is %s' % resource.identifier().name
)
never prints any of the export presets to the log. Should I expect to see i.e. 'CryEngine' in the log with the above code?
Ultimately, our goal is to hide from the user any export defaults we don't think are necessary for studio work. We would like to do that without removing the painter installation path from the list of available resources if at all possible.
Thanks,
Chris
Copy link to clipboard
Copied
any solutions for this? i would also like to query the output templates already existing in the project
Copy link to clipboard
Copied
Would like to +1 and bump this question. I'm also stuck getting these through `substance_painter.resource`.
The documentation does seem to be able to use it as a resource for Exporting using a default preset
None of these seem to return the export presets:
resources = substance_painter.resource.search(substance_painter.resource.StandardQuery.ALL_RESOURCES)
resources = substance_painter.resource.search("")
And like in the original topic message I expected this to only return resources with "Usage" 'export':
substance_painter.resource.search('u:export')
I basically want the same list as is shown in the UI:
preferably including the export-preset-generator variants too (above the divider) here.
I'm at least able to find the currently set project template using this:
substance_painter.js.evaluate("alg.mapexport.getProjectExportPreset()")
Which will return something like:
'export-preset-generator://doc-channel-normal-no-alpha'
Copy link to clipboard
Copied
Just checking in whether there's been any updates to Substance Painter in its API solving this? Or maybe someone figured out a decent way to do this?
Copy link to clipboard
Copied
Hi everyone,
and thanks @ChrisBurrowsCG for the question.
The output template files being available in your folders under:
C:\Program Files\Adobe\Adobe Substance 3D Painter\resources\starter_assets\export-presets
You should be able to use them from there.
With that being said, you might find another solution in our scripting documentation (help>scripting documentation>Python API>Substance_Painter package>resource module).
Best regards,
Copy link to clipboard
Copied
Thank you Cyril for the reply.
My specific use case involves wanting to hide the contents of starter_assets/export-presets from the user without explicitly removing/moving the files on disk. For production reasons we're still working with version 7.x; when we can start working with 8.x I'll try the python resource module again.
Copy link to clipboard
Copied
Not a direct approach, but you can do something like this:
import substance_painter.resource
for shelf in substance_painter.resource.Shelves.all():
export_presets_dir = f"{shelf.path()}/export-presets"
if not os.path.isdir(export_presets_dir):
continue
for filename in os.listdir(export_presets_dir):
if not filename.endswith(".spexp"):
continue
name = os.path.splitext(filename)[0]
export_preset_id = substance_painter.resource.ResourceID(context=shelf.name(), name=name)
export_preset = substance_painter.resource.Resource.retrieve(export_preset_id)[0]
print(export_preset.gui_name())
Copy link to clipboard
Copied
Only issue here is that this doesn't return the internal preset names, right?
Copy link to clipboard
Copied
It returned these names:
Amazon Lumberyard
Arnold (AiStandard)
Arnold UDIM Legacy (AiStandard)
Blender (Principled BSDF)
Corona
CryEngine
Dota 2
KeyShot 9+
KeyShot
Lens Studio
Maxwell (Metallic Roughness)
Maxwell (Specular Glossiness)
Mesh Maps
Non-PBR Specular Glossiness
PBR Metallic Roughness (folders or PSD groups)
PBR Metallic Roughness
PBR Specular Glossiness (converted from Metallic Roughness)
PBR Specular Glossiness
Redshift (rsMaterial)
Renderman (pxrDisney)
Renderman (pxrSurface)
Roblox (MaterialVariant)
Roblox (SurfaceAppearance)
Shade 3D
Spark AR Studio
Unity HD Render Pipeline (Metallic Standard)
Unity HD Render Pipeline (Specular)
Unity Universal Render Pipeline (Metallic Standard)
Unity Universal Render Pipeline (Specular)
Unreal Engine 4 (Packed)
Unreal Engine 4 SSS (Packed)
Vray Next (Metallic Roughness)
Vray Next (Specular Glossiness)
Vray Next UDIM Legacy (Metallic Roughness)