User Guide Cancel

mdllibclasses | Substance 3D Automation ToolKit

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)
class mdl.mdllibclasses.MDLAnnotationDef(aPath='', aParameters=None)
 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)
fromJSON(jsonData)
 fromJSON(jsonData)  

Build the object from the given JSON data

Parameters:jsonData (dict) – JSON data
fromMDLAnnotation(aAnnotation)
fromMDLAnnotation(aAnnotation)
 fromMDLAnnotation(aAnnotation)  

Build the MDLAnnotationDef from a MDLAnnotation object

Parameters:aAnnotation (MDLAnnotation) – The operand to use to build this parameter
toMDLAnnotation()
toMDLAnnotation()
 toMDLAnnotation()  

Build the MDLAnnotation from this MDLAnnotationDef object

Returns:a MDLAnnotation object
class mdl.mdllibclasses.MDLLibObject
class mdl.mdllibclasses.MDLLibObject
 class mdl.mdllibclasses.MDLLibObject  

Bases: object

Base class of all MDL library classes.

fromJSON(jsonData)
fromJSON(jsonData)
 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)
class mdl.mdllibclasses.MDLNodeDef(aPath='', aAnnotations=None, aParameters=None, aInputs=None, aOutputs=None, aIsSelector=False, aIsMaterial=False, aIsPassthrough=False)
 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)
fromJSON(jsonData)
 fromJSON(jsonData)  

Build the object from the given JSON data

Parameters:jsonData (dict) – JSON data
getAllInputIdentifiers()
getAllInputIdentifiers()
 getAllInputIdentifiers()  

Get all the input identifiers as strings of this node definition

Returns:a list of string
getAllInputs()
getAllInputs()
 getAllInputs()  

Get all the inputs in this node definition

Returns:a list of MDLNodeDefInput
getAllOutputIdentifiers()
getAllOutputIdentifiers()
 getAllOutputIdentifiers()  

Get all the output identifiers as strings of this node definition

Returns:a list of string
getAllOutputs()
getAllOutputs()
 getAllOutputs()  

Get all the outputs in this node definition

Returns:a list of MDLNodeDefOutput
getAllParameterIdentifiers()
getAllParameterIdentifiers()
 getAllParameterIdentifiers()  

Get all the parameter identifiers as strings of this node definition

Returns:a list of string
getAllParameters()
getAllParameters()
 getAllParameters()  

Get all the parameters in this node definition

Returns:a list of MDLNodeDefParam
getDefaultOperands()
getDefaultOperands()
 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)
getFirstInputOfType(aType)
 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)
getFirstOutputOfType(aType)
 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)
getInput(aInput)
 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)
getOutput(aOutput = None)
 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)
getParameter(aParameter)
 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)
class mdl.mdllibclasses.MDLNodeDefInput(aIdentifier='input', aType=None)
 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)
fromJSON(jsonData)
 fromJSON(jsonData)  

Build the object from the given JSON data

Parameters:jsonData (dict) – JSON data
fromMDLInputBridging(aInputBridging, aSBSGraph)
fromMDLInputBridging(aInputBridging, aSBSGraph)
 fromMDLInputBridging(aInputBridging, aSBSGraph)  

Build the MDLNodeDefInput from a MDLInputBridging object

Parameters:aInputBridging (MDLInputBridging) – The operand to use to build this input
fromMDLOperand(aOperand)
fromMDLOperand(aOperand)
 fromMDLOperand(aOperand)  

Build the MDLNodeDefInput from a MDLOperand object

Parameters:aOperand (MDLOperand) – The operand to use to build this input
getIdentifierStr()
getIdentifierStr()
 getIdentifierStr()  

Gets the identifier of the input

Returns:The identifier as a string
getType()
getType()
 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)
class mdl.mdllibclasses.MDLNodeDefOutput(aIdentifier='output', aType=None)
 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)
fromJSON(jsonData)
 fromJSON(jsonData)  

Build the object from the given JSON data

Parameters:jsonData (dict) – JSON data
fromMDLOutputBridging(aOutputBridging, aSBSGraph)
fromMDLOutputBridging(aOutputBridging, aSBSGraph)
 fromMDLOutputBridging(aOutputBridging, aSBSGraph)  

Build the MDLNodeDefOutput from a MDLOutputBridging object

