resource module
Module resource provides the definition of the classes relative to a SBSResource:
- class substance.resource.SBSSourceExternalCopy(aFilename='')
Bases:
SBSObjectClass that contains information on a source external copy as defined in a .sbs file. External copy refers to an external file copied in a sub-folder of the application and entirely managed (iTunes style).
- Members:
mFilename (str): name of the managed file.
- parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
- write(aSBSWriter, aXmlNode)
Write recursively the content of the SBSObject into the given xml node.
- Parameters:
aSBSWriter (
SBSWriter) – the substance writeraXmlNode (
xml.etree.ElementTree) – the xml node to fill
- equals(other)
Check if this SBSObject is equivalent to the other SBSObject. Some members may be excluded from this check, the UIDs or GUILayout for instance.
- getUidIsUsed(aUID)
Check if the given uid is already used in the context of this SBSObject.
- Parameters:
aUID (str) – UID to check
- Returns:
True if the uid is already used, False otherwise
- Raise:
AttributeError if the function getUidIsUsed in not properly overloaded on this SBSObject
- class substance.resource.SBSSourceBinboon(aOffset='', aDatalength='', aFormat=None, aCompressedlength=None)
Bases:
SBSObjectClass that contains information on a source binary file bounded to the package as defined in a .sbs file. Binboon refers to a file saved in a binary file bounded to this package.
- Members:
mOffset (str): offset in the binary file in bytes.
mDatalength (str): length of the data in the binary file in bytes.
mFormat (str, optional): zlib, raw, etc.
mCompressedlength (str, optional): size of the compressed data (if applicable).
- parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
- write(aSBSWriter, aXmlNode)
Write recursively the content of the SBSObject into the given xml node.
- Parameters:
aSBSWriter (
SBSWriter) – the substance writeraXmlNode (
xml.etree.ElementTree) – the xml node to fill
- equals(other)
Check if this SBSObject is equivalent to the other SBSObject. Some members may be excluded from this check, the UIDs or GUILayout for instance.
- getUidIsUsed(aUID)
Check if the given uid is already used in the context of this SBSObject.
- Parameters:
aUID (str) – UID to check
- Returns:
True if the uid is already used, False otherwise
- Raise:
AttributeError if the function getUidIsUsed in not properly overloaded on this SBSObject
- class substance.resource.SBSSourceBinembedded(aDatalength='', aFormat=None, aStrdata='')
Bases:
SBSObjectClass that contains information on a source binary file embedded to the package as defined in a .sbs file. Binembedded refers to a content embedded in the package file.
- Members:
mDatalength (str): size of the binary data in bytes.
mFormat (str, optional): zlibbase64, rawbase64, etc.
mStrdata (str): data in base64 ASCII format.
- parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
- write(aSBSWriter, aXmlNode)
Write recursively the content of the SBSObject into the given xml node.
- Parameters:
aSBSWriter (
SBSWriter) – the substance writeraXmlNode (
xml.etree.ElementTree) – the xml node to fill
- equals(other)
Check if this SBSObject is equivalent to the other SBSObject. Some members may be excluded from this check, the UIDs or GUILayout for instance.
- getUidIsUsed(aUID)
Check if the given uid is already used in the context of this SBSObject.
- Parameters:
aUID (str) – UID to check
- Returns:
True if the uid is already used, False otherwise
- Raise:
AttributeError if the function getUidIsUsed in not properly overloaded on this SBSObject
- class substance.resource.SBSSource(aExternalCopy=None, aBinBoon=None, aBinEmbedded=None)
Bases:
SBSObjectClass that contains information on a source as defined in a .sbs file Embedded or managed source. The three children are exclusives.
- Members:
mExternalCopy (
SBSSourceExternalCopy): external file copied in a sub-folder of the application and entirely managed (iTunes style).mBinBoon (
SBSSourceBinboon): file saved in a binary file bounded to this package.mBinEmbedded (
SBSSourceBinembedded): content embedded in the package file.
- parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
- write(aSBSWriter, aXmlNode)
Write recursively the content of the SBSObject into the given xml node.
- Parameters:
aSBSWriter (
SBSWriter) – the substance writeraXmlNode (
xml.etree.ElementTree) – the xml node to fill
- getSource()
Get the source, accordingly to the kind of source
- Returns:
a
SBSSourceExternalCopy,SBSSourceBinboonorSBSSourceBinembeddedobject
- equals(other)
Check if this SBSObject is equivalent to the other SBSObject. Some members may be excluded from this check, the UIDs or GUILayout for instance.
- getUidIsUsed(aUID)
Check if the given uid is already used in the context of this SBSObject.
- Parameters:
aUID (str) – UID to check
- Returns:
True if the uid is already used, False otherwise
- Raise:
AttributeError if the function getUidIsUsed in not properly overloaded on this SBSObject
- class substance.resource.SBSResource(aIdentifier='', aUID='', aType='', aFormat='', aCookedFormat=None, aCookedQuality=None, aFilePath='', aAttributes=None, aSource=None, aTree=None, aFileAbsPath='', aRefDocument=None, aColorSpace=None, aPremultipliedAlpha=None)
Bases:
SBSObjectClass that contains information on a substance resource as defined in a .sbs file
- Members:
mIdentifier (str): identifier of the file.
mUID (str): unique identifier of this resource in the package/ context.
mType (str): type of the resource (‘bitmap’,’svg’,…)
mFormat (str): original format of the resource (e.g. BMP, JPG for bitmap type resources).
mColorSpace (str, optional): colorspace transformation to apply based on ocio config file.
mPremultipliedAlpha (bool, optional): alpha is premultiplied or not.
mCookedFormat (str, optional): format of the resource after the cooking stage (among
BitmapFormatEnumfor bitmap resources)mCookedQuality (float as a string, optional): quality of resource after the cooking stage (percentage for a bitmap type with a cookedFormat JPEG).
mFilePath (str): path and name of the origin file.
mAttributes (
SBSAttributes): various attributes (author, description, …)mSource (
SBSSource): embedded or managed source.mOptions (
SBSOption): additional options.
- parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
- write(aSBSWriter, aXmlNode)
Write recursively the content of the SBSObject into the given xml node.
- Parameters:
aSBSWriter (
SBSWriter) – the substance writeraXmlNode (
xml.etree.ElementTree) – the xml node to fill
- equals(other)
Check if this SBSObject is equivalent to the other SBSObject. Some members may be excluded from this check, the UIDs or GUILayout for instance.
- resolveDependency(aSBSDocument)
Allow to resolve the dependency of the resource on the root package that contains it.
- Parameters:
aSBSDocument (
SBSDocument) – The root document
- getAllowedAttributes()
Get the attributes allowed on a SBSResource
- Returns:
the list of attribute enumeration allowed (
AttributesEnum)
- static isAllowedExtension(aExtension)
Check if the given extension is allowed for this type of resource
- Parameters:
aResourceType (
ResourceTypeEnumor str) – the kind of resource to consideraExtension (str) – the extension to check (ex: ‘.png’)
- Returns:
True if this extension is allowed for this kind of resource, False otherwise
- getAttribute(aAttributeIdentifier)
Get the given attribute value
- Parameters:
aAttributeIdentifier (
AttributesEnum) – the attribute identifier- Returns:
the attribute value if defined, None otherwise
- setAttribute(aAttributeIdentifier, aAttributeValue)
Set the given attribute
- Parameters:
aAttributeIdentifier (
AttributesEnum) – The attribute identifier to setaAttributeValue (str) – The attribute value to set
- setAttributes(aAttributes)
Set the given attributes
- Parameters:
aAttributes (dictionary in the format {
AttributesEnum: value}) – The attributes to set
- setColorSpace(aColorSpace, aContext)
Set colorspace value to apply to the resource bitmap :param aColorSpace: str colorspace value :param aContext: str colorspace value :type aContext: aContext
Context:return:
- setPremultipliedAlpha(aIsPremultipliedAlpha)
- setCookedFormat(aCookedFormat)
- getPkgResourcePath()
Get the path of the resource relatively to its parent package (pkg:///).
- Returns:
The path as a string
- getResolvedFilePath()
Get the path of the resource relatively to its parent package (SBSDocument)
- Returns:
The path as a string
- getOption(aOptionName)
Get the option identified by the given name
- Returns:
the option as a
SBSOptionif found, None otherwise
- getBakingOptions()
Get all the options related to the baking parameters on this resource
- Returns:
a list of
SBSOption
- getSceneOptions()
Get all the options related to the 3D Scene on this resource
- Returns:
a list of
SBSOption
- getSceneInfoOptions()
Get all the options related to the 3D Scene information on this resource
- Returns:
a list of
SBSOption
- setOptions(aOptions)
- getResourceTypeEnum()
- Returns:
the resource type as a
ResourceTypeEnumif defined, None otherwise
- createBakingParameters()
Create the baking parameters for this Scene resource, and init all required values. No converter is added by default.
- Returns:
The
BakingParametersobject created- Raise:
api_exceptions.SBSImpossibleActionError
- getBakingParameters()
Decode the baking parameters option and convert it into an editable object structure
- Returns:
The baking parameters as a
BakingParametersobject if defined, None otherwise
- setBakingParameters(aBakingParameters)
Set the given baking parameters on this resource. The function converts the baking parameters into a list of SBSOptions, as saved in .sbs format. All the previous options related to Baking Parameters will be removed before creating the new ones. Raise an exception if the resource is not a Scene.
- Parameters:
aBakingParameters (
BakingParameters) – The baking parameters to set- Returns:
Nothing
- Raise:
api_exceptions.SBSImpossibleActionError
- isLinked()
- Returns:
True if the resource is just linked with its path to the document (by opposition to imported)
- setResourceIsBakingOutput(aBakedSceneResource, aBaker)
Declare this Bitmap resource as the output of a Baking process
- Parameters:
aBakedSceneResource (
SBSResourceScene) – The scene resource used to bake mapsaBaker (
BakerEnumor str) – The baker used (as a BakerEnum or an identifier, for instance ‘Curvature Map from Mesh [2]’)
- Returns:
- getPhysicalResourceList()
Get the list of physical files associated to this resource. This allow for the particular case of a resource pointing to the output of a baking with Udims, to get the list of corresponding files.
- Returns:
a list of string
- getUidIsUsed(aUID)
Check if the given uid is already used in the context of this SBSObject.
- Parameters:
aUID (str) – UID to check
- Returns:
True if the uid is already used, False otherwise
- Raise:
AttributeError if the function getUidIsUsed in not properly overloaded on this SBSObject
- class substance.resource.SBSResourceScene(aIdentifier='', aUID='', aType='', aFormat='', aCookedFormat=None, aCookedQuality=None, aFilePath='', aAttributes=None, aSource=None, aOptions=None, aFileAbsPath='', aRefDocument=None, aIsUdim=None, aSceneMaterialMap=None)
Bases:
SBSResourceClass that contains information on a substance scene/mesh resource as defined in a .sbs file
- Members:
mIdentifier (str): identifier of the file.
mUID (str): unique identifier of this resource in the package/ context.
mType (str): type of the resource (‘bitmap’,’svg’,…)
mFormat (str): original format of the resource (e.g. BMP, JPG for bitmap type resources).
mCookedFormat (str, optional): format of the resource after the cooking stage (among
BitmapFormatEnumfor bitmap resources)mCookedQuality (float as a string, optional): quality of resource after the cooking stage (percentage for a bitmap type with a cookedFormat JPEG).
mFilePath (str): path and name of the origin file.
mAttributes (
SBSAttributes): various attributes (author, description, …)mSource (
SBSSource): embedded or managed source.mOptions (
SBSOption): additional options.mIsUdim (str, optional): flag indicating whether this scene must be managed as a mesh unwrapped on multiple UV-tiles
mSceneMaterialMap (list of
SBSSceneMaterialMapEntry): An associative list that store material-graph affectation for the scene resource.
- parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
- write(aSBSWriter, aXmlNode)
Write recursively the content of the SBSObject into the given xml node.
- Parameters:
aSBSWriter (
SBSWriter) – the substance writeraXmlNode (
xml.etree.ElementTree) – the xml node to fill
- setMaterialMapEntries(aMaterialsList, nbUVSet=1)
Init the material map entries given the list of materials of the mesh resource.
- Parameters:
aMaterialsList (list of str) – list of material names
nbUVSet (int, optional) – number of UV-sets of the mesh. Default to 1
- getMaterialMapEntry(aMaterialName)
Get the material map entry corresponding to the given material name
- Parameters:
aMaterialName (str) – The material name to look for
- Returns:
a
SBSSceneMaterialMapEntryif found, None otherwise
- getMaterialMapEntries()
Get the list of material entries of this scene resource
- Returns:
a list of
SBSSceneMaterialMapEntry
- createBakingParameters()
Create the baking parameters for this Scene resource, and init all required values. No converter is added by default.
- Returns:
The
BakingParametersobject created- Raise:
api_exceptions.SBSImpossibleActionError
- equals(other)
Check if this SBSObject is equivalent to the other SBSObject. Some members may be excluded from this check, the UIDs or GUILayout for instance.
- getAllowedAttributes()
Get the attributes allowed on a SBSResource
- Returns:
the list of attribute enumeration allowed (
AttributesEnum)
- getAttribute(aAttributeIdentifier)
Get the given attribute value
- Parameters:
aAttributeIdentifier (
AttributesEnum) – the attribute identifier- Returns:
the attribute value if defined, None otherwise
- getBakingOptions()
Get all the options related to the baking parameters on this resource
- Returns:
a list of
SBSOption
- getBakingParameters()
Decode the baking parameters option and convert it into an editable object structure
- Returns:
The baking parameters as a
BakingParametersobject if defined, None otherwise
- getOption(aOptionName)
Get the option identified by the given name
- Returns:
the option as a
SBSOptionif found, None otherwise
- getPhysicalResourceList()
Get the list of physical files associated to this resource. This allow for the particular case of a resource pointing to the output of a baking with Udims, to get the list of corresponding files.
- Returns:
a list of string
- getPkgResourcePath()
Get the path of the resource relatively to its parent package (pkg:///).
- Returns:
The path as a string
- getResolvedFilePath()
Get the path of the resource relatively to its parent package (SBSDocument)
- Returns:
The path as a string
- getResourceTypeEnum()
- Returns:
the resource type as a
ResourceTypeEnumif defined, None otherwise
- getSceneInfoOptions()
Get all the options related to the 3D Scene information on this resource
- Returns:
a list of
SBSOption
- getSceneOptions()
Get all the options related to the 3D Scene on this resource
- Returns:
a list of
SBSOption
- getUidIsUsed(aUID)
Check if the given uid is already used in the context of this SBSObject.
- Parameters:
aUID (str) – UID to check
- Returns:
True if the uid is already used, False otherwise
- Raise:
AttributeError if the function getUidIsUsed in not properly overloaded on this SBSObject
- static isAllowedExtension(aExtension)
Check if the given extension is allowed for this type of resource
- Parameters:
aResourceType (
ResourceTypeEnumor str) – the kind of resource to consideraExtension (str) – the extension to check (ex: ‘.png’)
- Returns:
True if this extension is allowed for this kind of resource, False otherwise
- isLinked()
- Returns:
True if the resource is just linked with its path to the document (by opposition to imported)
- resolveDependency(aSBSDocument)
Allow to resolve the dependency of the resource on the root package that contains it.
- Parameters:
aSBSDocument (
SBSDocument) – The root document
- setAttribute(aAttributeIdentifier, aAttributeValue)
Set the given attribute
- Parameters:
aAttributeIdentifier (
AttributesEnum) – The attribute identifier to setaAttributeValue (str) – The attribute value to set
- setAttributes(aAttributes)
Set the given attributes
- Parameters:
aAttributes (dictionary in the format {
AttributesEnum: value}) – The attributes to set
- setBakingParameters(aBakingParameters)
Set the given baking parameters on this resource. The function converts the baking parameters into a list of SBSOptions, as saved in .sbs format. All the previous options related to Baking Parameters will be removed before creating the new ones. Raise an exception if the resource is not a Scene.
- Parameters:
aBakingParameters (
BakingParameters) – The baking parameters to set- Returns:
Nothing
- Raise:
api_exceptions.SBSImpossibleActionError
- setColorSpace(aColorSpace, aContext)
Set colorspace value to apply to the resource bitmap :param aColorSpace: str colorspace value :param aContext: str colorspace value :type aContext: aContext
Context:return:
- setCookedFormat(aCookedFormat)
- setOptions(aOptions)
- setPremultipliedAlpha(aIsPremultipliedAlpha)
- setResourceIsBakingOutput(aBakedSceneResource, aBaker)
Declare this Bitmap resource as the output of a Baking process
- Parameters:
aBakedSceneResource (
SBSResourceScene) – The scene resource used to bake mapsaBaker (
BakerEnumor str) – The baker used (as a BakerEnum or an identifier, for instance ‘Curvature Map from Mesh [2]’)
- Returns:
- class substance.resource.SBSSceneMaterialMapEntry(aSceneMaterialName='', aUVSetMaterialMapList=None)
Bases:
SBSObjectClass that contains the description of the affections for a given material of the
SBSResourceScene- Members:
mSceneMaterialName (str): the affected material name.
mUVSetMaterialMapList (list of
SBSUVSetMaterialMap): a list that describe the affectations by UV-set
- parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
- write(aSBSWriter, aXmlNode)
Write recursively the content of the SBSObject into the given xml node.
- Parameters:
aSBSWriter (
SBSWriter) – the substance writeraXmlNode (
xml.etree.ElementTree) – the xml node to fill
- getAllUVTilesAssociatedToGraph(aGraphPath, aUVTileFormat=sbsenum.UVTileFormat.UDIM, aUVSet=0)
Get the list of UV-tiles associated to the given graph internal path (pkg://…), for the given UV-set.
- Parameters:
aGraphPath (str) – The internal path of the graph to consider (pkg://…)
aUVTileFormat (
UVTileFormat, optional) – The format desired for the UV-tiles. Default to UDIMaUVSet (int, optional) – The index of the UV-set to consider. Default to 0
- Returns:
the list of UV-tiles in the expected format
- getUVSetMaterialMap(aUVSet=0)
Get the uvSetMaterialMap corresponding to the given UV-set number, for the given UV-set.
- Parameters:
aUVSet (int, optional) – The index of the UV-set to consider. Default to 0
- Returns:
a
SBSUVSetMaterialMapobject if found, None otherwise
- getUVSetMaterialMapEntry(aUVTile, aUVSet=0)
Get the uvSetMaterialMapEntry corresponding to the given UV-tile and UV-set, for the given UV-set.
- Parameters:
aUVTile (str) – Id of the UV-tile to get, as saved in the .sbs format (‘0x0’ for instance), or ‘all’ to ge the material map entry corresponding to all UV-tiles
aUVSet (int, optional) – The index of the UV-set to consider. Default to 0
- Returns:
a
SBSUVSetMaterialMapEntryif found, None otherwise
- getUVSetMaterialMapEntries(aUVSet=0)
Get the list of SBSUVSetMaterialMapEntry in this SBSUVSetMaterialMap, for the given UV-set.
- Parameters:
aUVSet (int, optional) – The index of the UV-set to consider. Default to 0
- Returns:
a list of
SBSUVSetMaterialMapEntry
- assignDefaultSBSGraph(aGraphPath, aUVSet=0)
Assign the given SBSGraph as the default for all UV-tiles.
- Parameters:
aGraphPath (str) – The compositing graph to assign, given its internal path (pkg:///myGraph)
aUVSet (int, optional) – The index of the UV-set to modify. Default to 0
- Returns:
the
SBSUVSetMaterialMapEntrycorresponding to the assignment
- assignSBSGraphToUVTile(aGraphPath, aUVTile, aUVSet=0)
Assign the given UV-tile to the given SBSGraph, for the given UV-set.
- Parameters:
aGraphPath (str) – The compositing graph to assign, given its internal path (pkg:///myGraph)
aUVTile (str, list or tuple) – The UV-tile to affect (different format accepted: ‘UDIM’, ‘u{U}_v{V}’, ‘{U}x{V}’, [U,V], (U,V) ), or ‘all’ to assign this graph to all UV-tiles
aUVSet (int, optional) – The index of the UV-set to modify. Default to 0
- Returns:
the
SBSUVSetMaterialMapEntrycorresponding to the assignment
- assignSBSGraphToUVTiles(aGraphPath, aUVTileList, aUVSet=0)
Assign the given list of UV-tile to the given SBSGraph, for the given UV-set.
- Parameters:
aGraphPath (str) – The compositing graph to assign, given its internal path (pkg:///myGraph)
aUVTileList (list) – The list of UV-tiles to affect (different format accepted: ‘UDIM’, ‘u{U}_v{V}’, ‘{U}x{V}’, [U,V], (U,V) )
aUVSet (int, optional) – The index of the UV-set to modify. Default to 0
- Returns:
the list of
SBSUVSetMaterialMapEntrycorresponding to the assignments
- removeAllAssignationsToGraph(aGraphPath, aUVSet=0)
Remove all the entries (
SBSUVSetMaterialMapEntry) associated to the given graph, in the given UV-set.- Parameters:
aGraphPath (str) – The internal path of the graph to consider (pkg://…)
aUVSet (int, optional) – The index of the UV-set to modify. Default to 0
- Returns:
the number of entries removed
- removeDefaultUVTileAssignation(aUVSet=0)
Remove the entry (
SBSUVSetMaterialMapEntry) associated by default, in the given UV-set.- Parameters:
aUVSet (int, optional) – The index of the UV-set to modify. Default to 0
- Returns:
True if the UV-tile is found and removed, False otherwise
- removeUVTileAssignation(aUVTile, aUVSet=0)
Remove the entry (
SBSUVSetMaterialMapEntry) associated to the given UV-tile, in the given UV-set.- Parameters:
aUVTile (string, list or tuple) – The UV-tile to look for (different format accepted: ‘UDIM’, ‘u{U}_v{V}’, ‘{U}x{V}’, [U,V], (U,V) ), or ‘all’ to look for the default assignation
aUVSet (int, optional) – The index of the UV-set to modify. Default to 0
- Returns:
True if the UV-tile is found and removed, False otherwise
- removeUVTilesAssignation(aUVTileList, aUVSet=0)
Remove the entries (
SBSUVSetMaterialMapEntry) associated to the given UV-tile list, in the given UV-set.- Parameters:
aUVTileList (list) – The list of UV-tile to look for (different format accepted: ‘UDIM’, ‘u{U}_v{V}’, ‘{U}x{V}’, [U,V], (U,V) )
aUVSet (int, optional) – The index of the UV-set to modify. Default to 0
- Returns:
the number of entries removed
- equals(other)
Check if this SBSObject is equivalent to the other SBSObject. Some members may be excluded from this check, the UIDs or GUILayout for instance.
- getUidIsUsed(aUID)
Check if the given uid is already used in the context of this SBSObject.
- Parameters:
aUID (str) – UID to check
- Returns:
True if the uid is already used, False otherwise
- Raise:
AttributeError if the function getUidIsUsed in not properly overloaded on this SBSObject
- class substance.resource.SBSUVSetMaterialMap(aEntries=None, aOptionsByGraph=None)
Bases:
SBSObjectClass that describe the affectations for a given UV-set
- Members:
mEntries (list of
SBSUVSetMaterialMapEntry): a list that associates a graph to one or more UV-tilemOptionsByGraph (list of
SBSOptionsByUrlMapEntry, optional): a map that lists options for some graph edited in the context of the currentSBSUVSetMaterialMap.
- parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
- write(aSBSWriter, aXmlNode)
Write recursively the content of the SBSObject into the given xml node.
- Parameters:
aSBSWriter (
SBSWriter) – the substance writeraXmlNode (
xml.etree.ElementTree) – the xml node to fill
- assignDefaultSBSGraph(aGraphPath)
Assign the given SBSGraph as the default for all UV-tiles.
- Parameters:
aGraphPath (str) – The compositing graph to assign, given its internal path (pkg:///myGraph)
- Returns:
the
SBSUVSetMaterialMapEntrycorresponding to the assignment
- assignSBSGraphToUVTile(aGraphPath, aUVTile)
Assign the given SBSGraph to the given UV-tile.
- Parameters:
aGraphPath (str) – The compositing graph to assign, given its internal path (pkg:///myGraph)
aUVTile (str, list or tuple) – The UV-tile to affect (different format accepted: ‘UDIM’, ‘u{U}_v{V}’, ‘{U}x{V}’, [U,V], (U,V) ), or ‘all’ to assign this graph to all UV-tiles
- Returns:
the
SBSUVSetMaterialMapEntrycorresponding to the assignment
- assignSBSGraphToUVTiles(aGraphPath, aUVTileList)
Assign the given SBSGraph to the given list of UV-tile.
- Parameters:
aGraphPath (str) – The compositing graph to assign, given its internal path (pkg:///myGraph)
aUVTileList (list) – The list of UV-tiles to affect (different format accepted: ‘UDIM’, ‘u{U}_v{V}’, ‘{U}x{V}’, [U,V], (U,V) )
- Returns:
the list of
SBSUVSetMaterialMapEntrycorresponding to the assignments
- getAllEntriesAssociatedToGraph(aGraphPath)
Get the list of entries associated to the given graph internal path (pkg://…)
- Parameters:
aGraphPath (str) – The internal path of the graph to consider (pkg://…)
- Returns:
a list of
SBSUVSetMaterialMapEntry
- getAllUVTilesAssociatedToGraph(aGraphPath, UVTileFormat=sbsenum.UVTileFormat.UDIM)
Get the list of UV-tiles associated to the given graph internal path (pkg://…)
- Parameters:
aGraphPath (str) – The internal path of the graph to consider (pkg://…)
aUVTileFormat (
UVTileFormat, optional) – The format desired for the UV-tiles. Default to UDIM
- Returns:
the list of UV-tiles in the expected format
- getUVSetMaterialMapEntries()
Get the list of SBSUVSetMaterialMapEntry in this SBSUVSetMaterialMap
- Returns:
a list of
SBSUVSetMaterialMapEntry
- getUVSetMaterialMapEntry(aUVTile)
Get the SBSUVSetMaterialMapEntry corresponding to this UVTile
- Parameters:
aUVTile (string, list or tuple) – The UV-tile to look for (different format accepted: ‘UDIM’, ‘u{U}_v{V}’, ‘{U}x{V}’, [U,V], (U,V) ), or ‘all’ to look for the default assignation
- Returns:
a
SBSUVSetMaterialMapEntryif found, None otherwise
- getGraphAssignedByDefault()
Get the path of the graph assigned by default to all UV-tiles
- Returns:
the graph internal path as a string if found, None otherwise
- getGraphAssignedToUVTile(aUVTile)
Get the path of the graph assigned to this UVTile
- Parameters:
aUVTile (string, list or tuple) – The UV-tile to look for (different format accepted: ‘UDIM’, ‘u{U}_v{V}’, ‘{U}x{V}’, [U,V], (U,V) )
- Returns:
the graph internal path as a string if found, None otherwise
- removeAllAssignationsToGraph(aGraphPath)
Remove all the entries (
SBSUVSetMaterialMapEntry) associated to the given graph- Parameters:
aGraphPath (str) – The internal path of the graph to consider (pkg://…)
- Returns:
the number of entries removed
- removeDefaultUVTileAssignation()
Remove the entry (
SBSUVSetMaterialMapEntry) associated by default- Returns:
True if the UV-tile is found and removed, False otherwise
- removeUVTileAssignation(aUVTile)
Remove the entry (
SBSUVSetMaterialMapEntry) associated to the given UV-tile- Parameters:
aUVTile (string, list or tuple) – The UV-tile to look for (different format accepted: ‘UDIM’, ‘u{U}_v{V}’, ‘{U}x{V}’, [U,V], (U,V) ), or ‘all’ to look for the default assignation
- Returns:
True if the UV-tile is found and removed, False otherwise
- removeUVTilesAssignation(aUVTileList)
Remove the entries (
SBSUVSetMaterialMapEntry) associated to the given UV-tile list- Parameters:
aUVTileList (list) – The list of UV-tile to look for (different format accepted: ‘UDIM’, ‘u{U}_v{V}’, ‘{U}x{V}’, [U,V], (U,V) )
- Returns:
the number of entries removed
- equals(other)
Check if this SBSObject is equivalent to the other SBSObject. Some members may be excluded from this check, the UIDs or GUILayout for instance.
- getUidIsUsed(aUID)
Check if the given uid is already used in the context of this SBSObject.
- Parameters:
aUID (str) – UID to check
- Returns:
True if the uid is already used, False otherwise
- Raise:
AttributeError if the function getUidIsUsed in not properly overloaded on this SBSObject
- class substance.resource.SBSUVSetMaterialMapEntry(aUVTiles='all', aMaterial=None)
Bases:
SBSObjectClass that associate a graph to one or more UV-tile
- Members:
mUVTiles (str): a formatted string that list the UV-tiles of this entry. Might be “all” or the UV-tile coordinate formatted as “{U}x{V}”
mMaterial (
SBSUVSetMaterial): the description of the affected material.
- parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
- write(aSBSWriter, aXmlNode)
Write recursively the content of the SBSObject into the given xml node.
- Parameters:
aSBSWriter (
SBSWriter) – the substance writeraXmlNode (
xml.etree.ElementTree) – the xml node to fill
- getGraphPath()
Get the graph internal path associated to this UV-tile
- Returns:
the path as a string if defined, None otherwise
- equals(other)
Check if this SBSObject is equivalent to the other SBSObject. Some members may be excluded from this check, the UIDs or GUILayout for instance.
- getUidIsUsed(aUID)
Check if the given uid is already used in the context of this SBSObject.
- Parameters:
aUID (str) – UID to check
- Returns:
True if the uid is already used, False otherwise
- Raise:
AttributeError if the function getUidIsUsed in not properly overloaded on this SBSObject
- class substance.resource.SBSUVSetMaterial(aSBSGraphUrl='')
Bases:
SBSObjectClass that contains the description of the affected material. It only contains a reference to a graph at the moment, but it may be extended in the future.
- Members:
mSBSGraphUrl (str): path of the graph definition.
- parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
- write(aSBSWriter, aXmlNode)
Write recursively the content of the SBSObject into the given xml node.
- Parameters:
aSBSWriter (
SBSWriter) – the substance writeraXmlNode (
xml.etree.ElementTree) – the xml node to fill
- equals(other)
Check if this SBSObject is equivalent to the other SBSObject. Some members may be excluded from this check, the UIDs or GUILayout for instance.
- getUidIsUsed(aUID)
Check if the given uid is already used in the context of this SBSObject.
- Parameters:
aUID (str) – UID to check
- Returns:
True if the uid is already used, False otherwise
- Raise:
AttributeError if the function getUidIsUsed in not properly overloaded on this SBSObject
- class substance.resource.SBSOptionsByUrlMapEntry(aURL='', aOptions=None)
Bases:
SBSObjectClass that list options for a graph in the context of the parent
SBSUVSetMaterialMap.- Members:
mURL (str): path of the graph definition to which the options apply.
mOptions (list of
SBSOption, optional): the options associated with this graph in the current context.
- parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
- write(aSBSWriter, aXmlNode)
Write recursively the content of the SBSObject into the given xml node.
- Parameters:
aSBSWriter (
SBSWriter) – the substance writeraXmlNode (
xml.etree.ElementTree) – the xml node to fill
- equals(other)
Check if this SBSObject is equivalent to the other SBSObject. Some members may be excluded from this check, the UIDs or GUILayout for instance.
- getUidIsUsed(aUID)
Check if the given uid is already used in the context of this SBSObject.
- Parameters:
aUID (str) – UID to check
- Returns:
True if the uid is already used, False otherwise
- Raise:
AttributeError if the function getUidIsUsed in not properly overloaded on this SBSObject