OpenVDB 12.1.0

Loading...
Searching...
No Matches
OpenVDBOpFactory Class Reference

Use this class to register a new OpenVDB operator (SOP, POP, etc.) More...

`#include <openvdb_houdini/SOP_NodeVDB.h>`

Inheritance diagram for 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.

## Public Member Functions
| OpenVDBOpFactory (const std::string &english, OP_Constructor, houdini_utils::ParmList &, OP_OperatorTable &, houdini_utils::OpFactory::OpFlavor=SOP)
| Construct an OpFactory that on destruction registers a new OpenVDB operator type.
OpenVDBOpFactory & | setNativeName (const std::string &name)
| Set the name of the equivalent native operator as shipped with Houdini.
OpFlavor | flavor () const
| Return the new operator's flavor (SOP, POP, etc.).
std::string | flavorString () const
| Return the new operator's flavor as a string ("SOP", "POP", etc.).
const std::string & | name () const
| Return the new operator's type name.
const std::string & | english () const
| Return the new operator's UI name.
const std::string & | iconName () const
| Return the new operator's icon name.
const std::string & | helpURL () const
| Return the new operator's help URL.
const std::string & | documentation () const
| Return the new operator's documentation.
const OP_OperatorTable & | table () const
| Return the operator table with which this factory is associated.
OpFactory & | addAlias (const std::string &english)
| Construct a type name for this operator from the given English name and add it as an alias.
OpFactory & | addAliasVerbatim (const std::string &name)
| Add an alias for this operator.
OpFactory & | setDocumentation (const std::string &)
| Add documentation for this operator.
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 & | setMaxInputs (unsigned=9999)
| Set the maximum number of inputs allowed by this operator.
OpFactory & | setObsoleteParms (const ParmList &)
| Specify obsolete parameters to this operator.
OpFactory & | setLocalVariables (CH_LocalVariable *)
| Add one or more local variables to this operator.
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.
OpFactory & | setInvisible ()
| Mark this node as hidden from the UI tab menu.
OpFactory & | addSpareData (const SpareDataMap &)
| Specify (key, value) pairs of spare data for this operator.

## Static Public Member Functions
static std::string | flavorToString (OpFlavor)
| Return "SOP" for the SOP flavor, "POP" for the POP flavor, etc.

## Protected Member Functions
OP_OperatorTable & | table ()
| Return the operator table with which this factory is associated.

## Detailed Description

Use this class to register a new OpenVDB operator (SOP, POP, etc.)

This class ensures that the operator uses the appropriate OpPolicy.

See also
  houdini_utils::OpFactory, houdini_utils::OpPolicy

## Member Typedef Documentation

## ◆ CacheAllocFunc

using CacheAllocFunc = std::function<SOP_NodeCache* (void)>
| inherited

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.

## Member Enumeration Documentation

## ◆ OpFlavor

enum OpFlavor
| inherited

Enumerator
SOP |
POP |
ROP |
VOP |
HDA |

## Constructor & Destructor Documentation

## ◆ OpenVDBOpFactory()

OpenVDBOpFactory | ( | const std::string & | english,
|  | OP_Constructor | ,
|  | houdini_utils::ParmList & | ,
|  | OP_OperatorTable & | ,
|  | houdini_utils::OpFactory::OpFlavor | = SOP )

Construct an OpFactory that on destruction registers a new OpenVDB operator type.

## Member Function Documentation

## ◆ addAlias()

OpFactory & addAlias | ( | const std::string & | english | ) |
| inherited

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.

## ◆ addAliasVerbatim()

OpFactory & addAliasVerbatim | ( | const std::string & | name | ) |
| inherited

Add an alias for this operator.

For backward compatibility when an operator needs to be renamed, add the old name as an alias.

Note
  This variant takes an operator type name rather than an English name.

## ◆ addInput()

OpFactory & addInput | ( | const std::string & | name | ) |
| inherited

Add a required input with the given name.

## ◆ addOptionalInput()

OpFactory & addOptionalInput | ( | const std::string & | name | ) |
| inherited

Add an optional input with the given name.

## ◆ addSpareData()

OpFactory & addSpareData | ( | const SpareDataMap & |  | ) |
| inherited

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.

