sbsexporter module

class sbsexporter.SBSExporter

Bases: object

Class used to provide useful functions when parsing a .sbs (=xml) file

export(aSBSDocument, aExportFolder, aBuildArchive=False, aAliasesToExport=None, aArchiveFormat='zip')

Exports the given SBSDocument with its dependencies (resources + packages) to the specified folder, including the packages referenced by the provided aliases. This is the equivalent of the function ‘Export with dependencies’ within Substance Designer. If aAliasesToExport is let None, all the packages referenced by an alias will not be included in the self-contained package.

Parameters:
  • aSBSDocument (SBSDocument) – The package to export

  • aExportFolder (string) – The absolute path of the export folder (it must exist).

  • aBuildArchive (boolean, optional) – True to create an archive of the exported folder. Default to False

  • aAliasesToExport (list of string, optional) – The list of aliases to export in the self-contained package. If left None, the path with aliases will be kept as is.

  • aArchiveFormat (string, optional) – Archive format, among ‘zip’, ‘tar’, ‘gztar’, ‘bztar’ as specified in the Python module shutil

  • aCreateSubfolder (boolean, optional) – True to export the package to a same-named folder created inside the given export folder (not applicable to build archive). Default to True

Returns:

The absolute path of the resulting exported package or archive

Raise:

api_exceptions.SBSImpossibleActionError

getExportedDependencies()

Allows to get the exported dependencies (resources + packages) of the last export

Returns:

The exported dependencies as a dictionary of {oldAbsPath(string): newAbsPath(string)}

getExportedPackages()

Allows to get the exported packages of the last export

Returns:

The exported packages as a dictionary of {oldAbsPath(string): newAbsPath(string)}

getExportedResources()

Allows to get the exported resources of the last export

Returns:

The exported resources as a dictionary of {oldAbsPath(string): newAbsPath(string)}

getMissingPackages()

Allows to get the missing packages of the last export (file not found)

Returns:

The missing packages as a list string

getMissingResources()

Allows to get the missing resources of the last export (file not found)

Returns:

The missing resources as a list string

reset()

Reset the exporter to its initial state