OpenVDB  9.0.1
Public Member Functions | Protected Member Functions | List of all members
SOP_NodeVDB Class Reference

Base class from which to derive OpenVDB-related Houdini SOPs. More...

#include <openvdb_houdini/SOP_NodeVDB.h>

Inherits SOP_Node.

Public Member Functions

 SOP_NodeVDB (OP_Network *, const char *, OP_Operator *)
 
 ~SOP_NodeVDB () override=default
 
void fillInfoTreeNodeSpecific (UT_InfoTree &, const OP_NodeInfoTreeParms &) override
 
void getNodeSpecificInfoText (OP_Context &, OP_NodeInfoParms &) override
 
const SOP_NodeVerb * cookVerb () const override
 Return this node's registered verb. More...
 
const GA_PrimitiveGroup * matchGroup (GU_Detail &, const std::string &pattern)
 Retrieve a group from a geometry detail by parsing a pattern (typically, the value of a Group parameter belonging to this node). More...
 
const GA_PrimitiveGroup * matchGroup (const GU_Detail &, const std::string &pattern)
 Retrieve a group from a geometry detail by parsing a pattern (typically, the value of a Group parameter belonging to this node). More...
 
Parameter evaluation
openvdb::Vec3f evalVec3f (const char *name, fpreal time) const
 Evaluate a vector-valued parameter. More...
 
openvdb::Vec3R evalVec3R (const char *name, fpreal time) const
 Evaluate a vector-valued parameter. More...
 
openvdb::Vec3i evalVec3i (const char *name, fpreal time) const
 Evaluate a vector-valued parameter. More...
 
openvdb::Vec2R evalVec2R (const char *name, fpreal time) const
 Evaluate a vector-valued parameter. More...
 
openvdb::Vec2i evalVec2i (const char *name, fpreal time) const
 Evaluate a vector-valued parameter. More...
 
std::string evalStdString (const char *name, fpreal time, int index=0) const
 Evaluate a string-valued parameter as an STL string. More...
 

Protected Member Functions

OP_ERROR cookMyGuide1 (OP_Context &) override
 
void resolveRenamedParm (PRM_ParmList &obsoleteParms, const char *oldName, const char *newName)
 Transfer the value of an obsolete parameter that was renamed to the parameter with the new name. More...
 
OP_ERROR cookMySop (OP_Context &) override final
 To facilitate compilable SOPs, cookMySop() is now final. Instead, either override SOP_NodeVDB::cookVDBSop() (for a non-compilable SOP) or override SOP_VDBCacheOptions::cookVDBSop() (for a compilable SOP). More...
 
virtual OP_ERROR cookVDBSop (OP_Context &)
 To facilitate compilable SOPs, cookMySop() is now final. Instead, either override SOP_NodeVDB::cookVDBSop() (for a non-compilable SOP) or override SOP_VDBCacheOptions::cookVDBSop() (for a compilable SOP). More...
 
Input stealing
OP_ERROR duplicateSourceStealable (const unsigned index, OP_Context &context, GU_Detail **pgdp, GU_DetailHandle &gdh, bool clean=true)
 Steal the geometry on the specified input if possible, instead of copying the data. More...
 
OP_ERROR duplicateSourceStealable (const unsigned index, OP_Context &context)
 Steal the geometry on the specified input if possible, instead of copying the data. More...
 

Detailed Description

Base class from which to derive OpenVDB-related Houdini SOPs.

Constructor & Destructor Documentation

SOP_NodeVDB ( OP_Network *  ,
const char *  ,
OP_Operator *   
)
~SOP_NodeVDB ( )
overridedefault

Member Function Documentation

OP_ERROR cookMyGuide1 ( OP_Context &  )
overrideprotected
OP_ERROR cookMySop ( OP_Context &  )
finaloverrideprotected

To facilitate compilable SOPs, cookMySop() is now final. Instead, either override SOP_NodeVDB::cookVDBSop() (for a non-compilable SOP) or override SOP_VDBCacheOptions::cookVDBSop() (for a compilable SOP).

virtual OP_ERROR cookVDBSop ( OP_Context &  )
inlineprotectedvirtual

To facilitate compilable SOPs, cookMySop() is now final. Instead, either override SOP_NodeVDB::cookVDBSop() (for a non-compilable SOP) or override SOP_VDBCacheOptions::cookVDBSop() (for a compilable SOP).

const SOP_NodeVerb* cookVerb ( ) const
override

