OpenVDB
12.0.0
|
Helper class to simplify operator registration. More...
#include <openvdb_houdini/ParmFactory.h>
Inherited by OpenVDBOpFactory.
Public Types | |
enum | OpFlavor { SOP, POP, ROP, VOP, HDA } |
using | CacheAllocFunc = std::function< SOP_NodeCache *(void)> |
Functor that returns newly-allocated node caches for instances of this operator. More... | |
Public Member Functions | |
template<typename OpPolicyType > | |
OpFactory (const OpPolicyType &, const std::string &english, OP_Constructor ctor, ParmList &parms, OP_OperatorTable &table, OpFlavor flavor=SOP) | |
Construct a factory that on destruction registers a new operator type. More... | |
OpFactory (const std::string &english, OP_Constructor ctor, ParmList &parms, OP_OperatorTable &table, OpFlavor flavor=SOP) | |
virtual | ~OpFactory () |
Register the operator. More... | |
OpFactory (const OpFactory &)=delete | |
OpFactory & | operator= (const OpFactory &)=delete |
OpFlavor | flavor () const |
Return the new operator's flavor (SOP, POP, etc.). More... | |
std::string | flavorString () const |
Return the new operator's flavor as a string ("SOP", "POP", etc.). More... | |
const std::string & | name () const |
Return the new operator's type name. More... | |
const std::string & | english () const |
Return the new operator's UI name. More... | |
const std::string & | iconName () const |
Return the new operator's icon name. More... | |
const std::string & | helpURL () const |
Return the new operator's help URL. More... | |
const std::string & | documentation () const |
Return the new operator's documentation. More... | |
const OP_OperatorTable & | table () const |
Return the operator table with which this factory is associated. More... | |
OpFactory & | addAlias (const std::string &english) |
Construct a type name for this operator from the given English name and add it as an alias. More... | |
OpFactory & | addAliasVerbatim (const std::string &name) |
Add an alias for this operator. More... | |
OpFactory & | setDocumentation (const std::string &) |
Add documentation for this operator. More... | |
OpFactory & | addInput (const std::string &name) |
Add a required input with the given name. More... | |
OpFactory & | addOptionalInput (const std::string &name) |
Add an optional input with the given name. More... | |
OpFactory & | setMaxInputs (unsigned=9999) |
Set the maximum number of inputs allowed by this operator. More... | |
OpFactory & | setObsoleteParms (const ParmList &) |
Specify obsolete parameters to this operator. More... | |
OpFactory & | setLocalVariables (CH_LocalVariable *) |
Add one or more local variables to this operator. More... | |
OpFactory & | setFlags (unsigned) |
OpFactory & | setInternalName (const std::string &name) |
OpFactory & | setOperatorTable (const std::string &name) |
OpFactory & | setVerb (SOP_NodeVerb::CookMode cookMode, const CacheAllocFunc &allocator) |
Register this operator as a compilable SOP. More... | |
OpFactory & | setInvisible () |
Mark this node as hidden from the UI tab menu. More... | |
OpFactory & | addSpareData (const SpareDataMap &) |
Specify (key, value) pairs of spare data for this operator. More... | |
Static Public Member Functions | |
static std::string | flavorToString (OpFlavor) |
Return "SOP" for the SOP flavor, "POP" for the POP flavor, etc. More... | |
Protected Member Functions | |
OP_OperatorTable & | table () |
Return the operator table with which this factory is associated. More... | |
Helper class to simplify operator registration.
using CacheAllocFunc = std::function<SOP_NodeCache* (void)> |
Functor that returns newly-allocated node caches for instances of this operator.
A node cache encapsulates a SOP's cooking logic for thread safety. Input geometry and parameter values are baked into the cache.
enum OpFlavor |
|
inline |
Construct a factory that on destruction registers a new operator type.
english | the operator's UI name, as it should appear in menus |
ctor | a factory function that creates operators of this type |
parms | the parameter template list for operators of this type |
table | the registry to which to add this operator type |
flavor | the operator's class (SOP, POP, etc.) |
OpPolicyType
specifies the type of OpPolicy to be used to control the factory's behavior. The (unused) OpPolicyType
argument is required to enable the compiler to infer the type of the template argument (there is no other way to invoke a templated constructor).
OpFactory | ( | const std::string & | english, |
OP_Constructor | ctor, | ||
ParmList & | parms, | ||
OP_OperatorTable & | table, | ||
OpFlavor | flavor = SOP |
||
) |
|
virtual |
Register the operator.
OpFactory& addAlias | ( | const std::string & | english | ) |
Construct a type name for this operator from the given English name and add it as an alias.
For backward compatibility when an operator needs to be renamed, add the old name as an alias.
OpFactory& addAliasVerbatim | ( | const std::string & | name | ) |
Add an alias for this operator.
For backward compatibility when an operator needs to be renamed, add the old name as an alias.
OpFactory& addInput | ( | const std::string & | name | ) |
Add a required input with the given name.
OpFactory& addOptionalInput | ( | const std::string & | name | ) |
Add an optional input with the given name.
OpFactory& addSpareData | ( | const SpareDataMap & | ) |
Specify (key, value) pairs of spare data for this operator.
If a key already exists, its corresponding value will be overwritten with the new value.
const std::string& documentation | ( | ) | const |
Return the new operator's documentation.
const std::string& english | ( | ) | const |
Return the new operator's UI name.
This accessor is mainly for use by OpPolicy objects.
OpFlavor flavor | ( | ) | const |
Return the new operator's flavor (SOP, POP, etc.).
This accessor is mainly for use by OpPolicy objects.
std::string flavorString | ( | ) | const |
Return the new operator's flavor as a string ("SOP", "POP", etc.).
This accessor is mainly for use by OpPolicy objects.
|
static |
Return "SOP" for the SOP flavor, "POP" for the POP flavor, etc.
Useful in OpPolicy classes for constructing type and icon names.
const std::string& helpURL | ( | ) | const |
Return the new operator's help URL.
This accessor is mainly for use by OpPolicy objects.
const std::string& iconName | ( | ) | const |
Return the new operator's icon name.
This accessor is mainly for use by OpPolicy objects.
const std::string& name | ( | ) | const |
Return the new operator's type name.
This accessor is mainly for use by OpPolicy objects.
OpFactory& setDocumentation | ( | const std::string & | ) |
Add documentation for this operator.
The text is parsed as wiki markup.
OpFactory& setFlags | ( | unsigned | ) |
OpFactory& setInternalName | ( | const std::string & | name | ) |
OpFactory& setInvisible | ( | ) |
Mark this node as hidden from the UI tab menu.
This is equivalent to using the hscript ophide method.
OpFactory& setLocalVariables | ( | CH_LocalVariable * | ) |
Add one or more local variables to this operator.
OpFactory& setMaxInputs | ( | unsigned | = 9999 | ) |
Set the maximum number of inputs allowed by this operator.
OpFactory& setOperatorTable | ( | const std::string & | name | ) |
OpFactory& setVerb | ( | SOP_NodeVerb::CookMode | cookMode, |
const CacheAllocFunc & | allocator | ||
) |
Register this operator as a compilable SOP.
"Verbifying" a SOP separates its input and parameter management from its cooking logic so that cooking can be safely threaded.
cookMode | how to initialize the output detail |
allocator | a node cache allocator for instances of this operator |
std::runtime_error | if this operator is not a SOP |
std::invalid_argument | if allocator is empty |
const OP_OperatorTable& table | ( | ) | const |
Return the operator table with which this factory is associated.
This accessor is mainly for use by OpPolicy objects.
|
protected |
Return the operator table with which this factory is associated.
This accessor is mainly for use by derived OpFactory classes.