MaterialX.PyMaterialXGenShader Module

Inheritance diagram of MaterialX.PyMaterialXGenShader

Core shader generation support for MaterialX.

class MaterialX.PyMaterialXGenShader.ApplicationVariableHandler

Bases: pybind11_object

class MaterialX.PyMaterialXGenShader.ColorManagementSystem(self: MaterialX.PyMaterialXGenShader.ColorManagementSystem)

Bases: pybind11_object

Abstract base class for color management systems.

getName(self: MaterialX.PyMaterialXGenShader.ColorManagementSystem) str

Return the ColorManagementSystem name.

loadLibrary(self: MaterialX.PyMaterialXGenShader.ColorManagementSystem, arg0: MaterialX.PyMaterialXCore.Document) None

Load a library of implementations from the provided document, replacing any previously loaded content.

supportsTransform(self: MaterialX.PyMaterialXGenShader.ColorManagementSystem, arg0: MaterialX.PyMaterialXGenShader.ColorSpaceTransform) bool

Returns whether this color management system supports a provided transform.

class MaterialX.PyMaterialXGenShader.ColorSpaceTransform(self: MaterialX.PyMaterialXGenShader.ColorSpaceTransform, arg0: str, arg1: str, arg2: MaterialX_v1_39_5::TypeDesc)

Bases: pybind11_object

Structure that represents color space transform information.

property sourceSpace
property targetSpace
property type
class MaterialX.PyMaterialXGenShader.DefaultColorManagementSystem

Bases: ColorManagementSystem

Class for a default color management system.

static create(arg0: str) MaterialX.PyMaterialXGenShader.DefaultColorManagementSystem

Create a new DefaultColorManagementSystem.

getName(self: MaterialX.PyMaterialXGenShader.DefaultColorManagementSystem) str

Return the DefaultColorManagementSystem name.

loadLibrary(self: MaterialX.PyMaterialXGenShader.ColorManagementSystem, arg0: MaterialX.PyMaterialXCore.Document) None

Load a library of implementations from the provided document, replacing any previously loaded content.

supportsTransform(self: MaterialX.PyMaterialXGenShader.ColorManagementSystem, arg0: MaterialX.PyMaterialXGenShader.ColorSpaceTransform) bool

Returns whether this color management system supports a provided transform.

class MaterialX.PyMaterialXGenShader.GenContext(self: MaterialX.PyMaterialXGenShader.GenContext, arg0: MaterialX.PyMaterialXGenShader.ShaderGenerator)

Bases: pybind11_object

A context class for shader generation.

Used for thread local storage of data needed during shader generation.

getApplicationVariableHandler(self: MaterialX.PyMaterialXGenShader.GenContext) collections.abc.Callable[[MaterialX_v1_39_5::ShaderNode, MaterialX.PyMaterialXGenShader.GenContext], None]

Get handler for application variables.

getOptions(self: MaterialX.PyMaterialXGenShader.GenContext) MaterialX_v1_39_5::GenOptions
getShaderGenerator(self: MaterialX.PyMaterialXGenShader.GenContext) MaterialX.PyMaterialXGenShader.ShaderGenerator

Return shader generatior.

getTypeDesc(self: MaterialX.PyMaterialXGenShader.GenContext, arg0: str) MaterialX_v1_39_5::TypeDesc

Return a TypeDesc for the given type name.

pushUserData(self: MaterialX.PyMaterialXGenShader.GenContext, arg0: str, arg1: MaterialX_v1_39_5::GenUserData) None

Add user data to the context to make it available during shader generator.

registerSourceCodeSearchPath(*args, **kwargs)

Overloaded function.

  1. registerSourceCodeSearchPath(self: MaterialX.PyMaterialXGenShader.GenContext, arg0: MaterialX.PyMaterialXFormat.FilePath) -> None

  2. registerSourceCodeSearchPath(self: MaterialX.PyMaterialXGenShader.GenContext, arg0: MaterialX.PyMaterialXFormat.FileSearchPath) -> None

resolveSourceFile(self: MaterialX.PyMaterialXGenShader.GenContext, arg0: MaterialX.PyMaterialXFormat.FilePath, arg1: MaterialX.PyMaterialXFormat.FilePath) MaterialX.PyMaterialXFormat.FilePath