Return this node's registered verb.

OP_ERROR duplicateSourceStealable ( const unsigned  index,
OP_Context &  context,
GU_Detail **  pgdp,
GU_DetailHandle &  gdh,
bool  clean = true 
)
protected

Steal the geometry on the specified input if possible, instead of copying the data.

In certain cases where a node's input geometry isn't being shared with other nodes, it is safe for the node to directly modify the geometry. Normally, input geometry is shared with the upstream node's output cache, so for stealing to be possible, the "unload" flag must be set on the upstream node to inhibit caching. In addition, reference counting of GEO_PrimVDB shared pointers ensures we cannot steal data that is in use elsewhere. When stealing is not possible, this method falls back to copying the shared pointer, effectively performing a duplicateSource().

Parameters
indexthe index of the input from which to perform this operation
contextthe current SOP context is used for cook time for network traversal
pgdppointer to the SOP's gdp
gdhhandle to manage input locking
clean(forwarded to duplicateSource())
Note
Prior to Houdini 13.0, this method peforms a duplicateSource() and unlocks the inputs to the SOP. From Houdini 13.0 on, this method will insert the existing data into the detail and update the detail handle in the SOP.
Warning
No attempt to call duplicateSource() or inputGeo() should be made after calling this method, as there will be no data on the input stream if isSourceStealable() returns true.
Deprecated:
verbification renders this redundant
OP_ERROR duplicateSourceStealable ( const unsigned  index,
OP_Context &  context 
)
protected

Steal the geometry on the specified input if possible, instead of copying the data.

In certain cases where a node's input geometry isn't being shared with other nodes, it is safe for the node to directly modify the geometry. Normally, input geometry is shared with the upstream node's output cache, so for stealing to be possible, the "unload" flag must be set on the upstream node to inhibit caching. In addition, reference counting of GEO_PrimVDB shared pointers ensures we cannot steal data that is in use elsewhere. When stealing is not possible, this method falls back to copying the shared pointer, effectively performing a duplicateSource().

Note
Prior to Houdini 13.0, this method peforms a duplicateSource() and unlocks the inputs to the SOP. From Houdini 13.0 on, this method will insert the existing data into the detail and update the detail handle in the SOP.
Parameters
indexthe index of the input from which to perform this operation
contextthe current SOP context is used for cook time for network traversal
Deprecated:
verbification renders this redundant
std::string evalStdString ( const char *  name,
fpreal  time,
int  index = 0 
) const

Evaluate a string-valued parameter as an STL string.

This method facilitates string parameter evaluation in expressions. For example,

matchGroup(*gdp, evalStdString("group", time));
openvdb::Vec2i evalVec2i ( const char *  name,
fpreal  time 
) const

Evaluate a vector-valued parameter.

openvdb::Vec2R evalVec2R ( const char *  name,
fpreal  time 
) const

Evaluate a vector-valued parameter.

openvdb::Vec3f evalVec3f ( const char *  name,
fpreal  time 
) const

Evaluate a vector-valued parameter.

openvdb::Vec3i evalVec3i ( const char *  name,
fpreal  time 
) const

Evaluate a vector-valued parameter.

openvdb::Vec3R evalVec3R ( const char *  name,
fpreal  time 
) const

Evaluate a vector-valued parameter.

void fillInfoTreeNodeSpecific ( UT_InfoTree &  ,
const OP_NodeInfoTreeParms &   
)
override
void getNodeSpecificInfoText ( OP_Context &  ,
OP_NodeInfoParms &   
)
override
const GA_PrimitiveGroup* matchGroup ( GU_Detail &  ,
const std::string &  pattern 
)

Retrieve a group from a geometry detail by parsing a pattern (typically, the value of a Group parameter belonging to this node).

Exceptions
std::runtime_errorif the pattern is nonempty but doesn't match any group.
const GA_PrimitiveGroup* matchGroup ( const GU_Detail &  ,
const std::string &  pattern 
)

Retrieve a group from a geometry detail by parsing a pattern (typically, the value of a Group parameter belonging to this node).

Exceptions
std::runtime_errorif the pattern is nonempty but doesn't match any group.
void resolveRenamedParm ( PRM_ParmList &  obsoleteParms,
const char *  oldName,
const char *  newName 
)
protected

Transfer the value of an obsolete parameter that was renamed to the parameter with the new name.

This convenience method is intended to be called from resolveObsoleteParms(), when that function is implemented.