HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HUSD_ShaderTranslator Class Referenceabstract

Creates a USD shader primitives from Houdini's nodes. More...

#include <HUSD_ShaderTranslator.h>

+ Inheritance diagram for HUSD_ShaderTranslator:

Classes

class  ActiveToken
 

Public Member Functions

virtual ~HUSD_ShaderTranslator ()=default
 Standard virtual destructor for this abstract base class. More...
 
virtual bool matchesRenderMask (const UT_StringRef &render_mask)=0
 
virtual void createMaterialShader (HUSD_AutoWriteLock &lock, const UT_StringRef &usd_material_path, const HUSD_TimeCode &time_code, OP_Node &shader_node, VOP_Type shader_type, const UT_StringRef &output_name)=0
 
virtual UT_StringHolder createShader (HUSD_AutoWriteLock &lock, const UT_StringRef &usd_material_path, const UT_StringRef &usd_parent_path, const UT_StringRef &usd_shader_name, const HUSD_TimeCode &time_code, OP_Node &shader_node, const UT_StringRef &output_name)=0
 
virtual void updateShaderParameters (HUSD_AutoWriteLock &lock, const UT_StringRef &usd_shader_path, const HUSD_TimeCode &time_code, OP_Node &shader_node, const UT_StringArray &parameter_names)=0
 
virtual UT_StringHolder getRenderContextName (OP_Node &shader_node, const UT_StringRef &output_name)=0
 
virtual void setID (int id)
 Some translators may want to know their ID in the registry. More...
 
virtual int getID () const
 
void setDependentNodeIDs (const UT_IntArray &node_ids)
 Designates the nodes as shader node dependents, given their IDs. More...
 
const UT_IntArraygetDependentNodeIDs () const
 
virtual void beginMaterialTranslation (HUSD_AutoWriteLock &lock, const UT_StringRef &usd_material_path)
 
virtual void endMaterialTranslation (HUSD_AutoWriteLock &lock, const UT_StringRef &usd_material_path)
 

Static Public Member Functions

static bool isTranslatorActive (int thread)
 

Detailed Description

Creates a USD shader primitives from Houdini's nodes.

Definition at line 36 of file HUSD_ShaderTranslator.h.

Constructor & Destructor Documentation

virtual HUSD_ShaderTranslator::~HUSD_ShaderTranslator ( )
virtualdefault

Standard virtual destructor for this abstract base class.

Member Function Documentation

virtual void HUSD_ShaderTranslator::beginMaterialTranslation ( HUSD_AutoWriteLock lock,
const UT_StringRef usd_material_path 
)
virtual

Methods that delineate the authoring of a USD material primitive. The first method is called before this translator is asked to translate any shader into the given material, while the second one is called after all relevant shader have been translated. This allows the translator to do some preparatory or cleanup work. For example to configure the USD material, or to reset any caches.

virtual void HUSD_ShaderTranslator::createMaterialShader ( HUSD_AutoWriteLock lock,
const UT_StringRef usd_material_path,
const HUSD_TimeCode time_code,
OP_Node shader_node,
VOP_Type  shader_type,
const UT_StringRef output_name 
)
pure virtual

Defines a USD shader primitive that is part of the USD material. Ie, the translator will connect the shader to the material output.

usd_material_path - path to the material primitive in which the shader primitive should be created. time_code - time code at which to evaluate any properties shader_node - the Houdini node that represents a shader and that needs to be translated into a USD shader primitive shader_type - some VOPs contains several shaders (eg material builders). So this parameters specifies the type of the shader to pick and translate. output_name - the output name of the VOP node that represents the shader to pick and translate. It can be an empty string, if the VOP node does not have shader outputs.

Implemented in HUSD_VexShaderTranslator.

virtual UT_StringHolder HUSD_ShaderTranslator::createShader ( HUSD_AutoWriteLock lock,
const UT_StringRef usd_material_path,
const UT_StringRef usd_parent_path,
const UT_StringRef usd_shader_name,
const HUSD_TimeCode time_code,
OP_Node shader_node,
const UT_StringRef output_name 
)
pure virtual

Defines a USD shader primitive that is part of a shader network chain. Ie, the translator will create a shader primitive output, that the caller can use to connect as an input to another shader.

usd_material_path - path to the material primitive in which the shader primitive should be created. usd_parent_path - path to the primitive inside which the shader primitive should be created directly. usd_shader_name - name of the shader primitive to create, (may be an empty string, in which case use node name, etc). time_code - time code at which to evaluate any properties shader_node - the Houdini node that represents a shader and that needs to be translated into a USD shader primitive output_name - the output name of the VOP node that needs to be translated into USD shader output. This is the output the caller is interested in having representation in USD.

Returns
The path to the USD shader output attribute corresponding to the output_name connector on the shader_node.

Implemented in HUSD_VexShaderTranslator.

virtual void HUSD_ShaderTranslator::endMaterialTranslation ( HUSD_AutoWriteLock lock,
const UT_StringRef usd_material_path 
)
virtual

Methods that delineate the authoring of a USD material primitive. The first method is called before this translator is asked to translate any shader into the given material, while the second one is called after all relevant shader have been translated. This allows the translator to do some preparatory or cleanup work. For example to configure the USD material, or to reset any caches.

const UT_IntArray& HUSD_ShaderTranslator::getDependentNodeIDs ( ) const
inline

Definition at line 161 of file HUSD_ShaderTranslator.h.

virtual int HUSD_ShaderTranslator::getID ( ) const
inlinevirtual

Definition at line 156 of file HUSD_ShaderTranslator.h.

virtual UT_StringHolder HUSD_ShaderTranslator::getRenderContextName ( OP_Node shader_node,
const UT_StringRef output_name 
)
pure virtual

Returns the name of the renderer (render context name) that should be used in the material output name for that USD shader.

Implemented in HUSD_VexShaderTranslator.

static bool HUSD_ShaderTranslator::isTranslatorActive ( int  thread)
inlinestatic

Returns true if there are any shader translators executing on the given thread (ie, if passed current thread's ID, ie it checks the call originates from a translator on the call stack).

Definition at line 79 of file HUSD_ShaderTranslator.h.

virtual bool HUSD_ShaderTranslator::matchesRenderMask ( const UT_StringRef render_mask)
pure virtual

Returns true if the translator can encode a shader that reports a given render mask (ie, is a shader for a given render target).

Implemented in HUSD_VexShaderTranslator.

void HUSD_ShaderTranslator::setDependentNodeIDs ( const UT_IntArray node_ids)
inline

Designates the nodes as shader node dependents, given their IDs.

Definition at line 159 of file HUSD_ShaderTranslator.h.

virtual void HUSD_ShaderTranslator::setID ( int  id)
inlinevirtual

Some translators may want to know their ID in the registry.

Definition at line 155 of file HUSD_ShaderTranslator.h.

virtual void HUSD_ShaderTranslator::updateShaderParameters ( HUSD_AutoWriteLock lock,
const UT_StringRef usd_shader_path,
const HUSD_TimeCode time_code,
OP_Node shader_node,
const UT_StringArray parameter_names 
)
pure virtual

Re-translates the shader parameters given the shader VOP node (and its new parameter values). usd_shader_path - the path to the USD shader primitive whose input attributes need updating due to node parm value change. time_code - time code at which to evaluate any properties shader_node - Houdini node that represents a shader that needs to be re-translated into the given USD shader primitive. parameter_names - the list of parameters that have changed. If the list is empty, then any of the node's parameters may have changed. If it's not empty, then only listed parameters have changed.

Implemented in HUSD_VexShaderTranslator.


The documentation for this class was generated from the following file: