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

#include <UT_PropertyTable.h>

Classes

class  PropertySubsetList
 Relatively lightweight representation of a subset of a UT_PropertyList. More...
 

Public Types

using OptionEntryPtr = UT_SharedPtr< UT_OptionEntry >
 

Public Member Functions

 UT_PropertyTable (const char *table_name, bool verbose=false)
 
 UT_PropertyTable (UT_JSONParser &p, const char *filename=nullptr, bool verbose=false)
 
bool loadStatus () const
 Return the load status of the table in the c-tor. More...
 
int getNumProps () const
 
int getPropIndex (const UT_StringRef &name)
 
const UT_StringHoldergetPropName (int i) const
 
const UT_StringHoldergetPropLabel (int i) const
 
const UT_StringHoldergetPropParm (int i) const
 
OptionEntryPtr getPropDefault (int i) const
 
fpreal64 getMin (int i) const
 
fpreal64 getMax (int i) const
 
int findRName (const UT_StringRef &name) const
 
int findHName (const UT_StringRef &name) const
 
exint size () const
 Number of properties stored in the table. More...
 
const UT_StringHolderrclass (int i) const
 Return the class of the rendering property (i.e. "object") More...
 
const UT_StringHolderrname (int i) const
 Return the name of the rendering property (i.e. "coving") More...
 
const UT_StringHolderhname (int i) const
 Return the name of the houdini parameter (i.e. "vm_coving") More...
 
const UT_StringHolderlabel (int i) const
 Return the label of the houdini parameter (i.e. "Coving") More...
 
OptionEntryPtr value (int i) const
 Return the default value of the houdini parameter (i.e. 1) More...
 
const UT_JSONValueMapjsonMap (int i) const
 Return a raw JSONValueMap representing the property. More...
 
bool save (UT_JSONWriter &w, const UT_IntArray *select=nullptr) const
 Debug the settings. More...
 
void dump (const UT_IntArray *select=nullptr) const
 
const PropertySubsetListgetSubset (const UT_StringRef &name)
 
const PropertySubsetListgetSubset (const UT_StringRef names[], exint arraylen)
 
template<typename SELECT >
SYS_FORCE_INLINE void select (UT_Array< const UT_JSONValueMap * > &matched, SELECT &predicate)
 
template<typename FUNC , typename SELECT >
SYS_FORCE_INLINE void filter (FUNC &func, SELECT &predicate)
 
fpreal64 minValue (int i) const
 
fpreal64 maxValue (int i) const
 
template<typename T >
SYS_FORCE_INLINE bool import (int idx, const UT_StringRef &name, T &val) const
 
template<typename T >
SYS_FORCE_INLINE bool import (int idx, const UT_StringRef &name, T *val, int size) const
 

Detailed Description

This class represents a table of (mantra) properties. A property consists of a name (the name used by mantra), a parm name (the name of the houdini parameter that corresponds to the mantra property), the data type of the property, and the default value of the property.

This information is somewhat scattered right now, with the parameter definition in the $HH/properties/soho/IFDmantra.ds file, the translation from houdini to mantra names in $HH/soho/base/IFDmantra.py, and the defaults as mantra understands them (which should but may not match the defaults in the parameter definitions) in $RAY/RAY_Settings.C. At some point all references to render properties should be through this class.

The property table is loaded from a JSON array where each item in the array is a dictionary defining a property. The items to define the property are:

  • "string class" (required): Specifies the rendering class of the property (i.e. "renderer", "object" or "option")
  • "string name" (required): The renderer name for the property
  • "string hname" (required): The name of the Houdini parameter
  • "<type> default" (required): The default value. This may be one of:
    • bool
    • number
    • string
    • array of numbers
    • array of strings
  • "string label" (optional): The label of the Houdini parameter
  • "float min" (optional): Suggested minimum value for numeric types
  • "float max" (optional): Suggested maximum value for numeric types

Definition at line 53 of file UT_PropertyTable.h.

Member Typedef Documentation

Constructor & Destructor Documentation

UT_PropertyTable::UT_PropertyTable ( const char *  table_name,
bool  verbose = false 
)
UT_PropertyTable::UT_PropertyTable ( UT_JSONParser p,
const char *  filename = nullptr,
bool  verbose = false 
)

Member Function Documentation

void UT_PropertyTable::dump ( const UT_IntArray select = nullptr) const
template<typename FUNC , typename SELECT >
SYS_FORCE_INLINE void UT_PropertyTable::filter ( FUNC &  func,
SELECT &  predicate 
)
inline

Run an operation on a selection of properties from the table. The SELECT method takes a const reference to the UT_JSONValueMap and should return true if the functor should be called.

