User Guide Cancel

mdlmanager | Substance 3D Automation ToolKit

mdlmanager

Module mdlmanager provides the class MDLManager that allows requesting a native mdl node information.

class mdl.mdlmanager.MDLManager
class mdl.mdlmanager.MDLManager
 class mdl.mdlmanager.MDLManager  

Bases: object

Class used handle the MDL library and to request information on a MDL instance

MATERIAL_CONSTRUCTOR_FUNCTION = 'mdl::material(bool,material_surface,material_surface,color,material_volume,material_geometry,hair_bsdf)'
MATERIAL_CONSTRUCTOR_FUNCTION = 'mdl::material(bool,material_surface,material_surface,color,material_volume,material_geometry,hair_bsdf)'
 MATERIAL_CONSTRUCTOR_FUNCTION = 'mdl::material(bool,material_surface,material_surface,color,material_volume,material_geometry,hair_bsdf)'  
static addRootPath()
static addRootPath()
 static addRootPath()  

Add the given absolute path to the list of mdl root paths

Parameters:aPath (str) – The absolute path to the directory to add
Raise:IOError in case the provided path does not exists
static extractMDLModulesFrom(aRootPaths)
static extractMDLModulesFrom(aRootPaths)
 static extractMDLModulesFrom(aRootPaths)  

Call mdltools executable to extract the JSON data of the mdl module found in the given list of root path.

Parameters:aRootPaths (list of strings) – The root path list to consider
Returns:the number of extracted items
static getAcceptConnectionByDefaultForType(aTypePath, aParamListContainsRefOrMaterial)
static getAcceptConnectionByDefaultForType(aTypePath, aParamListContainsRefOrMaterial)
 static getAcceptConnectionByDefaultForType(aTypePath, aParamListContainsRefOrMaterial)  

Get the default connectivity status for an input pin, depending on the given type

Parameters:aTypePath (str) – the mdl path of the type
Returns:True if by default this type accepts connection, False otherwise
static getConstantDefaultAnnotations(aTypePath, aExposed)
static getConstantDefaultAnnotations(aTypePath, aExposed)
 static getConstantDefaultAnnotations(aTypePath, aExposed)  

Get the list of annotation definition for a MDL constant node.

Parameters:
  • aTypePath (str) – mdl path of the type of the constant
  • aExposed (bool) – True to consider a constant exposed as an input parameter, False otherwise
Returns:

a list of MDLAnnotation

static getGraphDefaultAnnotations()
static getGraphDefaultAnnotations()
 static getGraphDefaultAnnotations()  

Get the list of annotation definition for a MDL graph.

Returns:a list of MDLAnnotation
static getMDLAnnotationDefinition(aAnnotation)
static getMDLAnnotationDefinition(aAnnotation)
 static getMDLAnnotationDefinition(aAnnotation)  

Get the annotation definition

Parameters:aAnnotation (MDLAnnotationEnum or str) – The annotation to get, as an enumeration value, or a complete mdl path
Returns:The annotation definition as a MDLAnnotationDef
static getMDLNodeDefinition(aPath)
static getMDLNodeDefinition(aPath)
 static getMDLNodeDefinition(aPath)  

Get the MDLNodeDef object corresponding to the given mdl path

Parameters:aPath (string) – The mdl path (for instance ‘mdl::base::color_layer(color,float,::base::color_layer_mode)’)
Returns:The MDLNodeDef object if the path is found, None otherwise
static getMDLTypeDefinition(aPath)
static getMDLTypeDefinition(aPath)
 static getMDLTypeDefinition(aPath)  

Get the MDLTypeDef object corresponding to the given mdl path

Parameters:aPath (string) – The mdl path (for instance ‘mdl::color’)
Returns:The MDLTypeDef object if the path is found, None otherwise
static getRootPaths()
static getRootPaths()
 static getRootPaths()  

Get the list of MDL root paths

Returns:The MDL root paths package path as a list of strings
static initAllMDLModules()
static initAllMDLModules()
 static initAllMDLModules()  

Initialize the MDL library with all the modules found in the MDL root paths

static isAColor(aTypePath)
static isAColor(aTypePath)
 static isAColor(aTypePath)  

Check whether the given type is related to a color or not.

Returns:True if this type can be interpreted as a color, False otherwise
static isModulePathDenyListed(aPath)
static isModulePathDenyListed(aPath)
 static isModulePathDenyListed(aPath)  

Check if the given mdl path is deny listed and cannot be instantiated as a node

Parameters:aPath (str) – The path to check
Returns:True if the path is deny listed, False otherwise
static parseJsonData(jsonData)
static parseJsonData(jsonData)
 static parseJsonData(jsonData)  

Parse the given JSON data to extract the MDL functions and materials found in it

Parameters:jsonData – The JSON data, in the format created by ‘mdltools’ executable
Returns:the number of extracted items
static resolveVersionnedFunctionPath(path)
static resolveVersionnedFunctionPath(path)
 static resolveVersionnedFunctionPath(path)  

Check if the parsed path match mdltools MDL specification, if not change it to a versionned function path

Parameters:path (str) – mdl path to resolve
Returns:str, resolved path, same as argument if not resolved required
Raise:api_exceptions.SBSLibraryError
setRootPaths(aPathList)
setRootPaths(aPathList)
 setRootPaths(aPathList)  

If the given root path list is different from the ones already loaded, reinitialize the MDL library with the given root path. Do nothing otherwise.

Parameters:aPathList (list of string) – the MDL root path list to set, as absolute paths

Get help faster and easier

New user?