- Substance 3D home
- Home
- Command Line Tools
- Command Line overview
- sbsbaker
- sbscooker
- sbsmtools
- sbsmutator
- sbsrender
- sbsupdater
- Command Line overview
- Pysbs - Python API
- Pysbs - Python API overview
- Getting started
- General topics
- Examples
- API Content
- API Content overview
- Substance definitions
- Common interfaces
- compnode
- context projectmgr
- graph
- mdl
- modelgraphindex
- modelannotationnames
- modelgraph
- modelgraphgenerator
- modelgraphimplementation
- modelnodenames
- modeloperand
- modulegraphindex
- moduleannotation
- moduleconnection
- modulegraph
- modulegraphgenerator
- modulegraphimplementation
- modulegraphlibrary
- modulegraphregister
- modulenode
- modulenodeimplementation
- modulenodeinstance
- moduleoperand
- moduleoutputbridging
- moduleparaminput
- params
- projectmgrdoc
- sbsarchive
- sbscommon
- sbspreset
- sbsproject
- substance
- Libraries
- sbsenum
- sbslibrary
- sbsbakerslibrary
- Helpers
- Execution context
- API Change log
- Samples
- Setup and Getting Started
- Integrations
- Substance Maya toolset
- Changelog overview
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
Bases: object
Enumeration of different document types SBSParser can read
SBS = 0 SBSAR = 1 SBSPRS = 2 SBSPRJ = 3
SBS = 0
SBSAR = 1
SBSPRJ = 3
SBSPRS = 2
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)
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)
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)
Get the xmlElements with the given tagName under the given xmlElement:
………
Returns: | A list of xmlElement |
---|
getRootNode()
Get the .sbs file root node :return: element of type etree
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)
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)
Get the value of the attribute with the given name on the given xmlElement:
Returns: | The attribute value |
---|
getXmlElementVAttribValue(aXmlElementParent, aChildName)
Get the value of the attribute ‘v’ on the given child element under xmlElementParent:
…
Returns: | The attribute value |
---|
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()
Check if the package is valid
Returns: | True if the package is valid, False otherwise |
---|
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)
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 |
---|