Resolve a source code filename, first checking the given local path then checking any file paths registered by the user.

setApplicationVariableHandler(self: MaterialX.PyMaterialXGenShader.GenContext, arg0: collections.abc.Callable[[MaterialX_v1_39_5::ShaderNode, MaterialX.PyMaterialXGenShader.GenContext], None]) None

Set handler for application variables.

class MaterialX.PyMaterialXGenShader.GenOptions(self: MaterialX.PyMaterialXGenShader.GenOptions)

Bases: pybind11_object

Class holding options to configure shader generation.

property addUpstreamDependencies
property distributeLayerOverBsdfMix
property elideConstantNodes
property emitColorTransforms
property fileTextureVerticalFlip
property hwAmbientOcclusion
property hwImplicitBitangents
property hwMaxActiveLightSources
property hwNormalizeUdimTexCoords
property hwShadowMap
property hwSpecularEnvironmentMethod
property hwSrgbEncodeOutput
property hwTransparency
property hwWriteAlbedoTable
property hwWriteDepthMoments
property hwWriteEnvPrefilter
property libraryPrefix
property premultipliedBsdfAdd
property shaderInterfaceType
property targetColorSpaceOverride
property targetDistanceUnit
class MaterialX.PyMaterialXGenShader.GenUserData

Bases: pybind11_object

Base class for custom user data needed during shader generation.

getSelf(self: MaterialX.PyMaterialXGenShader.GenUserData) MaterialX.PyMaterialXGenShader.GenUserData
class MaterialX.PyMaterialXGenShader.HwResourceBindingContext

Bases: GenUserData

emitDirectives(self: MaterialX.PyMaterialXGenShader.HwResourceBindingContext, arg0: MaterialX.PyMaterialXGenShader.GenContext, arg1: MaterialX.PyMaterialXGenShader.ShaderStage) None
emitResourceBindings(self: MaterialX.PyMaterialXGenShader.HwResourceBindingContext, arg0: MaterialX.PyMaterialXGenShader.GenContext, arg1: MaterialX.PyMaterialXGenShader.VariableBlock, arg2: MaterialX.PyMaterialXGenShader.ShaderStage) None
getSelf(self: MaterialX.PyMaterialXGenShader.GenUserData) MaterialX.PyMaterialXGenShader.GenUserData
class MaterialX.PyMaterialXGenShader.HwShaderGenerator

Bases: ShaderGenerator

bindLightShader(self: MaterialX.PyMaterialXCore.NodeDef, arg0: SupportsInt, arg1: MaterialX.PyMaterialXGenShader.GenContext) None
generate(self: MaterialX.PyMaterialXGenShader.ShaderGenerator, arg0: str, arg1: MaterialX.PyMaterialXCore.Element, arg2: MaterialX_v1_39_5::GenContext) MaterialX.PyMaterialXGenShader.Shader

Generate a shader starting from the given element, translating the element and all dependencies upstream into shader code.

getColorManagementSystem(self: MaterialX.PyMaterialXGenShader.ShaderGenerator) MaterialX.PyMaterialXGenShader.ColorManagementSystem

Returns the color management system.

getTarget(self: MaterialX.PyMaterialXGenShader.ShaderGenerator) str

Return the name of the target this generator is for.

getTokenSubstitutions(self: MaterialX.PyMaterialXGenShader.ShaderGenerator) dict[str, str]

Return the map of token substitutions used by the generator.

getUnitSystem(self: MaterialX.PyMaterialXGenShader.ShaderGenerator) MaterialX_v1_39_5::UnitSystem

Returns the unit system.

registerShaderMetadata(self: MaterialX.PyMaterialXGenShader.ShaderGenerator, arg0: MaterialX.PyMaterialXCore.Document, arg1: MaterialX_v1_39_5::GenContext) None

Register metadata that should be exported to the generated shaders.

Supported metadata includes standard UI attributes like “uiname”, “uifolder”, “uimin”, “uimax”, etc. But it is also extendable by defining custom attributes using AttributeDefs. Any AttributeDef in the given document with exportable=”true” will be exported as shader metadata when found on nodes during shader generation. Derived shader generators may override this method to change the registration. Applications must explicitly call this method before shader generation to enable export of metadata.

