User Guide Cancel

sbsimpactmanager | Substance 3D Automation ToolKit

sbsimpactmanager

class sbsimpactmanager.DependencyStatus(absolute_file_path='', relative_file_path='')
class sbsimpactmanager.DependencyStatus(absolute_file_path='', relative_file_path='')
class sbsimpactmanager.DependencyStatus(absolute_file_path='', relative_file_path='')

Bases: object

Class that contains information of the dependency

Members:
  • absolute_file_path (str, optional): absolute file path of the dependency
  • relative_file_path (str, optional): relative file path of the dependency
  • file_readable (bool): is file readable
  • file_exist (bool): is file exist
file_exist
file_exist
file_exist
file_readable
file_readable
file_readable
class sbsimpactmanager.SBSImpactManager(aContext=None)
class sbsimpactmanager.SBSImpactManager(aContext=None)
class sbsimpactmanager.SBSImpactManager(aContext=None)

Bases: object

Class used to provide useful functions to propagate changes done a Substance on all the Substances within a particular tree

confirm(promptMsg=None, defaultResponse=False)
confirm(promptMsg=None, defaultResponse=False)
confirm(promptMsg=None, defaultResponse=False)

Prompts for yes or no response from the user.

Parameters:
  • promptMsg (str, optional) – The message to prompt to the user. If None, ‘Confirm’ will be prompted
  • defaultResponse (bool, optional) – The default return value, returned when used simply press ENTER. Default to False
Returns:

True for yes and False for no.

declareSBSMoved(self, aContext, oldPath, newPath, withinTree, interactiveMode = True, stopOnException = True)
declareSBSMoved(self, aContext, oldPath, newPath, withinTree, interactiveMode = True, stopOnException = True)
declareSBSMoved(self, aContext, oldPath, newPath, withinTree, interactiveMode = True, stopOnException = True)

Allows to declare the fact a substance has been move from the oldPath to the newPath.

This will update all the Substance files (.sbs) in the given tree that had a dependency on the Substance that had been moved.

Parameters:
  • aContext (Context) – The current execution context (allows to provide aliases)
  • oldPath (str) – The old absolute path of the Substance (can be .sbs or .sbsar file)
  • newPath (str) – The new absolute path of the Substance (can be .sbs or .sbsar file)
  • withinTree (str) – The tree where to find the Substances to update
  • interactiveMode (bool, optional) – Run the process in an interactive mode, requiring user confirmation at each step. Default to True
  • stopOnException (bool, optional) – Allows to stop the propagation process when an exception occurs. Default to True
Returns:

the list of updated Substance paths

getAllSubstancesInTree(rootPath, excludeAutosave=True, excludeFolders=None)
getAllSubstancesInTree(rootPath, excludeAutosave=True, excludeFolders=None)
getAllSubstancesInTree(rootPath, excludeAutosave=True, excludeFolders=None)

Get all the Substance files (.sbs) within a particular tree

Parameters:
  • rootPath (str) – The root path of the tree to explore on the file system
  • excludeAutosave (bool, optional) – True to exclude the Substances included in a .autosave folder. Default to True
  • excludeFolders (list of string, optional) – A list of folder names to exclude in the Substance search
Returns:

the Substance files as a list of absolute paths

getAllSubstancesWithDependencyOn(self, aContext, substancePath, withinTree, stopOnException = True)
getAllSubstancesWithDependencyOn(self, aContext, substancePath, withinTree, stopOnException = True)
getAllSubstancesWithDependencyOn(self, aContext, substancePath, withinTree, stopOnException = True)

Get all the Substances (.sbs) that have a dependency on the given Substance (.sbs or .sbsar), within the given tree.

Parameters:
  • aContext (Context) – The current execution context (allows to provide aliases)
  • substancePath (str) – The path of the Substance to look for (can be .sbs or .sbsar file)
  • withinTree (str) – The tree where to find the referencing Substances
  • stopOnException (bool, optional) – Allows to stop the exploring process when an exception occurs. Default to True
