User Guide Cancel

sbsparser | Substance 3D Automation ToolKit

sbsparser

Module sbsparser provides the class SBSParser which allows the deserialization of a .sbs file into a SBSDocument

All derived SBSObject have a parse function with the same signature than on the base class SBSObject: common_interface.SBSObject.parse()

class sbsparser.FileTypeEnum
class sbsparser.FileTypeEnum
class sbsparser.FileTypeEnum

Bases: object

Enumeration of different document types SBSParser can read

SBS = 0
SBSAR = 1
SBSPRS = 2
SBSPRJ = 3
SBS = 0 SBSAR = 1 SBSPRS = 2 SBSPRJ = 3
SBS    = 0 
SBSAR  = 1 
SBSPRS = 2 
SBSPRJ = 3
SBS = 0
SBS = 0
SBS = 0
SBSAR = 1
SBSAR = 1
SBSAR = 1
SBSPRJ = 3
SBSPRJ = 3
SBSPRJ = 3
SBSPRS = 2
SBSPRS = 2
SBSPRS = 2
class sbsparser.SBSParser(aFileAbsPath, aContext, aFileType=0)
class sbsparser.SBSParser(aFileAbsPath, aContext, aFileType=0)
class sbsparser.SBSParser(aFileAbsPath, aContext, aFileType=0)

Bases: object

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

getAllSBSElementsIn(aContext, aDirAbsPath, aXmlNode, aTagName, aSBSClass)
getAllSBSElementsIn(aContext, aDirAbsPath, aXmlNode, aTagName, aSBSClass)
getAllSBSElementsIn(aContext, aDirAbsPath, aXmlNode, aTagName, aSBSClass)

Search for all children with the given tag under the given xmlNode, and parse them recursively

………

Returns: The list of SBS objects corresponding to the given tag, or [] if not found
getAllSBSElementsInMulti(aContext, aDirAbsPath, aXmlNode, aTagConstructorDict)
getAllSBSElementsInMulti(aContext, aDirAbsPath, aXmlNode, aTagConstructorDict)
getAllSBSElementsInMulti(aContext, aDirAbsPath, aXmlNode, aTagConstructorDict)

Search for all children with various names under the given xmlNode, and parse them recursively using the parse function from the tag constructor dict

………

Returns: The list of SBS objects corresponding to the given tag, or [] if not found
getAllXmlElementsUnder(aXmlElement, aTagName)
getAllXmlElementsUnder(aXmlElement, aTagName)
getAllXmlElementsUnder(aXmlElement, aTagName)

Get the xmlElements with the given tagName under the given xmlElement:

………

Returns: A list of xmlElement
getRootNode()
getRootNode()
getRootNode()

Get the .sbs file root node :return: element of type etree

getSBSElementIn(aContext, aDirAbsPath, aXmlNode, aTagName, aSBSClass)
getSBSElementIn(aContext, aDirAbsPath, aXmlNode, aTagName, aSBSClass)
getSBSElementIn(aContext, aDirAbsPath, aXmlNode, aTagName, aSBSClass)

Search for first child with the given tag under the given xmlNode, and parse them recursively

………

Returns: SBS object corresponding to the given tag, or None if not found
getSBSElementList(aContext, aDirAbsPath, aXmlNode, aTagName, aChildTagName, aSBSClass)
getSBSElementList(aContext, aDirAbsPath, aXmlNode, aTagName, aChildTagName, aSBSClass)
getSBSElementList(aContext, aDirAbsPath, aXmlNode, aTagName, aChildTagName, aSBSClass)

Search for all children with the tag childtagname under the tag tagname under the given xmlNode, and parse them recursively:

………

Returns: The list of SBS objects corresponding to the tag childtagname, or [] if not found
getXmlElementAttribValue(aXmlElement, aAttributeName)
getXmlElementAttribValue(aXmlElement, aAttributeName)
getXmlElementAttribValue(aXmlElement, aAttributeName)

Get the value of the attribute with the given name on the given xmlElement:

Returns: The attribute value
getXmlElementVAttribValue(aXmlElementParent, aChildName)
getXmlElementVAttribValue(aXmlElementParent, aChildName)
getXmlElementVAttribValue(aXmlElementParent, aChildName)

Get the value of the attribute ‘v’ on the given child element under xmlElementParent:

Returns: The attribute value
getXmlFilePathValue(aXmlElementParent, aChildName)
getXmlFilePathValue(aXmlElementParent, aChildName)
getXmlFilePathValue(aXmlElementParent, aChildName)

Get the value of the attribute ‘v’ on the given child element under xmlElementParent: … Then convert attribute path given as a relative path. :return: The attribute value

isValid()
isValid()
isValid()

Check if the package is valid

Returns: True if the package is valid, False otherwise
parseSBSNode(aContext, aDirAbsPath, aXmlNode, aTagName, aSBSClass)
parseSBSNode(aContext, aDirAbsPath, aXmlNode, aTagName, aSBSClass)
parseSBSNode(aContext, aDirAbsPath, aXmlNode, aTagName, aSBSClass)

Search for a child node with the given tag in the given XmlNode, and parse the corresponding SBS object

Returns: the SBSObject parsed, or None if not found
parseSBSNodeFromXmlNode(aContext, aDirAbsPath, aXmlNode, aSBSClass)
parseSBSNodeFromXmlNode(aContext, aDirAbsPath, aXmlNode, aSBSClass)
parseSBSNodeFromXmlNode(aContext, aDirAbsPath, aXmlNode, aSBSClass)

Search for a child node with the given tag in the given XmlNode, and parse the corresponding SBS object

Returns: the SBSObject parsed, or None if not found

Get help faster and easier

New user?