values | Substance 3D Automation ToolKit

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.

values

Module values provides the definition of the classes relative to the value of parameters in the .sbs file: - SBSConstantValue - SBSOption - SBSIcon - SBSAttributes

 class sbscommon.values.SBSAttributes(aCategory=None, aLabel=None, aAuthor=None, aAuthorURL=None, aTags=None, aDescription=None, aUserTags=None, aIcon=None, aHideInLibrary=None, aPhysicalSize=None)  

Bases: pysbs.common_interfaces.sbsobject.SBSObject

Class that contains information on attributes as defined in a .sbs file

Members:
  • mAuthor (str, optional): author information.
  • mAuthorURL (str, optional): author url.
  • mCategory (str, optional): data category. Slash separated strings.
  • mDescription (str, optional): textual description.
  • mHideInLibrary (str, optional): whether or not the object is hidden in library.
  • mIcon (SBSIcon, optional): icon.
  • mLabel (str, optional): user label.
  • mPhysicalSize (str, optional): the physical size (float3) of a graph.
  • mTags (str, optional): tags as comma separated strings.
  • mUserTags (str, optional): user information useful for the 3D engine using the substance engine (UNICODE string).
 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.

Parameters:other (SBSObject) – The SBSObject to compare to
Returns:True if the two SBSObject are similar according to their definition.
 getAttribute(aAttributeIdentifier)  

Get the given attribute value

Parameters:aAttributeIdentifier (AttributesEnum) – the attribute identifier
Returns:the attribute value if defined, None otherwise
 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
 hasAttributes()  
Check if at least one attribute is defined among:
‘category’, ‘label’, ‘author’, ‘authorURL’, ‘tags’, ‘description’, ‘usertags’, ‘icon’, ‘hideInLibrary’, ‘physicalSize’
Returns:True if at least one attribute is defined, False otherwise
 parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)  

Parse recursively the given xml node to retrieve the content of the SBSObject.

Parameters:
  • aContext (Context) – execution context
  • aDirAbsPath (str) – the absolute directory containing the current parsed package (.sbs file)
  • aSBSParser (SBSParser) – the substance parser
  • aXmlNode (xml.etree.ElementTree) – the xml node to parse
 setAttribute(self, aAttributeIdentifier, aAttributeValue)  

Set the given attribute value

Parameters:
  • aAttributeIdentifier (AttributesEnum) – the attribute identifier
  • aAttributeValue (str or SBSIcon) – the attribute value
  • aParentObject (SBSAttribute) – the object containing this attribute
 setAttributes(aAttributes, aParentObject)  

Set the given attributes

Parameters:
  • aAttributes (dictionary in the format {AttributesEnum : value}) – The attributes to set
  • aParentObject (SBSAttribute) – the object containing this attribute
 write(aSBSWriter, aXmlNode)  

Write recursively the content of the SBSObject into the given xml node.

Parameters:
  • aSBSWriter (SBSWriter) – the substance writer
  • aXmlNode (xml.etree.ElementTree) – the xml node to fill
 class sbscommon.values.SBSConstantValue(aConstantValue=None, aTagName='')  

Bases: pysbs.common_interfaces.sbsobject.SBSObject

Class that contains information on a constant value as defined in a .sbs file

Members:
  • mConstantValue (str): simple constant definition of a parameter.
  • mTagName (str): the tag name in the .sbs file, in the format ‘constantvalue’
 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.

Parameters:other (SBSObject) – The SBSObject to compare to
Returns:True if the two SBSObject are similar according to their definition.
 getType()  

Get the type of this constant value

Returns:The type as a ParamTypeEnum if success, None otherwise
 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
 getValue()  

Get the value of this constant value.

Returns:The value as a string if defined, None otherwise
 static isValidValue(aType, aValue)  

setConstantValue(aType, aValue, aInt1 = False) Set the constant value to the given value, and set the tagname accordingly to the type of the value.

Parameters:
  • aType (ParamTypeEnum) – type of the value
  • aValue (str) – the value to set
  • aInt1 (bool) – True if the tag name must be ‘Int1’ instead of ‘Int32’ in the case of a value INTEGER1. Default to False
 parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)  

Parse recursively the given xml node to retrieve the content of the SBSObject.

