OpenVDB
12.0.0
|
Helper class to simplify construction of PRM_Templates and dynamic user interfaces. More...
#include <openvdb_houdini/ParmFactory.h>
Public Types | |
using | AttrFilterFunc = std::function< bool(const GA_Attribute &, const PRM_Parm &, const SOP_Node &)> |
Functor to filter a list of attributes from a SOP's input. More... | |
Public Member Functions | |
ParmFactory (PRM_Type, const std::string &token, const std::string &label) | |
ParmFactory (PRM_MultiType, const std::string &token, const std::string &label) | |
ParmFactory & | setCallbackFunc (const PRM_Callback &) |
ParmFactory & | setChoiceList (const PRM_ChoiceList *) |
Specify a menu of values for this parameter. More... | |
ParmFactory & | setChoiceListItems (PRM_ChoiceListType typ, const std::vector< std::string > &items) |
Specify a menu type and a list of token, label, token, label,... pairs for this parameter. More... | |
ParmFactory & | setChoiceListItems (PRM_ChoiceListType typ, const char *const *items) |
Specify a menu type and a list of token, label, token, label,... pairs for this parameter. More... | |
ParmFactory & | setGroupChoiceList (size_t inputIndex, PRM_ChoiceListType typ=PRM_CHOICELIST_TOGGLE) |
Specify a menu of primitive group names for this parameter. More... | |
ParmFactory & | setAttrChoiceList (size_t inputIndex, GA_AttributeOwner attrOwner, PRM_ChoiceListType typ=PRM_CHOICELIST_TOGGLE, AttrFilterFunc attrFilter=AttrFilterFunc{}) |
Specify a menu of attribute names for this parameter. More... | |
ParmFactory & | setChoiceList (PRM_ChoiceListType typ, const std::vector< std::string > &items, bool paired=false) |
Specify a menu type and either a list of menu item labels or a list of token, label, token, label,... pairs for this parameter. More... | |
ParmFactory & | setChoiceList (PRM_ChoiceListType typ, const char *const *items, bool paired=false) |
Specify a menu type and either a list of menu item labels or a list of token, label, token, label,... pairs for this parameter. More... | |
ParmFactory & | setConditional (const PRM_ConditionalBase *) |
ParmFactory & | setDefault (fpreal, const char *=nullptr, CH_StringMeaning=CH_STRING_LITERAL) |
Specify a default value for this parameter. More... | |
ParmFactory & | setDefault (const std::string &, CH_StringMeaning=CH_STRING_LITERAL) |
Specify a default string value for this parameter. More... | |
ParmFactory & | setDefault (const std::vector< fpreal > &) |
Specify default numeric values for the vector elements of this parameter (assuming its vector size is > 1). More... | |
ParmFactory & | setDefault (const std::vector< PRM_Default > &) |
Specify default values for the vector elements of this parameter (assuming its vector size is > 1). More... | |
ParmFactory & | setDefault (const PRM_Default *) |
Specify a default value or values for this parameter. More... | |
ParmFactory & | setHelpText (const char *) |
Specify a plain text tooltip for this parameter. More... | |
ParmFactory & | setTooltip (const char *) |
Specify a plain text tooltip for this parameter. More... | |
ParmFactory & | setDocumentation (const char *) |
Add documentation for this parameter. More... | |
ParmFactory & | setParmGroup (int) |
ParmFactory & | setRange (PRM_RangeFlag minFlag, fpreal minVal, PRM_RangeFlag maxFlag, fpreal maxVal) |
Specify a range for this parameter's values. More... | |
ParmFactory & | setRange (const std::vector< PRM_Range > &) |
Specify range for the values of this parameter's vector elements (assuming its vector size is > 1). More... | |
ParmFactory & | setRange (const PRM_Range *) |
Specify a range or ranges for this parameter's values. More... | |
ParmFactory & | setSpareData (const SpareDataMap &) |
Specify (key, value) pairs of spare data for this parameter. More... | |
ParmFactory & | setSpareData (const PRM_SpareData *) |
Specify spare data for this parameter. More... | |
ParmFactory & | setMultiparms (const ParmList &) |
Specify the list of parameters for each instance of a multiparm. More... | |
ParmFactory & | setTypeExtended (PRM_TypeExtended) |
Specify an extended type for this parameter. More... | |
ParmFactory & | setVectorSize (int) |
Specify the number of vector elements for this parameter. More... | |
ParmFactory & | setInvisible () |
Mark this parameter as hidden from the UI. More... | |
PRM_Template | get () const |
Construct and return the parameter template. More... | |
Helper class to simplify construction of PRM_Templates and dynamic user interfaces.
using AttrFilterFunc = std::function<bool (const GA_Attribute&, const PRM_Parm&, const SOP_Node&)> |
Functor to filter a list of attributes from a SOP's input.
Arguments to the functor are an attribute to be filtered and the parameter and SOP for which the filter is being called. The functor should return true
for attributes that should be added to the list and false
for attributes that should be ignored.
ParmFactory | ( | PRM_Type | , |
const std::string & | token, | ||
const std::string & | label | ||
) |
ParmFactory | ( | PRM_MultiType | , |
const std::string & | token, | ||
const std::string & | label | ||
) |
PRM_Template get | ( | ) | const |
Construct and return the parameter template.
ParmFactory& setAttrChoiceList | ( | size_t | inputIndex, |
GA_AttributeOwner | attrOwner, | ||
PRM_ChoiceListType | typ = PRM_CHOICELIST_TOGGLE , |
||
AttrFilterFunc | attrFilter = AttrFilterFunc{} |
||
) |
Specify a menu of attribute names for this parameter.
inputIndex | the zero-based index of the input from which to get attributes |
attrOwner | the class of attribute with which to populate the menu: either per-vertex (GA_ATTRIB_VERTEX ), per-point (GA_ATTRIB_POINT ), per-primitive (GA_ATTRIB_PRIMITIVE ), global (GA_ATTRIB_GLOBAL ), or all of the above (GA_ATTRIB_INVALID or any other value) |
typ | the menu behavior (toggle, replace, etc.) |
attrFilter | an optional filter functor that returns true for each attribute that should appear in the menu; the functor will be moved, if possible, or else copied |
ParmFactory& setCallbackFunc | ( | const PRM_Callback & | ) |
ParmFactory& setChoiceList | ( | const PRM_ChoiceList * | ) |
Specify a menu of values for this parameter.
ParmFactory& setChoiceList | ( | PRM_ChoiceListType | typ, |
const std::vector< std::string > & | items, | ||
bool | paired = false |
||
) |
Specify a menu type and either a list of menu item labels or a list of token, label, token, label,... pairs for this parameter.
typ | specifies the menu behavior (toggle, replace, etc.) |
items | a list of menu item labels or token, label, token, label,... pairs |
paired | if false , treat all the elements of items as labels and assign them numeric tokens starting from zero; otherwise, treat the elements of items as token, label, token, label,... pairs |
ParmFactory& setChoiceList | ( | PRM_ChoiceListType | typ, |
const char *const * | items, | ||
bool | paired = false |
||
) |
Specify a menu type and either a list of menu item labels or a list of token, label, token, label,... pairs for this parameter.
typ | specifies the menu behavior (toggle, replace, etc.) |
items | a list of menu item labels or token, label, token, label,... pairs |
paired | if false , treat all the elements of items as labels and assign them numeric tokens starting from zero; otherwise, treat the elements of items as token, label, token, label,... pairs |
ParmFactory& setChoiceListItems | ( | PRM_ChoiceListType | typ, |
const std::vector< std::string > & | items | ||
) |
Specify a menu type and a list of token, label, token, label,... pairs for this parameter.
typ | specifies the menu behavior (toggle, replace, etc.) |
items | a list of token, label, token, label,... string pairs |
ParmFactory& setChoiceListItems | ( | PRM_ChoiceListType | typ, |
const char *const * | items | ||
) |
Specify a menu type and a list of token, label, token, label,... pairs for this parameter.
typ | specifies the menu behavior (toggle, replace, etc.) |
items | a list of token, label, token, label,... string pairs |
ParmFactory& setConditional | ( | const PRM_ConditionalBase * | ) |
ParmFactory& setDefault | ( | fpreal | , |
const char * | = nullptr , |
||
CH_StringMeaning | = CH_STRING_LITERAL |
||
) |
Specify a default value for this parameter.
If the string is null, the floating-point value will be used (but rounded if this parameter is integer-valued).
ParmFactory& setDefault | ( | const std::string & | , |
CH_StringMeaning | = CH_STRING_LITERAL |
||
) |
Specify a default string value for this parameter.
ParmFactory& setDefault | ( | const std::vector< fpreal > & | ) |
Specify default numeric values for the vector elements of this parameter (assuming its vector size is > 1).
Floating-point values will be rounded if this parameter is integer-valued.
ParmFactory& setDefault | ( | const std::vector< PRM_Default > & | ) |
Specify default values for the vector elements of this parameter (assuming its vector size is > 1).
ParmFactory& setDefault | ( | const PRM_Default * | ) |
Specify a default value or values for this parameter.
ParmFactory& setDocumentation | ( | const char * | ) |
Add documentation for this parameter.
Pass a null pointer or an empty string to inhibit the generation of documentation for this parameter.
The text is parsed as wiki markup. See the Houdini Wiki Markup Reference for the syntax.
ParmFactory& setGroupChoiceList | ( | size_t | inputIndex, |
PRM_ChoiceListType | typ = PRM_CHOICELIST_TOGGLE |
||
) |
Specify a menu of primitive group names for this parameter.
inputIndex | the zero-based index of the input from which to get primitive groups |
typ | the menu behavior (toggle, replace, etc.) |
Calling this method with the default (toggle) behavior is equivalent to calling setChoiceList(&houdini_utils::PrimGroupMenuInput1)
, setChoiceList(&houdini_utils::PrimGroupMenuInput2)
, etc.
ParmFactory& setHelpText | ( | const char * | ) |
Specify a plain text tooltip for this parameter.
This method is equivalent to setTooltip()
ParmFactory& setInvisible | ( | ) |
Mark this parameter as hidden from the UI.
ParmFactory& setMultiparms | ( | const ParmList & | ) |
Specify the list of parameters for each instance of a multiparm.
ParmFactory& setParmGroup | ( | int | ) |
ParmFactory& setRange | ( | PRM_RangeFlag | minFlag, |
fpreal | minVal, | ||
PRM_RangeFlag | maxFlag, | ||
fpreal | maxVal | ||
) |
Specify a range for this parameter's values.
ParmFactory& setRange | ( | const std::vector< PRM_Range > & | ) |
Specify range for the values of this parameter's vector elements (assuming its vector size is > 1).
ParmFactory& setRange | ( | const PRM_Range * | ) |
Specify a range or ranges for this parameter's values.
ParmFactory& setSpareData | ( | const SpareDataMap & | ) |
Specify (key, value) pairs of spare data for this parameter.
ParmFactory& setSpareData | ( | const PRM_SpareData * | ) |
Specify spare data for this parameter.
ParmFactory& setTooltip | ( | const char * | ) |
Specify a plain text tooltip for this parameter.
This method is equivalent to setHelpText()
ParmFactory& setTypeExtended | ( | PRM_TypeExtended | ) |
Specify an extended type for this parameter.
ParmFactory& setVectorSize | ( | int | ) |
Specify the number of vector elements for this parameter.
(The default vector size is one element.)