Returns:

the list of referencing Substances as SBSDocument objects

getErrorPackages()
getErrorPackages()
getErrorPackages()

Allows to get the list of packages that raised error during the last impact propagation

Returns: The list of packages path in error as a list string
getSBSTreeDependencies(aSubstancePath, escapeDefaultSbs=False, checkMissingFile=False, escapeMismatchVersion=False)
getSBSTreeDependencies(aSubstancePath, escapeDefaultSbs=False, checkMissingFile=False, escapeMismatchVersion=False)
getSBSTreeDependencies(aSubstancePath, escapeDefaultSbs=False, checkMissingFile=False, escapeMismatchVersion=False)

Return a tree under a dict form of all aSubstancePath’s dependencies recursively. The tree schema

{"/a/sbs/file.sbs":
{<impactmanager.'DependencyStatus' (/a/dep/file.sbs)>:
[{<impactmanager.'DependencyStatus' (/another/dep/file.sbs)>:
[]
}]
}
}
{"/a/sbs/file.sbs": {<impactmanager.'DependencyStatus' (/a/dep/file.sbs)>: [{<impactmanager.'DependencyStatus' (/another/dep/file.sbs)>: [] }] } }
{"/a/sbs/file.sbs": 
    {<impactmanager.'DependencyStatus' (/a/dep/file.sbs)>: 
        [{<impactmanager.'DependencyStatus' (/another/dep/file.sbs)>: 
                [] 
        }] 
    } 
}

Each key is a DependencyStatus and value a list of dependencies dict DependencyStatus The result tree is also store in self.dependenciesTree member

Parameters:
  • aSubstancePath (str) – an existing substance file path that will be the root path
  • escapeDefaultSbs (bool) – if True, all the default installation sbs packages (aliased by sbs://) will be ignored
  • checkMissingFile (bool) – for each dependency the existing of the file will be checked, if it doesn’t exist it will append to self.missingFiles
  • escapeMismatchVersion (bool) – if True the error SBSIncompatibleVersionError will be catch and the process will continue. The mismatched file will append to self.mismatchVersionFiles
Returns:

dict

getSBSTreeDependenciesForAllSubstanceInTree(aRootPath, excludeFolders=None, escapeDefaultSbs=False, checkMissingFile=False, escapeMismatchVersion=False)
getSBSTreeDependenciesForAllSubstanceInTree(aRootPath, excludeFolders=None, escapeDefaultSbs=False, checkMissingFile=False, escapeMismatchVersion=False)
getSBSTreeDependenciesForAllSubstanceInTree(aRootPath, excludeFolders=None, escapeDefaultSbs=False, checkMissingFile=False, escapeMismatchVersion=False)

For all sbs files found in the aRootPath’s tree, getSBSTreeDependencies will be run.

Parameters:
  • aRootPath (str) – A path directory, the root of the tree folders.
  • excludeFolders (list) – A list of path to exclude of the search
  • escapeDefaultSbs (bool) – if True, all the default installation sbs package (aliased by sbs://) will be ignored
  • checkMissingFile (bool) – for each dependency the existing of the file will be checked, if it doesn’t exist it will append to self.missingFiles
  • escapeMismatchVersion (bool) – if True the error SBSIncompatibleVersionError will be catch and the process will continue. The mismatched file will append to self.mismatchVersionFiles
Returns:

list

getUpdatedPackages()
getUpdatedPackages()
getUpdatedPackages()

Allows to get the list of packages updated with the last impact propagation

Returns: The list of packages path as a list string
reset()
reset()
reset()

Reset the exporter to its initial state

sbsimpactmanager.imRawInput(s)
sbsimpactmanager.imRawInput(s)
sbsimpactmanager.imRawInput(s)

Function used to specify the input used by the interactive mode of SBSImpactManager. By default it uses the Python standard input, but it can be redefined to mock the standard input.

Get help faster and easier

New user?