husdshadertranslators package¶
Submodules¶
husdshadertranslators.default module¶
-
class
husdshadertranslators.default.
DefaultShaderTranslator
¶ Translates Houdini shader nodes into USD shader primitives.
-
defineShader
(usd_material, usd_time_code, shader_node, shader_type)¶ Creates a shader, sets its attributes, and links it to the material. usd_material - a UsdShade.Material object inside which to define
the shader.- usd_time_code - time code (frame) at which to evaluate shader
- parameters and at which to set the primitive attributes.
shader_node - a Houdini node representing a shader. shader_type - a particular shader type, in case the shader node
implements several shaders (eg, is a material builder).
-
matchesRenderMask
(render_mask)¶ Returns true if the given render mask matches the render target for which this translator encodes the shaders. Otherwise, returns false.
-
-
class
husdshadertranslators.default.
DefaultShaderTranslatorHelper
(usd_material, usd_time_code, shader_node, requested_shader_type)¶ A class that implements the logic of encoding shader VOP nodes to USD shader primitives.
-
connectShaders
(input_usd_shader, usd_shader, wire)¶ Connects the given usd shaders based on the given connection wire between the shader nodes.
-
constructShaderName
(shader_node)¶ Returns the name of the USD shader primitive based on the given shader node.
-
constructShaderPath
(shader_node)¶ Returns the path of the USD shader primitive based on the given shader node.
-
createAndSetParms
(usd_shader, shader_node)¶ Creates and sets the shader parameters on the usd shader based on the given shader node.
-
createAndSetShaderID
(usd_shader, shader_node)¶ Creates and sets the shader ID attribute on the usd shader.
-
createInput
(usd_shader, wire)¶ Creates an input on the usd shader primitive, given the wire connection.
-
createShader
(shader_node, usd_shader_path)¶ Creates a USD shader primitive at a given path based on a given shader node.
-
defineShader
()¶ Creates a shader and sets its attributes.
-
defineShaderAndLinkToMaterial
()¶ Creates a usd shader primitive, sets its attributes, and links it to the usd material primitive passed in constructor.
-
defineShaderChain
(shader_node)¶ Creates a shader and shader inputs based on shader_node parameter and sets its attributes.
-
getInputSdfType
(wire)¶ Figures out the USD input type given the connection wire between two Houdini nodes.
-
getMaterialToShaderLinkName
()¶ Returns the name of the relationship that links the material to the shader for a given render taget and shading purpose.
-
getMultiParmTranslator
(node_parm)¶ Returns a translator for multi-parameters.
-
getParmTranslator
(node_parm)¶ Obtains an object that can create and set a USD primitive’s attribute corresponding to the given node parameter.
-
getRampParmTranslator
(node_parm)¶ Returns a translator for ramp parameters.
-
getSimpleParmTranslator
(node_parm)¶ Returns a translator for simple parameters.
-
linkMaterialToShader
(usd_shader)¶ Sets the given usd_shader as a specific shader relationship on the USD material.
-
material
()¶ Returns the USD material inside which to define a shader.
-
sdfTypeFromVopTypeName
(vop_type)¶ Returns usd value type name given the vop data type name (a string).
-
setTranslateOnlyNonDefaultParms
(flag)¶ Sets a flag indicating whether to set values for all known shader parameters (prim attributes), or only the values that are different from the fallback values.
-
setUseSpecificRenderContext
(flag)¶ If true, the translator will use render mask and specific render context name in palces like material outputs. Otherwise, it will use a universal render context.
-
shaderNode
()¶ Returns the Houdini VOP node representing the material/shader.
-
shaderType
()¶ Returns the requested shader type that the VOP node should provide.
-
shaderTypeString
()¶ Returns the standard string representation of shader type. It can be used for connectiong material and shader outputs.
-
stage
()¶ Returns the USD stage on which to define the shader primitive.
-
timeCode
()¶ Returns the USD time code at which to evaluate/set attributes.
-
-
class
husdshadertranslators.default.
MultiParmTranslator
(node_parm)¶ Bases:
husdshadertranslators.default.ParmTranslator
A class that implements the logic of encoding a multi-parm VOP node parameter as an attribute on a USD primitive.
-
adjustTimeCode
(usd_time_code)¶ Returns an adjusted time code based on the one passed in as parameter, checking whether the parameter is animatable, etc.
-
createAndSetAttrib
(usd_shader, usd_time_code)¶ Creates an attribute on the usd shader primitive and sets its value according to the member node parameter, at the specified time code.
-
createAttrib
(usd_shader)¶ Creates a parameter attribute on the usd shader primitive for the member multi-parm node parameter.
-
evalParm
(usd_time_code)¶ Evaluates member multi-parm parameter as array.
-
-
class
husdshadertranslators.default.
ParmTranslator
(node_parm)¶ A class that implements the logic of encoding VOP node parameters as attributes on a USD primitive.
-
adjustTimeCode
(usd_time_code)¶ Returns an adjusted time code based on the one passed in as parameter, checking whether the parameter is animatable, etc.
-
createAndSetAttrib
(usd_shader, usd_time_code)¶ Creates an attribute on the usd shader primitive and sets its value according to the member node parameter, at the specified time code.
-
nodeParm
()¶ Returns the parameter to be translated to a USD attribute.
-
sdfTypeFromParm
(node_parm)¶ Returns a usd value type name given the node’s parameter.
-
setAttribTypeResolver
(resolver)¶ Sets a callback function that returns an Sdf type name given a node parameter as an argument.
-
valueFromParm
(node_parm, usd_time_code)¶ Evaluates node’s parameter and returns the value tuple.
-
-
class
husdshadertranslators.default.
RampParmTranslator
(node_parm)¶ Bases:
husdshadertranslators.default.ParmTranslator
A class that implements the logic of encoding a ramp VOP node parameter as an attribute on a USD shader primitive.
-
createAndSetAttrib
(usd_shader, usd_time_code)¶ Creates an attribute on the usd shader primitive and sets its value according to the member node parameter, at the specified time code.
-
createBasisAttrib
(usd_shader)¶ Creates a usd shader attribute for the ramp basis component.
-
createKeyCountAttrib
(usd_shader)¶ Creates a usd shader attribute for the ramp key count.
-
createKeysAttrib
(usd_shader)¶ Creates a usd shader attribute for the ramp key positions component.
-
createValuesAttrib
(usd_shader)¶ Creates a usd shader attribute for the ramp control points values component.
-
evalParm
(usd_time_code)¶ Evaluates member ramp parameter.
-
getRampBasisMap
()¶ Returns a map from enumerated values of ramp interpolation to the string names of such interpolation.
-
getRampBasisValue
(ramp_val)¶ Returns the value of the ramp basis given the ramp.
-
setBasisAttrib
(usd_attrib, ramp_val, usd_time_code)¶ Sets the ramp basis attribute, usd_attrib, to the basis of the ramp_val.
-
setKeyCountAttrib
(usd_attrib, ramp_val, usd_time_code)¶ Sets the ramp count attribute, usd_attrib, to the key count of the ramp_val.
-
setKeysAttrib
(usd_attrib, ramp_val, usd_time_code)¶ Sets the ramp keys attribute, usd_attrib, to the keys (positions) of the ramp_val.
-
setValuesAttrib
(usd_attrib, ramp_val, usd_time_code)¶ Sets the ramp values attribute, usd_attrib, to the interpolation values of the ramp_val.
-
-
class
husdshadertranslators.default.
SimpleParmTranslator
(node_parm)¶ Bases:
husdshadertranslators.default.ParmTranslator
A class that implements the logic of encoding a simple VOP node parameter as an attribute on a USD primitive. Does not handle complex parameters such as ramps or multi-parms.
-
createAndSetAttrib
(usd_shader, usd_time_code)¶ Creates an attribute on the usd shader primitive and sets its value according to the member node parameter, at the specified time code.
-
createAttrib
(usd_shader)¶ Creates an attribute on the usd shader primitive based on member parameter type.
-
evalParm
(usd_time_code)¶ Evaluates member parameter.
-
-
husdshadertranslators.default.
convertValueIfNeeded
(value, usd_type)¶ Tries to perform a trivial conversion if the types don’t match.
-
husdshadertranslators.default.
createUsdAttrib
(usd_shader, attrib_name, usd_type)¶ Creates an attribute on the usd shader (schema).
-
husdshadertranslators.default.
createUsdAttribOrInput
(usd_shader, name, usd_type, shader_node)¶ Creates an attribute or input depending on whether there is a connection wire. Returns created attribute
-
husdshadertranslators.default.
createUsdInput
(usd_shader, input_name, usd_type)¶ Creates an input on the usd shader (schema).
-
husdshadertranslators.default.
isSdfArray
(usd_type)¶ Returns true if usd_type name is an array.
-
husdshadertranslators.default.
isSdfScalar
(usd_type)¶ Returns true if usd_type name is a scalar.
-
husdshadertranslators.default.
sdfTypeFromParm
(node_parm)¶ Returns a usd value type name given the node’s parameter tags or (if tag is not found) its type and size
-
husdshadertranslators.default.
sdfTypeFromParmTag
(node_parm)¶ Returns a usd value type name given the node’s parameter tag value.
-
husdshadertranslators.default.
sdfTypeFromParmTypeAndSize
(node_parm)¶ Returns a usd value type name given the node’s parameter type and size.
-
husdshadertranslators.default.
sdfValueFromParmValue
(parm_value, usd_type)¶ Converts the value to format acceptable by usd (based on the given usd type).
-
husdshadertranslators.default.
setUsdAttrib
(usd_attrib, node_parm_value, usd_time_code)¶ Sets the given usd attribute to the given node parameter value.
-
husdshadertranslators.default.
usdShaderTranslator
()¶
husdshadertranslators.display module¶
-
class
husdshadertranslators.display.
DisplayShaderTranslator
¶ Translates display shader nodes into USD shader primitives. See husdshadertranslators.default.DefaultShaderTranslator for details.
-
defineShader
(usd_material, usd_time_code, shader_node, shader_type)¶
-
matchesRenderMask
(render_mask)¶
-
-
class
husdshadertranslators.display.
DisplayShaderTranslatorHelper
(usd_material, usd_time_code, shader_node, shader_type)¶ Bases:
husdshadertranslators.default.DefaultShaderTranslatorHelper
-
createAndSetShaderID
(usd_shader, shader_node)¶
-
-
husdshadertranslators.display.
usdShaderTranslator
()¶
husdshadertranslators.modulelister module¶
-
husdshadertranslators.modulelister.
translatorModulesNames
()¶ Returns the names of all the modules in the husdshadertranslators packages.
husdshadertranslators.ris module¶
-
class
husdshadertranslators.ris.
RisShaderTranslator
¶ Translates Ris shader nodes into USD shader primitives. See husdshadertranslators.default.DefaultShaderTranslator for details.
-
defineShader
(usd_material, usd_time_code, shader_node, shader_type)¶
-
matchesRenderMask
(render_mask)¶
-
-
class
husdshadertranslators.ris.
RisShaderTranslatorHelper
(usd_material, usd_time_code, shader_node, shader_type)¶ Bases:
husdshadertranslators.default.DefaultShaderTranslatorHelper
-
createAndSetShaderID
(usd_shader, shader_node)¶ Creates and sets the shader ID attribute on the usd shader based on the given shader node.
-
createShader
(shader_node, usd_shader_path)¶ Creates an appropriate USD shader primitive.
-
linkMaterialToShader
(usd_shader)¶ Sets the given usd_shader as a specific shader relationship on the USD material.
-
-
husdshadertranslators.ris.
risSdfTypeFromParm
(node_parm)¶ Returns a usd value type name given the node’s parameter tags or (if tag is not found) its type and size
-
husdshadertranslators.ris.
risSdfTypeFromParmTag
(node_parm)¶ Returns a usd value type name given the node’s parameter.
-
husdshadertranslators.ris.
usdShaderTranslator
()¶
husdshadertranslators.usd module¶
-
class
husdshadertranslators.usd.
PrimvarReaderShaderTranslator
(usd_shader, shader_node)¶ Utility class for encoding Primvar Reader shader based on the ‘usdprimvarreader’ VOP Node, that has signatures corresponding to the available return types of that standard USD shader.
-
createAndSetPrimReaderAttrib
(attrib_name, parm_name, time_code)¶ Helper function for creating and setting the value of an attribute.
-
createAndSetPrimReaderAttribs
(time_code)¶ Creates and sets the shader parameters for the Prim Reader shader.
-
createAndSetPrimvarReaderID
()¶ Creates and sets the shader ID attribute for Primvar Reader shader represented by the shader_node.
-
getPrimReaderFallbackParmName
()¶ Returns the parameter name containing the fallback value.
-
-
class
husdshadertranslators.usd.
StandardShaderTranslator
¶ Translates standard USD Houdini shader nodes into USD shader primitives. See husdshadertranslators.default.DefaultShaderTranslator for details.
-
defineShader
(usd_material, usd_time_code, shader_node, shader_type)¶
-
matchesRenderMask
(render_mask)¶
-
-
class
husdshadertranslators.usd.
StandardShaderTranslatorHelper
(usd_material, usd_time_code, shader_node, shader_type)¶ Bases:
husdshadertranslators.default.DefaultShaderTranslatorHelper
-
createAndSetParms
(usd_shader, shader_node)¶ Creates and sets the shader parameters on the usd shader based on the given shader node.
-
createAndSetShaderID
(usd_shader, shader_node)¶ Creates and sets the shader ID attribute on the usd shader.
-
-
husdshadertranslators.usd.
usdShaderTranslator
()¶