registerTypeDefs(self: MaterialX.PyMaterialXGenShader.ShaderGenerator, arg0: MaterialX.PyMaterialXCore.Document) None

Register type definitions from the document.

setColorManagementSystem(self: MaterialX.PyMaterialXGenShader.ShaderGenerator, arg0: MaterialX.PyMaterialXGenShader.ColorManagementSystem) None

Sets the color management system.

setUnitSystem(self: MaterialX.PyMaterialXGenShader.ShaderGenerator, arg0: MaterialX_v1_39_5::UnitSystem) None

Sets the unit system.

unbindLightShader(self: SupportsInt, arg0: MaterialX.PyMaterialXGenShader.GenContext) None
unbindLightShaders(self: MaterialX.PyMaterialXGenShader.GenContext) None
class MaterialX.PyMaterialXGenShader.HwSpecularEnvironmentMethod(self: MaterialX.PyMaterialXGenShader.HwSpecularEnvironmentMethod, value: SupportsInt)

Bases: pybind11_object

Members:

SPECULAR_ENVIRONMENT_PREFILTER

SPECULAR_ENVIRONMENT_FIS

SPECULAR_ENVIRONMENT_NONE

SPECULAR_ENVIRONMENT_FIS = <HwSpecularEnvironmentMethod.SPECULAR_ENVIRONMENT_FIS: 1>
SPECULAR_ENVIRONMENT_NONE = <HwSpecularEnvironmentMethod.SPECULAR_ENVIRONMENT_NONE: 0>
SPECULAR_ENVIRONMENT_PREFILTER = <HwSpecularEnvironmentMethod.SPECULAR_ENVIRONMENT_PREFILTER: 2>
HwSpecularEnvironmentMethod.name -> str
property value
class MaterialX.PyMaterialXGenShader.Shader(self: MaterialX.PyMaterialXGenShader.Shader, arg0: str, arg1: MaterialX_v1_39_5::ShaderGraph)

Bases: pybind11_object

Class containing all data needed during shader generation.

After generation is completed it will contain the resulting source code emitted by shader generators.

The class contains a default implementation using a single shader stage. Derived shaders can override this, as well as overriding all methods that add code to the shader.

getAttribute(self: MaterialX.PyMaterialXGenShader.Shader, arg0: str) MaterialX.PyMaterialXCore.Value

Return the value for a named attribute, or nullptr if no such attribute is found.

getName(self: MaterialX.PyMaterialXGenShader.Shader) str

Return the shader name.

getSourceCode(self: MaterialX.PyMaterialXGenShader.Shader, arg0: str) str

Return the shader source code for a given shader stage.

getStage(*args, **kwargs)

Overloaded function.

  1. getStage(self: MaterialX.PyMaterialXGenShader.Shader, arg0: typing.SupportsInt) -> MaterialX_v1_39_5::ShaderStage

  2. getStage(self: MaterialX.PyMaterialXGenShader.Shader, arg0: str) -> MaterialX_v1_39_5::ShaderStage

hasAttribute(self: MaterialX.PyMaterialXGenShader.Shader, arg0: str) bool

Return true if the shader has a given named attribute.

hasStage(self: MaterialX.PyMaterialXGenShader.Shader, arg0: str) bool

Return if stage exists.

numStages(self: MaterialX.PyMaterialXGenShader.Shader) int

Return the number of shader stages for this shader.

setAttribute(*args, **kwargs)

Overloaded function.

  1. setAttribute(self: MaterialX.PyMaterialXGenShader.Shader, arg0: str) -> None

  2. setAttribute(self: MaterialX.PyMaterialXGenShader.Shader, arg0: str, arg1: MaterialX.PyMaterialXCore.Value) -> None

class MaterialX.PyMaterialXGenShader.ShaderGenerator

Bases: pybind11_object

Base class for shader generators All third-party shader generators should derive from this class.

Derived classes should use DECLARE_SHADER_GENERATOR / DEFINE_SHADER_GENERATOR in their declaration / definition, and register with the Registry class.

generate(self: MaterialX.PyMaterialXGenShader.ShaderGenerator, arg0: str, arg1: MaterialX.PyMaterialXCore.Element, arg2: MaterialX_v1_39_5::GenContext) MaterialX.PyMaterialXGenShader.Shader