Parameters:
  • aContext (Context) – execution context
  • aDirAbsPath (str) – the absolute directory containing the current parsed package (.sbs file)
  • aSBSParser (SBSParser) – the substance parser
  • aXmlNode (xml.etree.ElementTree) – the xml node to parse
 setConstantValue(aType, aValue, aInt1 = False)  

Set the constant value to the given value, and set the tagname accordingly to the type of the value.

Parameters:
  • aType (ParamTypeEnum) – type of the value
  • aValue (str) – the value to set
  • aInt1 (bool) – True if the tag name must be ‘Int1’ instead of ‘Int32’ in the case of a value INTEGER1. Default to False
 updateConstantValue(aValue)  

Update the value.

Parameters:aValue (str) – the value to set
 write(aSBSWriter, aXmlNode)  

Write recursively the content of the SBSObject into the given xml node.

Parameters:
  • aSBSWriter (SBSWriter) – the substance writer
  • aXmlNode (xml.etree.ElementTree) – the xml node to fill
 class sbscommon.values.SBSIcon(aDataLength='', aFormat='', aStrdata='')  

Bases: pysbs.common_interfaces.sbsobject.SBSObject

Class that contains information on an icon as defined in a .sbs file. An icon can be added in the attributes section of a graph.

Members:
  • mDataLength (str): length of the icon image data.
  • mFormat (str): icon format.
  • mStrdata (str): icon image data.
 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.

Parameters:other (SBSObject) – The SBSObject to compare to
Returns:True if the two SBSObject are similar according to their definition.
 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
 parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)  

Parse recursively the given xml node to retrieve the content of the SBSObject.

Parameters:
  • aContext (Context) – execution context
  • aDirAbsPath (str) – the absolute directory containing the current parsed package (.sbs file)
  • aSBSParser (SBSParser) – the substance parser
  • aXmlNode (xml.etree.ElementTree) – the xml node to parse
 write(aSBSWriter, aXmlNode)  

Write recursively the content of the SBSObject into the given xml node.

Parameters:
  • aSBSWriter (SBSWriter) – the substance writer
  • aXmlNode (xml.etree.ElementTree) – the xml node to fill
 class sbscommon.values.SBSOption(aName='', aValue='')  

Bases: pysbs.common_interfaces.sbsobject.SBSObject

Class that contains information on an option that can appear in a substance graph / compNode

Members:
  • mName (str): name of the option
  • mValue (str): value of the option
 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.

Parameters:other (SBSObject) – The SBSObject to compare to
Returns:True if the two SBSObject are similar according to their definition.
 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
 parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)  

Parse recursively the given xml node to retrieve the content of the SBSObject.

Parameters:
  • aContext (Context) – execution context
  • aDirAbsPath (str) – the absolute directory containing the current parsed package (.sbs file)
  • aSBSParser (SBSParser) – the substance parser
  • aXmlNode (xml.etree.ElementTree) – the xml node to parse
 write(aSBSWriter, aXmlNode)  

Write recursively the content of the SBSObject into the given xml node.

Parameters:
  • aSBSWriter (SBSWriter) – the substance writer
  • aXmlNode (xml.etree.ElementTree) – the xml node to fill
 class sbscommon.values.SBSTree(aTreeElements=None)  

Bases: pysbs.common_interfaces.sbsobject.SBSObject

Tree of options in the resource scene

Members:
  • mTreeElements (collections.OrderedDict): Ordered dict of options with their name as ey
 asOptionList()  

Recursively turns a tree into a list of options with paths. The options will have a name on the form a/b/c and a value representing the string at the leaf :return: [SBSOption]

 asStringList()  

Returns the content of a tree representing a vector (meaning it has a size element and the indices as keys) :return: [str]

 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.

Parameters:other (SBSObject) – The SBSObject to compare to
Returns:True if the two SBSObject are similar according to their definition.
 getChildByName(aName)  

Returns a child node based on its name. Returns None if the child doesn’t exist :param aName: The name of the child to ask for :type aName: str :return: SBSTree SBSTreeList, SBSTreeStr, SBSTreeUrl or None if not found

 getChildByPath(aPath)  

Queries a child by a path in a hierarchy of SBSTree and nodes :param aPath: The path to the child queried in the format a/b/c where a and b are SBStrees and c is the name of the element asked for :type aPath: str :return: SBSTree SBSTreeList, SBSTreeStr, SBSTreeUrl or None if not found

 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
 parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)  

