- 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
mdlcommon
Module mdlcommon provides the definition of common interfaces for MDLObjects:
class mdl.mdlcommon.MDLImplWithOperands(aOperands=None)
Bases: mdl.mdlcommon.MDLNodeImpl
This class allows to gather the parameter management for classes MDLImplConstant
, MDLImplMDLInstance
and MDLImplMDLGraphInstance
- Members:
- mOperands (
MDLOperands
): input parameters list.
- mOperands (
classify(aOther)
Compare the path of the two instances to classify them.
Parameters: | aOther (MDLNodeImpl ) – The filter to compare to. |
---|---|
Returns: | 1 if itself is considered greater than the other node, -1 for the opposite. 0 in case of equality. |
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.
getDefinition()
Get the definition of the node (Inputs, Outputs, Parameters)
Returns: | a MDLNodeDef object |
---|
getDisplayName()
Returns: | the display name of this node as a string |
---|
getInputDefinition(self, aInputIdentifier=None)
Get the input definition corresponding to the given identifier.
Parameters: | aInputIdentifier (str, optional) – The identifier to get. If let None, the first input will be returned |
---|---|
Returns: | the input definition as a MDLNodeDefInput if found, None otherwise |
getOperand(aOperandName)
Get the operand with the given name
Returns: | a MDLOperand object if found, None otherwise |
---|
getOperands()
Get the list of operands objects
Returns: | a list of MDLOperand |
---|
getOutputType(aOutputIdentifier=None)
Get the output type of this node given the output identifier.
Parameters: | aOutputIdentifier (str, optional) – The output identifier to look for. If None, the first output will be considered |
---|---|
Returns: | The node output type as a string (color or float) if found, None otherwise |
getParameter(aParameter=None)
Get the parameter with the given name among the parameters available on the node. aParameter can be None in case of a Constant or Selector node, where there is only one parameter.
Parameters: | aParameter (str, optional) – Parameter identifier |
---|---|
Returns: | The parameter if found (MDLParameter or MDLOperand ), None otherwise |
getParameterValue(aParameter=None)
Find a parameter with the given name among the parameters available on the node and return its value. aParameter can be None in case of a Constant or Selector node, where there is only one parameter.
Parameters: | aParameter (str, optional) – Parameter identifier |
---|---|
Returns: | The parameter value if found (string or MDLOperand , 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 |
parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
resetParameter(aParameter = None)
Reset the given parameter to its default value. aParameter can be None in case of a Constant or Selector node, where there is only one parameter.
Parameters: | aParameter (str) – identifier of the parameter to reset |
---|---|
Returns: | True if succeed, False otherwise |
Raise: | api_exceptions.SBSLibraryError |
setParameterValue(aParameter, aParamValue)
Set the value of the given parameter to the given value, if compatible with this node.
Parameters: |
|
---|---|
Returns: | True if succeed, False otherwise |
Raise: |
|
write(aSBSWriter, aXmlNode)
Write recursively the content of the SBSObject into the given xml node.
Parameters: |
|
---|
class mdl.mdlcommon.MDLNodeImpl
Bases: pysbs.common_interfaces.sbsobject.SBSObject
This abstract class allows to provide a common interface for all MDL node implementation kind.
classify(aOther)
Compare the path of the two instances to classify them.
Parameters: | aOther (MDLNodeImpl ) – The filter to compare to. |
---|---|
Returns: | 1 if itself is considered greater than the other node, -1 for the opposite. 0 in case of equality. |
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.
getDefinition()
Get the definition of the node (Inputs, Outputs, Parameters)
Returns: | a MDLNodeDef object |
---|
getDisplayName()
Returns: | the display name of this node as a string |
---|
getInputDefinition(self, aInputIdentifier=None)
Get the input definition corresponding to the given identifier.
Parameters: | aInputIdentifier (str, optional) – The identifier to get. If let None, the first input will be returned |
---|---|
Returns: | the input definition as a MDLNodeDefInput if found, None otherwise |
getOutputType(aOutputIdentifier=None)
Get the output type of this node given the output identifier.
Parameters: | aOutputIdentifier (str, optional) – The output identifier to look for. If None, the first output will be considered |
---|---|
Returns: | The node output type as a string (color or float) if found, None otherwise |
getParameter(aParameter=None)
Get the parameter with the given name among the parameters available on the node. aParameter can be None in case of a Constant or Selector node, where there is only one parameter.
Parameters: | aParameter (str, optional) – Parameter identifier |
---|---|
Returns: | The parameter if found (MDLParameter or MDLOperand ), None otherwise |
getParameterValue(aParameter=None)
Find a parameter with the given name among the parameters available on the node and return its value. aParameter can be None in case of a Constant or Selector node, where there is only one parameter.
Parameters: | aParameter (str, optional) – Parameter identifier |
---|---|
Returns: | The parameter value if found (string or MDLOperand , 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 |
parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
resetParameter(aParameter = None)
Reset the given parameter to its default value. aParameter can be None in case of a Constant or Selector node, where there is only one parameter.
Parameters: | aParameter (str) – identifier of the parameter to reset |
---|---|
Returns: | True if succeed, False otherwise |
Raise: | api_exceptions.SBSLibraryError |
setParameterValue(aParameter, aParamValue)
Set the value of the given parameter to the given value, if compatible with this node.
Parameters: |
|
---|---|
Returns: | True if succeed, False otherwise |
Raise: |
|
write(aSBSWriter, aXmlNode)
Write recursively the content of the SBSObject into the given xml node.
Parameters: |
|
---|
class mdl.mdlcommon.MDLObjectWithAnnotations(aAllowedAnnotations, aAnnotations)
Bases: object
This abstract class allows to provide a common interface for all MDL object with annotations.
getAnnotation(aAnnotation)
Get the given annotation.
Parameters: | aAnnotation (MDLAnnotationEnum or str) – The annotation to look for, as an enumeration or a mdl path |
---|---|
Returns: | The annotation as a MDLAnnotation |
getAnnotationValue(aAnnotation)
Get the value of the given annotation.
Parameters: | aAnnotation (MDLAnnotationEnum or str) – The annotation to look for, as an enumeration or a mdl path |
---|---|
Returns: | The annotation value as a string or list of string if found, None otherwise |
getGroup()
Get the ‘in_group’ annotation value
Returns: | The group/subgroup/subsubgroup value if found, None otherwise |
---|
getUsage()
Get the ‘sampler_usage’ annotation value
Returns: | The ‘sampler_usage’ value if found, None otherwise |
---|
hasUsage(aUsage)
Check if the given usage is defined on this constant node
Parameters: | aUsage (str or UsageEnum ) – The usage to look for (can be an enum value or a custom string) |
---|---|
Returns: | True if the given usage is defined on this param input, False otherwise |
removeAnnotation(aAnnotation)
Remove the given annotation from the list of annotations
Parameters: | aAnnotation (MDLAnnotationEnum or str) – The annotation to look for, as an enumeration or a mdl path |
---|
setAnnotation(aAnnotation, aAnnotationValue)
Set the given attribute
Parameters: |
|
---|---|
Raise: |
|
setGroup(aGroup, aSubGroup=None, aSubSubGroup=None)
Set the ‘in_group’ annotation value with the given group and subgroups
Parameters: |
|
---|
setUsage(aUsage)
Set the ‘sampler_usage’ annotation value with the given usage
Parameters: | aUsage (str) – The usage to set |
---|