Generate a shader starting from the given element, translating the element and all dependencies upstream into shader code.

getColorManagementSystem(self: MaterialX.PyMaterialXGenShader.ShaderGenerator) MaterialX.PyMaterialXGenShader.ColorManagementSystem

Returns the color management system.

getTarget(self: MaterialX.PyMaterialXGenShader.ShaderGenerator) str

Return the name of the target this generator is for.

getTokenSubstitutions(self: MaterialX.PyMaterialXGenShader.ShaderGenerator) dict[str, str]

Return the map of token substitutions used by the generator.

getUnitSystem(self: MaterialX.PyMaterialXGenShader.ShaderGenerator) MaterialX_v1_39_5::UnitSystem

Returns the unit system.

registerShaderMetadata(self: MaterialX.PyMaterialXGenShader.ShaderGenerator, arg0: MaterialX.PyMaterialXCore.Document, arg1: MaterialX_v1_39_5::GenContext) None

Register metadata that should be exported to the generated shaders.

Supported metadata includes standard UI attributes like “uiname”, “uifolder”, “uimin”, “uimax”, etc. But it is also extendable by defining custom attributes using AttributeDefs. Any AttributeDef in the given document with exportable=”true” will be exported as shader metadata when found on nodes during shader generation. Derived shader generators may override this method to change the registration. Applications must explicitly call this method before shader generation to enable export of metadata.

registerTypeDefs(self: MaterialX.PyMaterialXGenShader.ShaderGenerator, arg0: MaterialX.PyMaterialXCore.Document) None

Register type definitions from the document.

setColorManagementSystem(self: MaterialX.PyMaterialXGenShader.ShaderGenerator, arg0: MaterialX.PyMaterialXGenShader.ColorManagementSystem) None

Sets the color management system.

setUnitSystem(self: MaterialX.PyMaterialXGenShader.ShaderGenerator, arg0: MaterialX_v1_39_5::UnitSystem) None

Sets the unit system.

class MaterialX.PyMaterialXGenShader.ShaderInterfaceType(self: MaterialX.PyMaterialXGenShader.ShaderInterfaceType, value: SupportsInt)

Bases: pybind11_object

Members:

SHADER_INTERFACE_COMPLETE

SHADER_INTERFACE_REDUCED

SHADER_INTERFACE_COMPLETE = <ShaderInterfaceType.SHADER_INTERFACE_COMPLETE: 0>
SHADER_INTERFACE_REDUCED = <ShaderInterfaceType.SHADER_INTERFACE_REDUCED: 1>
ShaderInterfaceType.name -> str
property value
class MaterialX.PyMaterialXGenShader.ShaderPort

Bases: pybind11_object

An input or output port on a ShaderNode.

getColorSpace(self: MaterialX.PyMaterialXGenShader.ShaderPort) str

Return the source color space for the value on this port.

getFullName(self: MaterialX.PyMaterialXGenShader.ShaderPort) str

Return the name of this port.

getGeomProp(self: MaterialX.PyMaterialXGenShader.ShaderPort) str

Get geomprop name.

getName(self: MaterialX.PyMaterialXGenShader.ShaderPort) str

Return the name of this port.

getPath(self: MaterialX.PyMaterialXGenShader.ShaderPort) str

Return the path to this port.

getSemantic(self: MaterialX.PyMaterialXGenShader.ShaderPort) str

Return the variable semantic of this port.

getType(self: MaterialX.PyMaterialXGenShader.ShaderPort) MaterialX_v1_39_5::TypeDesc

Return the data type for this port.

getUnit(self: MaterialX.PyMaterialXGenShader.ShaderPort) str

Return the unit type for the value on this port.

getValue(self: MaterialX.PyMaterialXGenShader.ShaderPort) MaterialX.PyMaterialXCore.Value

Return the value set on this port.

getValueString(self: MaterialX.PyMaterialXGenShader.ShaderPort) str

Return the value set on this port as a string, or an empty string if there is no value.

getVariable(self: MaterialX.PyMaterialXGenShader.ShaderPort) str

Return the variable name of this port.

isEmitted(self: MaterialX.PyMaterialXGenShader.ShaderPort) bool

Return the emitted state of this port.

isUniform(self: MaterialX.PyMaterialXGenShader.ShaderPort) bool

