MaterialX.PyMaterialXGenOsl Module

Inheritance diagram of MaterialX.PyMaterialXGenOsl

Shader generation using Open Shading Language.

class MaterialX.PyMaterialXGenOsl.OslShaderGenerator

Bases: ShaderGenerator

Base class for OSL (Open Shading Language) shader generators.

A generator for a specific OSL target should be derived from this class.

static create() MaterialX.PyMaterialXGenShader.ShaderGenerator
generate(self: MaterialX.PyMaterialXGenOsl.OslShaderGenerator, arg0: str, arg1: MaterialX.PyMaterialXCore.Element, arg2: MaterialX.PyMaterialXGenShader.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.PyMaterialXGenOsl.OslShaderGenerator) str

Return a unique identifier for 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.