Parse recursively the given xml node to retrieve the content of the SBSObject.

Parameters:
  • aContext (Context) – execution context
  • aDirAbsPath (str) – the absolute directory containing the current parsed package (.sbs file)
  • aSBSParser (SBSParser) – the substance parser
  • aXmlNode (xml.etree.ElementTree) – the xml node to parse
 setChildByPath(aPath, aValue, asURL=False)  

Sets a child by a path in a hierarchy of SBSTree and nodes :param aPath: The path to the child queried in the format a/b/c where a and b are SBStrees and c is the name of the element to set If the element set already exists it will be overwritten by the new value :type aPath: str :param aValue: a string representing the value to set :type aValue: str :param asURL: Optional parameter to say whether the value should be created as an SBSTreeStr or SBSTreeUrl :type asURL: bool

 write(aSBSWriter, aXmlNode)  

Write recursively the content of the SBSObject into the given xml node.

Parameters:
  • aSBSWriter (SBSWriter) – the substance writer
  • aXmlNode (xml.etree.ElementTree) – the xml node to fill
 class sbscommon.values.SBSTreeList(aName='', aElements=None)  

Bases: pysbs.common_interfaces.sbsobject.SBSObject

List of options in the resource scene tree. Currently used in resource scenes

Members:
  • mName (str): name of the option
  • aElements (list): a list of options to populate the list with
 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.

Parameters:other (SBSObject) – The SBSObject to compare to
Returns:True if the two SBSObject are similar according to their definition.
 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
 parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)  

Parse recursively the given xml node to retrieve the content of the SBSObject.

Parameters:
  • aContext (Context) – execution context
  • aDirAbsPath (str) – the absolute directory containing the current parsed package (.sbs file)
  • aSBSParser (SBSParser) – the substance parser
  • aXmlNode (xml.etree.ElementTree) – the xml node to parse
 write(aSBSWriter, aXmlNode)  

Write recursively the content of the SBSObject into the given xml node.

Parameters:
  • aSBSWriter (SBSWriter) – the substance writer
  • aXmlNode (xml.etree.ElementTree) – the xml node to fill
 class sbscommon.values.SBSTreeStr(aName='', aValue='')  

Bases: pysbs.common_interfaces.sbsobject.SBSObject

A string option. Currently used in resource scenes

Members:
  • mName (str): name of the option
  • mValue (str): value of the option
 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.

Parameters:other (SBSObject) – The SBSObject to compare to
Returns:True if the two SBSObject are similar according to their definition.
 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
 parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)  

Parse recursively the given xml node to retrieve the content of the SBSObject.

Parameters:
  • aContext (Context) – execution context
  • aDirAbsPath (str) – the absolute directory containing the current parsed package (.sbs file)
  • aSBSParser (SBSParser) – the substance parser
  • aXmlNode (xml.etree.ElementTree) – the xml node to parse
 write(aSBSWriter, aXmlNode)  

Write recursively the content of the SBSObject into the given xml node.

Parameters:
  • aSBSWriter (SBSWriter) – the substance writer
  • aXmlNode (xml.etree.ElementTree) – the xml node to fill
 class sbscommon.values.SBSTreeUrl(aName='', aValue='')  

Bases: pysbs.common_interfaces.sbsobject.SBSObject

A url option. Currently used in resource scenes

Members:
  • mName (str): name of the option
  • mValue (str): value of the option
 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.

Parameters:other (SBSObject) – The SBSObject to compare to
Returns:True if the two SBSObject are similar according to their definition.
 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
 parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)  

Parse recursively the given xml node to retrieve the content of the SBSObject.

Parameters:
  • aContext (Context) – execution context
  • aDirAbsPath (str) – the absolute directory containing the current parsed package (.sbs file)
  • aSBSParser (SBSParser) – the substance parser
  • aXmlNode (xml.etree.ElementTree) – the xml node to parse
 write(aSBSWriter, aXmlNode)  

Write recursively the content of the SBSObject into the given xml node.

Parameters:
  • aSBSWriter (SBSWriter) – the substance writer
  • aXmlNode (xml.etree.ElementTree) – the xml node to fill

Adobe, Inc.

Get help faster and easier

New user?