Return the uniform flag on this port.

setColorSpace(self: MaterialX.PyMaterialXGenShader.ShaderPort, arg0: str) None

Set a source color space for the value on this port.

setGeomProp(self: MaterialX.PyMaterialXGenShader.ShaderPort, arg0: str) None

Set geomprop name if the input has a default geomprop to be assigned when it is unconnected.

setName(self: MaterialX.PyMaterialXGenShader.ShaderPort, arg0: str) None

Set the name of this port.

setPath(self: MaterialX.PyMaterialXGenShader.ShaderPort, arg0: str) None

Set the path to this port.

setSemantic(self: MaterialX.PyMaterialXGenShader.ShaderPort, arg0: str) None

Set the variable semantic of this port.

setType(self: MaterialX.PyMaterialXGenShader.ShaderPort, arg0: MaterialX_v1_39_5::TypeDesc) None

Set the data type for this port.

setUnit(self: MaterialX.PyMaterialXGenShader.ShaderPort, arg0: str) None

Set a unit type for the value on this port.

setValue(self: MaterialX.PyMaterialXGenShader.ShaderPort, arg0: MaterialX.PyMaterialXCore.Value, arg1: bool) None

Set a value on this port.

setVariable(self: MaterialX.PyMaterialXGenShader.ShaderPort, arg0: str) None

Set the variable name of this port.

class MaterialX.PyMaterialXGenShader.ShaderPortPredicate

Bases: pybind11_object

class MaterialX.PyMaterialXGenShader.ShaderStage(self: MaterialX.PyMaterialXGenShader.ShaderStage, arg0: str, arg1: MaterialX_v1_39_5::Syntax)

Bases: pybind11_object

A shader stage, containing the state and resulting source code for the stage.

getConstantBlock(self: MaterialX.PyMaterialXGenShader.ShaderStage) MaterialX.PyMaterialXGenShader.VariableBlock
getFunctionName(self: MaterialX.PyMaterialXGenShader.ShaderStage) str

Return the stage function name.

getIncludes(self: MaterialX.PyMaterialXGenShader.ShaderStage) set[str]

Return a set of all include files.

getInputBlock(self: MaterialX.PyMaterialXGenShader.ShaderStage, arg0: str) MaterialX.PyMaterialXGenShader.VariableBlock
getInputBlocks(self: MaterialX.PyMaterialXGenShader.ShaderStage) dict[str, MaterialX.PyMaterialXGenShader.VariableBlock]

Return a map of all input blocks.

getName(self: MaterialX.PyMaterialXGenShader.ShaderStage) str

Return the stage name.

getOutputBlock(self: MaterialX.PyMaterialXGenShader.ShaderStage, arg0: str) MaterialX.PyMaterialXGenShader.VariableBlock
getOutputBlocks(self: MaterialX.PyMaterialXGenShader.ShaderStage) dict[str, MaterialX.PyMaterialXGenShader.VariableBlock]

Return a map of all output blocks.

getSourceCode(self: MaterialX.PyMaterialXGenShader.ShaderStage) str

Return the stage source code.

getSourceDependencies(self: MaterialX.PyMaterialXGenShader.ShaderStage) set[str]

Return a set of all source dependencies.

getUniformBlock(self: MaterialX.PyMaterialXGenShader.ShaderStage, arg0: str) MaterialX.PyMaterialXGenShader.VariableBlock
getUniformBlocks(self: MaterialX.PyMaterialXGenShader.ShaderStage) dict[str, MaterialX.PyMaterialXGenShader.VariableBlock]

Return a map of all uniform blocks.

class MaterialX.PyMaterialXGenShader.ShaderTranslator

Bases: pybind11_object

A helper class for translating content between shading models.

static create() MaterialX.PyMaterialXGenShader.ShaderTranslator
translateAllMaterials(self: MaterialX.PyMaterialXGenShader.ShaderTranslator, arg0: MaterialX.PyMaterialXCore.Document, arg1: str) None

Translate each material in the input document to the destination shading model.

translateShader(self: MaterialX.PyMaterialXGenShader.ShaderTranslator, arg0: MaterialX.PyMaterialXCore.Node, arg1: str) None

Translate a shader node to the destination shading model.

class MaterialX.PyMaterialXGenShader.TypeDesc

