HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VOP_ScriptMaterialInfo Class Reference

#include <VOP_ScriptMaterialInfo.h>

Public Types

using ExportsMap = UT_Map< VOP_Type, UT_Array< VOP_FunctionArgInfo >>
 Map: shader type -> list of exported parameters in that shader. More...
 
using LayerExportsMap = UT_StringMap< UT_Map< VOP_Type, VOP_ShaderLayerExports >>
 Map: outupt name, shader type -> shader layer exports. More...
 

Public Member Functions

 VOP_ScriptMaterialInfo (OP_Network *owner)
 
virtual ~VOP_ScriptMaterialInfo ()
 
bool loadInfo (UT_IStream &is)
 
bool providesVopType (VOP_Type shader_type)
 
bool getCodeSectionName (UT_String &section_name, VOP_Type shader_type)
 
void getExportParmInfos (UT_Array< VOP_FunctionArgInfo > &arg_infos, VOP_Type shader_type) const
 Returns all known export parameters of a shader. More...
 
virtual bool getParameterOrProperty (const UT_StringRef &name, fpreal now, OP_Node *&op, PRM_Parm *&parm, bool create_missing_multiparms, PRM_ParmList *obsolete)
 Track down the parameter associated with a given property. More...
 
virtual bool getParameterOrPropertyByChannel (const UT_StringRef &chname, fpreal now, OP_Node *&op, PRM_Parm *&parm, int &vector_index, PRM_ParmList *obsolete)
 Track down the parameter associated with a given a channel name. More...
 
virtual int findParametersOrProperties (fpreal now, OP_PropertyLookupList &list)
 
virtual VOP_NodegetProcedural (VOP_Type type)
 
virtual OP_NodegetChild (const char *name, int *hint=NULL) const
 Returns the phantom node of a given name or NULL if no such child found. More...
 
UT_IntArray getShaderLayerExportsInputsToCopy (const char *out_name, VOP_Type shader_type) const
 
UT_StringHolder getShaderLayerExportsToAdd (const char *out_name, VOP_Type shader_type) const
 

Static Public Member Functions

static bool encodeInfo (UT_String &buffer, OP_Node &material, VOP_ScriptMaterialCodeMapper *mapper)
 
static void getReferencedSectionNames (UT_IStream &is, UT_StringArray &names)
 Obtains the names of the HDA code sections that are used by this info. More...
 

Detailed Description

Definition at line 65 of file VOP_ScriptMaterialInfo.h.

Member Typedef Documentation

Map: shader type -> list of exported parameters in that shader.

Definition at line 178 of file VOP_ScriptMaterialInfo.h.

Map: outupt name, shader type -> shader layer exports.

Definition at line 182 of file VOP_ScriptMaterialInfo.h.

Constructor & Destructor Documentation

VOP_ScriptMaterialInfo::VOP_ScriptMaterialInfo ( OP_Network owner)

Constructor. Takes an 'owner' as an argument, to make it possible for phantom nodes to report their full path and shader code section to be picked based on parameter value of the switch indices (top level parameters on owner).

virtual VOP_ScriptMaterialInfo::~VOP_ScriptMaterialInfo ( )
virtual

Member Function Documentation

static bool VOP_ScriptMaterialInfo::encodeInfo ( UT_String buffer,
OP_Node material,
VOP_ScriptMaterialCodeMapper mapper 
)
static

Static function for encoding the relevant child nodes of the material vopnet into a serialized stream, parsable by the instantiation methods of this class. Returns true if there was some relevant info to encode and there were no errors while encoding that info.

Parameters
bufferOutgoing argument that will contain the encoded info in an XML form.
materialVopnet material node whose metadata needs to be saved. The metadata is in the form of child nodes that don't participate in the vex shader generation (such as properties nodes and procedurals). However information about such nodes is necessary for proper functioning of the compiled material HDAs.
mapperMaps the operator paths of encapsulated shaders found in the material node into the HDA section names that contain vex code for these shader nodes.
virtual int VOP_ScriptMaterialInfo::findParametersOrProperties ( fpreal  now,
OP_PropertyLookupList list 
)
virtual

Track down the parameters or properties in the given list. Fill out the property lookup list with parameters. Returns the total of found and resolved parameters in the list (whether they were resolved by previous calls or this particular call).

virtual OP_Node* VOP_ScriptMaterialInfo::getChild ( const char *  name,
int hint = NULL 
) const
virtual

Returns the phantom node of a given name or NULL if no such child found.

bool VOP_ScriptMaterialInfo::getCodeSectionName ( UT_String section_name,
VOP_Type  shader_type 
)

Returns a name of the HDA section that has the vex code that should be used for the shader of a given type. HDA materials may have several code sections for the same shader type if the original node had several Output VOP nodes connected to the Collect VOP node via Switch VOPs. This method mimics the switch vop hierarchy to make a decision as to which shader code to use.

void VOP_ScriptMaterialInfo::getExportParmInfos ( UT_Array< VOP_FunctionArgInfo > &  arg_infos,
VOP_Type  shader_type 
) const

Returns all known export parameters of a shader.

virtual bool VOP_ScriptMaterialInfo::getParameterOrProperty ( const UT_StringRef name,
fpreal  now,
OP_Node *&  op,
PRM_Parm *&  parm,
bool  create_missing_multiparms,
PRM_ParmList obsolete 
)
virtual

Track down the parameter associated with a given property.

virtual bool VOP_ScriptMaterialInfo::getParameterOrPropertyByChannel ( const UT_StringRef chname,
fpreal  now,
OP_Node *&  op,
PRM_Parm *&  parm,
int vector_index,
PRM_ParmList obsolete 
)
virtual

Track down the parameter associated with a given a channel name.

virtual VOP_Node* VOP_ScriptMaterialInfo::getProcedural ( VOP_Type  type)
virtual

Returns a procedural shader node of a given type if it has one, otherwise returns NULL.

static void VOP_ScriptMaterialInfo::getReferencedSectionNames ( UT_IStream is,
UT_StringArray names 
)
static

Obtains the names of the HDA code sections that are used by this info.

UT_IntArray VOP_ScriptMaterialInfo::getShaderLayerExportsInputsToCopy ( const char *  out_name,
VOP_Type  shader_type 
) const

Returns info needed for constructing output variable tags for describing shader layer exports.

UT_StringHolder VOP_ScriptMaterialInfo::getShaderLayerExportsToAdd ( const char *  out_name,
VOP_Type  shader_type 
) const

Returns info needed for constructing output variable tags for describing shader layer exports.

bool VOP_ScriptMaterialInfo::loadInfo ( UT_IStream is)

This method parses and loads information from the stream (created with encodeInfo()). It initializes the internal data structures so that it can properly handle all the other requests and queries from other methods.

It creates phantom nodes within an owner network. Phantom nodes represent render properties, procedural shaders, and encapsulated shaders that were part of the original material node, but which cannot be part of the HDA since it is a compiled code (ie, childless) node type. Houdini still considers myParentNode as a childless node so users cannot dive it and see them, but the phantom nodes are still present. Namely, when knowing their exact node paths and searching for them with findNode(). So, the 'parent' argument is necessary so that phantom nodes can report a valid full path.

It also parses the information about the code sections that are present in the HDA. This info is used to pick a correct shader code from a correct section, in case there are a few versions of the shader, each corresponding to an Output VOP node, which are picked by Switch VOPs connected as inputs to the Collect VOP.

bool VOP_ScriptMaterialInfo::providesVopType ( VOP_Type  shader_type)

Returns true if the instance of this class contains relevant information for the given shader type and can answer the queries for this type.


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