Last updated on
Sep 15, 2025
Note
Documentation for Substance Automation Toolkit is now included in the SAT package. You can access the documentation by opening html-doc.zip inside your downloaded SAT package.
script_update_with_sbsupdater
script_update_with_sbsupdater.scriptUpdatePackagesVersion(aContext, aPreviousVersion, aPreviousUpdaterVersion, aPackagesFolderRootDir, aBatchToolsFolder=None)
Allows to update to the current version of Substance Designer all .sbs recursively included in the given folder path using the Mutator Batch Tool.
| Parameters: |
|
|---|---|
| Returns: | True if success |
Here is the code of function scriptUpdatePackagesVersion:
aUpdaterPath = aContext.getBatchToolExePath(aBatchTool=sbsenum.BatchToolsEnum.UPDATER, aBatchToolsFolder=aBatchToolsFolder)
aPresetPackagePath = aContext.getDefaultPackagePath()
try:
aCommand = [aUpdaterPath, '--no-dependency', '--output-path', '{inputPath}', '--output-name', '{inputName}', '--presets-path', aPresetPackagePath]
log.info(aCommand)
aRootDir = os.path.normpath(aPackagesFolderRootDir)
for root, subFolders, files in os.walk(aRootDir):
for aFile in files:
if aFile.endswith('.sbs'):
aPackagePath = os.path.join(root, aFile)
aDoc = substance.SBSDocument(aContext=aContext, aFileAbsPath=aPackagePath)
log.info('Parse substance '+aPackagePath)
try:
aDoc.parseDoc()
except SBSIncompatibleVersionError:
pass
if aDoc.mFormatVersion == aPreviousVersion and aDoc.mUpdaterVersion == aPreviousUpdaterVersion:
aMutatorCmd = aCommand + ['--input', aPackagePath]
print(aMutatorCmd)
log.info('Update substance '+aPackagePath)
subprocess.check_call(aMutatorCmd)
log.info('=> All packages have been updated using the Mutator Batch Tool')
return True
except BaseException as error:
log.error("!!! [demoUpdatePackagesVersion] Failed to update a package")
raise error