Bases: pybind11_object

A type descriptor for MaterialX data types.

All types need to have a type descriptor registered in order for shader generators to know about the type. It can be used for type comparisons as well as getting more information about the type. Type descriptors for all standard library data types are defined by default and can be accessed from the Type namespace, e.g. Type::FLOAT. Custom struct types defined through typedef elements in a data library are loaded in and registered by calling the ShaderGenerator::registerTypeDefs method. The TypeSystem class, see below, is used to manage all type descriptions. It can be used to query the registered types.

getBaseType(self: MaterialX.PyMaterialXGenShader.TypeDesc) int

Return the basetype for the type.

getName(self: MaterialX.PyMaterialXGenShader.TypeDesc) str

Return the name of the type.

getSemantic(self: MaterialX.PyMaterialXGenShader.TypeDesc) int

Return the semantic for the type.

getSize(self: MaterialX.PyMaterialXGenShader.TypeDesc) int

Return the number of elements the type is composed of.

Will return 1 for scalar types and a size greater than 1 for aggregate type. For array types 0 is returned since the number of elements is undefined until an array is instantiated.

isAggregate(self: MaterialX.PyMaterialXGenShader.TypeDesc) bool

Return true if the type is an aggregate type.

isArray(self: MaterialX.PyMaterialXGenShader.TypeDesc) bool

Return true if the type is an array type.

isClosure(self: MaterialX.PyMaterialXGenShader.TypeDesc) bool

Return true if the type represents a closure.

isFloat2(self: MaterialX.PyMaterialXGenShader.TypeDesc) bool

Return true if the type is an aggregate of 2 floats.

isFloat3(self: MaterialX.PyMaterialXGenShader.TypeDesc) bool

Return true if the type is an aggregate of 3 floats.

isFloat4(self: MaterialX.PyMaterialXGenShader.TypeDesc) bool

Return true if the type is an aggregate of 4 floats.

isScalar(self: MaterialX.PyMaterialXGenShader.TypeDesc) bool

Return true if the type is a scalar type.

class MaterialX.PyMaterialXGenShader.UnitSystem

Bases: pybind11_object

Base unit system support.

static create(arg0: str) MaterialX.PyMaterialXGenShader.UnitSystem

Create a new UnitSystem.

getName(self: MaterialX.PyMaterialXGenShader.UnitSystem) str

Return the UnitSystem name.

getUnitConverterRegistry(self: MaterialX.PyMaterialXGenShader.UnitSystem) MaterialX.PyMaterialXCore.UnitConverterRegistry

Returns the currently assigned unit converter registry.

loadLibrary(self: MaterialX.PyMaterialXGenShader.UnitSystem, arg0: MaterialX.PyMaterialXCore.Document) None

assign document with unit implementations replacing any previously loaded content.

setUnitConverterRegistry(self: MaterialX.PyMaterialXGenShader.UnitSystem, arg0: MaterialX.PyMaterialXCore.UnitConverterRegistry) None

Assign unit converter registry replacing any previous assignment.

supportsTransform(self: MaterialX.PyMaterialXGenShader.UnitSystem, arg0: MaterialX.PyMaterialXGenShader.UnitTransform) bool

Returns whether this unit system supports a provided transform.

class MaterialX.PyMaterialXGenShader.UnitTransform(self: MaterialX.PyMaterialXGenShader.UnitTransform, arg0: str, arg1: str, arg2: MaterialX.PyMaterialXGenShader.TypeDesc, arg3: str)

Bases: pybind11_object

Structure that represents unit transform information.

property sourceUnit
property targetUnit
property type
property unitType
class MaterialX.PyMaterialXGenShader.VariableBlock(self: MaterialX.PyMaterialXGenShader.VariableBlock, arg0: str, arg1: str)

Bases: pybind11_object

A block of variables in a shader stage.

empty(self: MaterialX.PyMaterialXGenShader.VariableBlock) bool

Return true if the block has no variables.

find(*args, **kwargs)

Overloaded function.

  1. find(self: MaterialX.PyMaterialXGenShader.VariableBlock, arg0: str) -> MaterialX.PyMaterialXGenShader.ShaderPort

  2. find(self: MaterialX.PyMaterialXGenShader.VariableBlock, arg0: collections.abc.Callable[[MaterialX.PyMaterialXGenShader.ShaderPort], bool]) -> MaterialX.PyMaterialXGenShader.ShaderPort