Definition at line 215 of file UT_PropertyTable.h.

int UT_PropertyTable::findHName ( const UT_StringRef name) const

Find property by the Houdini parameter name The method returns -1 if the parameter isn't found.

int UT_PropertyTable::findRName ( const UT_StringRef name) const

Find a property by the renderer property name. This will find names like "global:lod", but also "lod". The first usage (with class specifier) avoids name aliasing between different rendering classes. The method returns -1 if the property isn't found.

fpreal64 UT_PropertyTable::getMax ( int  i) const
inline

Definition at line 84 of file UT_PropertyTable.h.

fpreal64 UT_PropertyTable::getMin ( int  i) const
inline

Definition at line 82 of file UT_PropertyTable.h.

int UT_PropertyTable::getNumProps ( ) const
inline

Definition at line 68 of file UT_PropertyTable.h.

OptionEntryPtr UT_PropertyTable::getPropDefault ( int  i) const
inline

Definition at line 80 of file UT_PropertyTable.h.

int UT_PropertyTable::getPropIndex ( const UT_StringRef name)
inline

Definition at line 70 of file UT_PropertyTable.h.

const UT_StringHolder& UT_PropertyTable::getPropLabel ( int  i) const
inline

Definition at line 76 of file UT_PropertyTable.h.

const UT_StringHolder& UT_PropertyTable::getPropName ( int  i) const
inline

Definition at line 74 of file UT_PropertyTable.h.

const UT_StringHolder& UT_PropertyTable::getPropParm ( int  i) const
inline

Definition at line 78 of file UT_PropertyTable.h.

const PropertySubsetList& UT_PropertyTable::getSubset ( const UT_StringRef name)
inline

Definition at line 181 of file UT_PropertyTable.h.

const PropertySubsetList& UT_PropertyTable::getSubset ( const UT_StringRef  names[],
exint  arraylen 
)
const UT_StringHolder& UT_PropertyTable::hname ( int  i) const

Return the name of the houdini parameter (i.e. "vm_coving")

template<typename T >
SYS_FORCE_INLINE bool UT_PropertyTable::import ( int  idx,
const UT_StringRef name,
T val 
) const
inline

Import a value from a property

Definition at line 121 of file UT_PropertyTable.h.

template<typename T >
SYS_FORCE_INLINE bool UT_PropertyTable::import ( int  idx,
const UT_StringRef name,
T val,
int  size 
) const
inline

Import a value from a property

Definition at line 125 of file UT_PropertyTable.h.

const UT_JSONValueMap& UT_PropertyTable::jsonMap ( int  i) const
inline

Return a raw JSONValueMap representing the property.

Definition at line 115 of file UT_PropertyTable.h.

const UT_StringHolder& UT_PropertyTable::label ( int  i) const

Return the label of the houdini parameter (i.e. "Coving")

bool UT_PropertyTable::loadStatus ( ) const
inline

Return the load status of the table in the c-tor.

Definition at line 65 of file UT_PropertyTable.h.

fpreal64 UT_PropertyTable::maxValue ( int  i) const

For numeric values, return the expected range of the values. These is typically a suggested range.

fpreal64 UT_PropertyTable::minValue ( int  i) const

For numeric values, return the expected range of the values. These is typically a suggested range.

const UT_StringHolder& UT_PropertyTable::rclass ( int  i) const

Return the class of the rendering property (i.e. "object")

const UT_StringHolder& UT_PropertyTable::rname ( int  i) const

Return the name of the rendering property (i.e. "coving")

bool UT_PropertyTable::save ( UT_JSONWriter w,
const UT_IntArray select = nullptr 
) const

Debug the settings.

template<typename SELECT >
SYS_FORCE_INLINE void UT_PropertyTable::select ( UT_Array< const UT_JSONValueMap * > &  matched,
SELECT &  predicate 
)
inline

Function to extract a list of properties as an array of UT_JSONValueMaps The SELECT method takes a const reference to the UT_JSONValueMap and should return true if the map should be added. For example, to find all the karma global rendering properties, you can do something like:

ptable.select(globals, [](const UT_JSONValueMap &prop)
{
UT_StringHolder _renderer;
return prop.import("renderer", _renderer)
&& prop.import("class", _class)
&& renderer == "karma"
&& _class == "global";
});

Definition at line 203 of file UT_PropertyTable.h.

exint UT_PropertyTable::size ( void  ) const
inline

Number of properties stored in the table.

Definition at line 96 of file UT_PropertyTable.h.

OptionEntryPtr UT_PropertyTable::value ( int  i) const

Return the default value of the houdini parameter (i.e. 1)


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