Parameters:
  • aOutputBridging (MDLInputBridging) – The operand to use to build this input
  • aSBSGraph (SBSGraph) – The Substance Graph referenced by the input bridging
getIdentifierStr()
getIdentifierStr()
 getIdentifierStr()  

Gets the identifier of the output

Returns:The identifier as a string
getType()
getType()
 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='')
class mdl.mdllibclasses.MDLNodeDefParam(aName='', aAnnotations=None, aDefaultMDLValue=None, aDefaultValue=None, aDefaultValueType=None, aTypeName='', aTypePath='', aTypeModifier='')
 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)
fromJSON(jsonData)
 fromJSON(jsonData)  

Build the object from the given JSON data

Parameters:jsonData (dict) – JSON data
fromMDLOperand(aOperand, copyValue=False)
fromMDLOperand(aOperand, copyValue=False)
 fromMDLOperand(aOperand, copyValue=False)  

Build the MDLNodeDefParam from a MDLOperand object

Parameters:
  • aOperand (MDLOperand) – The operand to use to build this parameter
  • copyValue (bool, optional) – True to set the value of the operand as the default parameter value. Default to False
fromMDLParameter(aParameter, copyValue=False)
fromMDLParameter(aParameter, copyValue=False)
 fromMDLParameter(aParameter, copyValue=False)  

fromSBSParameter(aParameter, copyValue=False) Build the MDLNodeDefParam from a MDLParameter object

Parameters:
  • aParameter (MDLParameter) – The operand to use to build this parameter
  • copyValue (bool, optional) – True to set the value of the parameter as the default parameter value. Default to False
getAnnotation(aAnnotation)
getAnnotation(aAnnotation)
 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()
getDefaultValue()
 getDefaultValue()  

Get the default value of this parameter

Returns:The default value
getType()
getType()
 getType()  

Get the mdl path of the type of this parameter

Returns:The mdl type as a string
toMDLOperand()
toMDLOperand()
 toMDLOperand()  

Convert this parameter definition to the appropriate MDLOperand.

Returns:a MDLOperand
class mdl.mdllibclasses.MDLNodeDefParamValue(aName='', aValue='', aType='')
class mdl.mdllibclasses.MDLNodeDefParamValue(aName='', aValue='', aType='')
 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)
fromJSON(jsonData)
 fromJSON(jsonData)  

Build the object from the given JSON data

Parameters:jsonData (dict) – JSON data
getType()
getType()
 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')
class mdl.mdllibclasses.MDLNodeDefType(aName='', aPath='', aModifier='auto')
 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)
fromJSON(jsonData)
 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)
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)
 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)
fromJSON(jsonData)
 fromJSON(jsonData)  

Build the object from the given JSON data

Parameters:jsonData (dict) – JSON data
getModuleName()
getModuleName()
 getModuleName()  

Get the module name, which is the last part of the type’s mdl path

Returns:The module name as a string
getModulePath()
getModulePath()
 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()
isArray()
 isArray()  

Check whether the type is an array.

Returns:True if the type is an array, False otherwise
isAtomic()
isAtomic()
 isAtomic()  

Check whether the type is atomic.

Returns:True if the type is atomic, False otherwise
isCall()
isCall()
 isCall()  

Check whether the type is a call.

Returns:True if the type is a call, False otherwise
isCompound()
isCompound()
 isCompound()  

Check whether the type is a compound (vector, color, matrix).

Returns:True if the type is a compound, False otherwise
isEnum()
isEnum()
 isEnum()  

Check whether the type an enum.

Returns:True if the type is an enum, False otherwise
isMaterial()
isMaterial()
 isMaterial()  

Check whether the type is a material.

Returns:True if the type is a material, False otherwise
isReference()
isReference()
 isReference()  

Check whether the type is a reference.

Returns:True if the type is a reference, False otherwise
isResource()
isResource()
 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()
isString()
 isString()  

Check whether the type is a string.

Returns:True if the type is a string, False otherwise
isStruct()
isStruct()
 isStruct()  

Check whether the type is a struct.

Returns:True if the type is a struct, False otherwise
toMDLOperand(aName = None)
toMDLOperand(aName = None)
 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)
class mdl.mdllibclasses.MDLTypeStructMemberDef(aName='', aType=None)
 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)
fromJSON(jsonData)
 fromJSON(jsonData)  

Build the object from the given JSON data

Parameters:jsonData (dict) – JSON data

Get help faster and easier

New user?