getInstance(self: MaterialX.PyMaterialXGenShader.VariableBlock) str

Get the instance name of this block.

getName(self: MaterialX.PyMaterialXGenShader.VariableBlock) str

Get the name of this block.

size(self: MaterialX.PyMaterialXGenShader.VariableBlock) int

Return the number of variables in this block.

MaterialX.PyMaterialXGenShader.connectsToWorldSpaceNode(arg0: MaterialX.PyMaterialXCore.Output) MaterialX.PyMaterialXCore.Node

Determine whether the given output is directly connected to a node that generates world-space coordinates (e.g.

Parameters:

output – Output to check

Returns:

Return the node if found.

MaterialX.PyMaterialXGenShader.elementRequiresShading(arg0: MaterialX.PyMaterialXCore.TypedElement) bool

Determine if a given element requires shading / lighting for rendering.

MaterialX.PyMaterialXGenShader.findRenderableElements(doc: MaterialX.PyMaterialXCore.Document, includeReferencedGraphs: bool = False) list[MaterialX.PyMaterialXCore.TypedElement]
MaterialX.PyMaterialXGenShader.findRenderableMaterialNodes(arg0: MaterialX.PyMaterialXCore.Document) list[MaterialX.PyMaterialXCore.TypedElement]
MaterialX.PyMaterialXGenShader.getNodeDefInput(arg0: MaterialX.PyMaterialXCore.Input, arg1: str) MaterialX.PyMaterialXCore.Input

Given a node input, return the corresponding input within its matching nodedef.

The optional target string can be used to guide the selection of nodedef declarations.

MaterialX.PyMaterialXGenShader.getUdimCoordinates(arg0: collections.abc.Sequence[str]) list[MaterialX.PyMaterialXCore.Vector2]

Compute the UDIM coordinates for a set of UDIM identifiers.

Returns:

List of UDIM coordinates

MaterialX.PyMaterialXGenShader.getUdimScaleAndOffset(arg0: collections.abc.Sequence[MaterialX.PyMaterialXCore.Vector2], arg1: MaterialX.PyMaterialXCore.Vector2, arg2: MaterialX.PyMaterialXCore.Vector2) None

Get the UV scale and offset to transform uv coordinates from UDIM uv space to 0..1 space.

MaterialX.PyMaterialXGenShader.hasElementAttributes(arg0: MaterialX.PyMaterialXCore.Output, arg1: collections.abc.Sequence[str]) bool

Returns true if there is are any value elements with a given set of attributes either on the starting node or any graph upsstream of that node.

Parameters:
  • output – Starting node

  • attributes – Attributes to test for

MaterialX.PyMaterialXGenShader.isTransparentSurface(arg0: MaterialX.PyMaterialXCore.Element, arg1: str) bool

Returns true if the given element is a surface shader with the potential of being transparent.

This can be used by HW shader generators to determine if a shader will require transparency handling.

Note: This function will check some common cases for how a surface shader can be transparent. It is not covering all possible cases for how transparency can be done and target applications might need to do additional checks to track transparency correctly. For example, custom surface shader nodes implemented in source code will not be tracked by this function and transparency for such nodes must be tracked separately by the target application.

MaterialX.PyMaterialXGenShader.mapValueToColor(arg0: MaterialX.PyMaterialXCore.Value, arg1: MaterialX.PyMaterialXCore.Color4) None

Maps a value to a four channel color if it is of the appropriate type.

Supported types include float, Vector2, Vector3, Vector4, and Color4. If not mapping is possible the color value is set to opaque black.

MaterialX.PyMaterialXGenShader.requiresImplementation(arg0: MaterialX.PyMaterialXCore.NodeDef) bool

Return whether a nodedef requires an implementation.

MaterialX.PyMaterialXGenShader.tokenSubstitution(arg0: collections.abc.Mapping[str, str], arg1: str) None

Perform token substitutions on the given source string, using the given substitution map.

Tokens are required to start with ‘$’ and can only consist of alphanumeric characters. The full token name, including ‘$’ and all following alphanumeric character, will be replaced by the corresponding string in the substitution map, if the token exists in the map.