- 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
mdllibclasses
Module mdllibclasses provides all the classes used by the MDL library for the definition of all MDL entities. In particular, it defines the classes:
class mdl.mdllibclasses.MDLAnnotationDef(aPath='', aParameters=None)
Bases: mdl.mdllibclasses.MDLLibObject
This class contains the definition of a MDL node annotation.
- Members:
- mPath (str): path of the mdl node
- mParameters (list of
MDLNodeDefParamValue
): the parameters available on this node.
fromJSON(jsonData)
Build the object from the given JSON data
Parameters: | jsonData (dict) – JSON data |
---|
fromMDLAnnotation(aAnnotation)
Build the MDLAnnotationDef from a MDLAnnotation object
Parameters: | aAnnotation (MDLAnnotation ) – The operand to use to build this parameter |
---|
toMDLAnnotation()
Build the MDLAnnotation from this MDLAnnotationDef object
Returns: | a MDLAnnotation object |
---|
class mdl.mdllibclasses.MDLLibObject
Bases: object
Base class of all MDL library classes.
fromJSON(jsonData)
Build the object from the given JSON data
Parameters: | jsonData (dict) – JSON data |
---|
class mdl.mdllibclasses.MDLNodeDef(aPath='', aAnnotations=None, aParameters=None, aInputs=None, aOutputs=None, aIsSelector=False, aIsMaterial=False, aIsPassthrough=False)
Bases: mdl.mdllibclasses.MDLLibObject
This class contains the definition of a MDL node.
- Members:
- mPath (str): path of the mdl node
- mAnnotations (list of
MDLAnnotation
): the annotations of the node. - mParameters (list of
MDLNodeDefParam
): the parameters available on this node. - mInputs (list of
MDLNodeDefInput
): the outputs of this node. - mOutputs (list of
MDLNodeDefOutput
): the outputs of this node. - mIsSelector (bool): Define if this node is a selector node
- mIsMaterial (bool): Define if this node is a material
- mIsPassthrough (bool): Define if this node is a passthrough node (NOTE: not an actual MDL definition)
fromJSON(jsonData)
Build the object from the given JSON data
Parameters: | jsonData (dict) – JSON data |
---|
getAllInputIdentifiers()
Get all the input identifiers as strings of this node definition
Returns: | a list of string |
---|
getAllInputs()
Get all the inputs in this node definition
Returns: | a list of MDLNodeDefInput |
---|
getAllOutputIdentifiers()
Get all the output identifiers as strings of this node definition
Returns: | a list of string |
---|
getAllOutputs()
Get all the outputs in this node definition
Returns: | a list of MDLNodeDefOutput |
---|
getAllParameterIdentifiers()
Get all the parameter identifiers as strings of this node definition
Returns: | a list of string |
---|
getAllParameters()
Get all the parameters in this node definition
Returns: | a list of MDLNodeDefParam |
---|
getDefaultOperands()
Get the list of default operands corresponding to the parameters available on this node definition
Parameters: | aCheckType (bool, optional) – True to check the default connection visibility depending on the type of the operand. Default to False |
---|---|
Returns: | a list of MDLOperand |
getFirstInputOfType(aType)
Get the first MDLInputDef with the given type.
Parameters: | aType (str) – mdl path of the required type |
---|---|
Returns: | a MDLInputDef object if found, None otherwise |
getFirstOutputOfType(aType)
Get the first MDLOutputDef with the given type.
Parameters: | aType (str) – mdl path of the required type |
---|---|
Returns: | a MDLOutputDef object if found, None otherwise |
getInput(aInput)
Get the input with the given identifier.
Parameters: | aInput (str) – The required input |
---|---|
Returns: | a MDLNodeDefInput if found, None otherwise |
getOutput(aOutput = None)
Get the output with the given identifier. If aOutput is None, return the first output if it exists.
Parameters: | aOutput (str) – The required output |
---|---|
Returns: | a MDLNodeDefOutput if found, None otherwise |
getParameter(aParameter)
Get the required parameter
Parameters: | aParameter (str) – The name of the parameter to get |
---|---|
Returns: | a MDLNodeDefParam object if found, None otherwise |
class mdl.mdllibclasses.MDLNodeDefInput(aIdentifier='input', aType=None)
Bases: mdl.mdllibclasses.MDLLibObject
This class contains the definition of a MDL node input.
- Members:
- mIdentifier (str): identifier of the output
- mType (
MDLNodeDefType
): type of the output
fromJSON(jsonData)
Build the object from the given JSON data
Parameters: | jsonData (dict) – JSON data |
---|
fromMDLInputBridging(aInputBridging, aSBSGraph)
Build the MDLNodeDefInput from a MDLInputBridging object
Parameters: | aInputBridging (MDLInputBridging ) – The operand to use to build this input |
---|
fromMDLOperand(aOperand)
Build the MDLNodeDefInput from a MDLOperand object
Parameters: | aOperand (MDLOperand ) – The operand to use to build this input |
---|
getIdentifierStr()
Gets the identifier of the input
Returns: | The identifier as a string |
---|
getType()
Get the mdl path of the type of this input
Returns: | The mdl type as a string |
---|
class mdl.mdllibclasses.MDLNodeDefOutput(aIdentifier='output', aType=None)
Bases: mdl.mdllibclasses.MDLLibObject
This class contains the definition of a MDL node output.
- Members:
- mIdentifier (str): identifier of the output
- mType (
MDLNodeDefType
): type of the output
fromJSON(jsonData)
Build the object from the given JSON data
Parameters: | jsonData (dict) – JSON data |
---|
fromMDLOutputBridging(aOutputBridging, aSBSGraph)
Build the MDLNodeDefOutput from a MDLOutputBridging object
Parameters: |
|
---|
getIdentifierStr()
Gets the identifier of the output
Returns: | The identifier as a string |
---|
getType()
Get the mdl path of the type of this output
Returns: | The mdl type as a string |
---|
class mdl.mdllibclasses.MDLNodeDefParam(aName='', aAnnotations=None, aDefaultMDLValue=None, aDefaultValue=None, aDefaultValueType=None, aTypeName='', aTypePath='', aTypeModifier='')
Bases: mdl.mdllibclasses.MDLLibObject
This class contains the definition of a MDL node parameter.
- Members:
- mName (str): name of the parameter
- mAnnotations (list of
MDLAnnotationDef
): annotations associated to this parameter - DefaultValue (str or
MDLOperand
): the default value of this parameter - mType (
MDLNodeDefType
): type of the parameter
fromJSON(jsonData)
Build the object from the given JSON data
Parameters: | jsonData (dict) – JSON data |
---|
fromMDLOperand(aOperand, copyValue=False)
Build the MDLNodeDefParam from a MDLOperand object
Parameters: |
|
---|
fromMDLParameter(aParameter, copyValue=False)
fromSBSParameter(aParameter, copyValue=False) Build the MDLNodeDefParam from a MDLParameter object
Parameters: |
|
---|
getAnnotation(aAnnotation)
Get the annotation definition of the given annotation if defined in the parameter definition
Parameters: | aAnnotation (MDLAnnotationEnum ) – The annotation to look for |
---|---|
Returns: | The annotation as a MDLAnnotationDef if found, None otherwise |
getDefaultValue()
Get the default value of this parameter
Returns: | The default value |
---|
getType()
Get the mdl path of the type of this parameter
Returns: | The mdl type as a string |
---|
toMDLOperand()
Convert this parameter definition to the appropriate MDLOperand.
Returns: | a MDLOperand |
---|
class mdl.mdllibclasses.MDLNodeDefParamValue(aName='', aValue='', aType='')
Bases: mdl.mdllibclasses.MDLLibObject
This class contains the definition of a MDL node parameter value.
- Members:
- mName (str): name of the parameter
- mValue (str): value of the parameter
- mType (str): type of the parameter
fromJSON(jsonData)
Build the object from the given JSON data
Parameters: | jsonData (dict) – JSON data |
---|
getType()
Get the mdl path of the type of this parameter
Returns: | The mdl type as a string |
---|
class mdl.mdllibclasses.MDLNodeDefType(aName='', aPath='', aModifier='auto')
Bases: mdl.mdllibclasses.MDLLibObject
This class contains the definition of a MDL type.
- Members:
- mName (str): name of the parameter
- mPath (str): value of the parameter
- mModifier (str, optional): type of the parameter. Default to ‘auto’
fromJSON(jsonData)
Build the object from the given JSON data
Parameters: | jsonData (dict) – JSON data |
---|
class mdl.mdllibclasses.MDLTypeDef(aPath='', aKind=0, aComponentType=None, aComponentCount=-1, aRowCount=-1, aColumnCount=-1, aArrayDeferredSize=False, aArraySizeIdentifier=None, aEnumValues=None, aStructMembers=None, aTextureShape=None)
Bases: mdl.mdllibclasses.MDLLibObject
This class contains the definition of a MDL type.
- Members:
- mPath (str): mdl path of the type
- mKind (
MDLTypeDefKindEnum
): kind of type (‘atomic’, ‘enum’, ‘struct’, ‘vector’, …) - mComponentType (str, optional): For compound types, mdl path of the type of component
- mComponentCount (int, optional): For compound types, the number of components required
- mRowCount (int, optional): For matrix type, the number of rows
- mColumnCount (int, optional): For matrix type, the number of columns
- mArrayDeferredSize (bool, optional): For array type, defines if the size is known or deferred
- mArraySizeIdentifier (str, optional): For array type, the size identifier
- mEnumValues (dict {key(str):value(int)}, optional: enumeration type definition
- mStructMembers (list of
MDLTypeStructMemberDef
, optional): struct type definition - mTextureShape (str, optional): For texture type, the shape of the texture
fromJSON(jsonData)
Build the object from the given JSON data
Parameters: | jsonData (dict) – JSON data |
---|
getModuleName()
Get the module name, which is the last part of the type’s mdl path
Returns: | The module name as a string |
---|
getModulePath()
Get the module path, which is the beginning of the type’s mdl path, without the last module name
Returns: | The module path as a string |
---|
isArray()
Check whether the type is an array.
Returns: | True if the type is an array, False otherwise |
---|
isAtomic()
Check whether the type is atomic.
Returns: | True if the type is atomic, False otherwise |
---|
isCall()
Check whether the type is a call.
Returns: | True if the type is a call, False otherwise |
---|
isCompound()
Check whether the type is a compound (vector, color, matrix).
Returns: | True if the type is a compound, False otherwise |
---|
isEnum()
Check whether the type an enum.
Returns: | True if the type is an enum, False otherwise |
---|
isMaterial()
Check whether the type is a material.
Returns: | True if the type is a material, False otherwise |
---|
isReference()
Check whether the type is a reference.
Returns: | True if the type is a reference, False otherwise |
---|
isResource()
Check whether the type is a resource of any kind (texture, bsdf_measurement, …).
Returns: | True if the type is a resource, False otherwise |
---|
isString()
Check whether the type is a string.
Returns: | True if the type is a string, False otherwise |
---|
isStruct()
Check whether the type is a struct.
Returns: | True if the type is a struct, False otherwise |
---|
toMDLOperand(aName = None)
Convert this type definition to the appropriate MDLOperand, with the given name.
Parameters: | aName (str, optional) – name of the operand. If None, the default name is used |
---|---|
Returns: | a MDLOperand |
class mdl.mdllibclasses.MDLTypeStructMemberDef(aName='', aType=None)
Bases: mdl.mdllibclasses.MDLLibObject
This class contains the definition of a MDL type of kind struct.
- Members:
- mName (str): name of the struct member
- mType (str): mdl path of the type
fromJSON(jsonData)
Build the object from the given JSON data
Parameters: | jsonData (dict) – JSON data |
---|