See also
  addOperatorSpareData, getOperatorSpareData

## ◆ documentation()

const std::string & documentation | ( |  | ) | const
| inherited

Return the new operator's documentation.

Note
  If the help URL is nonempty, the URL takes precedence over any help text.

See also
  helpURL(), setDocumentation()

## ◆ english()

const std::string & english | ( |  | ) | const
| inherited

Return the new operator's UI name.

This accessor is mainly for use by OpPolicy objects.

## ◆ flavor()

OpFlavor flavor | ( |  | ) | const
| inherited

Return the new operator's flavor (SOP, POP, etc.).

This accessor is mainly for use by OpPolicy objects.

## ◆ flavorString()

std::string flavorString | ( |  | ) | const
| inherited

Return the new operator's flavor as a string ("SOP", "POP", etc.).

This accessor is mainly for use by OpPolicy objects.

## ◆ flavorToString()

std::string flavorToString | ( | OpFlavor |  | ) |
| static inherited

Return "SOP" for the SOP flavor, "POP" for the POP flavor, etc.

Useful in OpPolicy classes for constructing type and icon names.

## ◆ helpURL()

const std::string & helpURL | ( |  | ) | const
| inherited

Return the new operator's help URL.

This accessor is mainly for use by OpPolicy objects.

Note
  A help URL takes precedence over help text.

See also
  helpText(), setHelpText()

## ◆ iconName()

const std::string & iconName | ( |  | ) | const
| inherited

Return the new operator's icon name.

This accessor is mainly for use by OpPolicy objects.

## ◆ name()

const std::string & name | ( |  | ) | const
| inherited

Return the new operator's type name.

This accessor is mainly for use by OpPolicy objects.

## ◆ setDocumentation()

OpFactory & setDocumentation | ( | const std::string & |  | ) |
| inherited

Add documentation for this operator.

The text is parsed as wiki markup.

Note
  If this factory's OpPolicy specifies a help URL, that URL takes precedence over documentation supplied with this method.

## ◆ setFlags()

OpFactory & setFlags | ( | unsigned |  | ) |
| inherited

## ◆ setInternalName()

OpFactory & setInternalName | ( | const std::string & | name | ) |
| inherited

## ◆ setInvisible()

OpFactory & setInvisible | ( |  | ) |
| inherited

Mark this node as hidden from the UI tab menu.

This is equivalent to using the hscript ophide method.

## ◆ setLocalVariables()

OpFactory & setLocalVariables | ( | CH_LocalVariable * |  | ) |
| inherited

Add one or more local variables to this operator.

## ◆ setMaxInputs()

OpFactory & setMaxInputs | ( | unsigned | = 9999 | ) |
| inherited

Set the maximum number of inputs allowed by this operator.

Note
  It is only necessary to set this limit if there are inputs that have not been named with addInput() or addOptionalInput().

## ◆ setNativeName()

OpenVDBOpFactory & setNativeName | ( | const std::string & | name | ) |

Set the name of the equivalent native operator as shipped with Houdini.

This is only needed where the native name policy doesn't provide the correct name. Pass an empty string to indicate that there is no equivalent native operator.

## ◆ setObsoleteParms()

OpFactory & setObsoleteParms | ( | const ParmList & |  | ) |
| inherited

Specify obsolete parameters to this operator.

## ◆ setOperatorTable()

OpFactory & setOperatorTable | ( | const std::string & | name | ) |
| inherited

## ◆ setVerb()

OpFactory & setVerb | ( | SOP_NodeVerb::CookMode | cookMode,
|  | const CacheAllocFunc & | allocator )
| inherited

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.

Parameters

  cookMode | how to initialize the output detail
  allocator | a node cache allocator for instances of this operator

Exceptions

  std::runtime_error | if this operator is not a SOP
  std::invalid_argument | if allocator is empty

## ◆ table() [1/2]

OP_OperatorTable & table | ( |  | ) |
| protected inherited

Return the operator table with which this factory is associated.

This accessor is mainly for use by derived OpFactory classes.

## ◆ table() [2/2]

const OP_OperatorTable & table | ( |  | ) | const
| inherited

Return the operator table with which this factory is associated.

This accessor is mainly for use by OpPolicy objects.