OpenVDB  7.0.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
VdbPrimCIterator Class Reference

Iterator over const VDB primitives on a geometry detail. More...

#include <Utils.h>

Inherited by VdbPrimIterator.

Public Types

using FilterFunc = std::function< bool(const GU_PrimVDB &)>
 

Public Member Functions

 VdbPrimCIterator (const GEO_Detail *gdp, const GA_PrimitiveGroup *group=nullptr, FilterFunc filter=FilterFunc())
 
 VdbPrimCIterator (const VdbPrimCIterator &)
 
VdbPrimCIteratoroperator= (const VdbPrimCIterator &)
 
 operator bool () const
 Return false if there are no more VDB primitives. More...
 
UT_String getPrimitiveName (const UT_String &defaultName="") const
 Return the value of the current VDB primitive's name attribute. More...
 
UT_String getPrimitiveNameOrIndex () const
 Return the value of the current VDB primitive's name attribute or, if the name is empty, the primitive's index (as a UT_String). More...
 
UT_String getPrimitiveIndexAndName (bool keepEmptyName=true) const
 Return a string of the form "N (NAME)", where N is the current VDB primitive's index and NAME is the value of the primitive's name attribute. More...
 
void advance ()
 Advance to the next VDB primitive. More...
 
VdbPrimCIteratoroperator++ ()
 Advance to the next VDB primitive. More...
 
const GU_PrimVDB * getPrimitive () const
 Return a pointer to the current VDB primitive (nullptr if at end). More...
 
const GU_PrimVDB * operator* () const
 Return a pointer to the current VDB primitive (nullptr if at end). More...
 
const GU_PrimVDB * operator-> () const
 Return a pointer to the current VDB primitive (nullptr if at end). More...
 
GA_Offset getOffset () const
 
GA_Index getIndex () const
 

Protected Member Functions

 VdbPrimCIterator (const GEO_Detail *, GA_Range::safedeletions, const GA_PrimitiveGroup *=nullptr, FilterFunc=FilterFunc())
 Allow primitives to be deleted during iteration. More...
 

Protected Attributes

UT_SharedPtr< GA_GBPrimitiveIterator > mIter
 
FilterFunc mFilter
 

Detailed Description

Iterator over const VDB primitives on a geometry detail.

At least until GEO_PrimVDB becomes a built-in primitive type (that can be used as the mask for a GA_GBPrimitiveIterator), use this iterator to iterate over all VDB grids belonging to a gdp and, optionally, belonging to a particular group.

Member Typedef Documentation

using FilterFunc = std::function<bool (const GU_PrimVDB&)>

Constructor & Destructor Documentation

VdbPrimCIterator ( const GEO_Detail *  gdp,
const GA_PrimitiveGroup *  group = nullptr,
FilterFunc  filter = FilterFunc() 
)
explicit
Parameters
gdpthe geometry detail over which to iterate
groupa group in the detail over which to iterate (if nullptr, iterate over all VDB primitives)
filteran optional function or functor that takes a const reference to a GU_PrimVDB and returns a boolean specifying whether that primitive should be visited (true) or not (false)
VdbPrimCIterator ( const GEO_Detail *  ,
GA_Range::safedeletions  ,
const GA_PrimitiveGroup *  = nullptr,
FilterFunc  = FilterFunc() 
)
protected

Allow primitives to be deleted during iteration.

Member Function Documentation

void advance ( )

Advance to the next VDB primitive.

GA_Index getIndex ( ) const
inline
GA_Offset getOffset ( ) const
inline
const GU_PrimVDB* getPrimitive ( ) const

Return a pointer to the current VDB primitive (nullptr if at end).

UT_String getPrimitiveIndexAndName ( bool  keepEmptyName = true) const

Return a string of the form "N (NAME)", where N is the current VDB primitive's index and NAME is the value of the primitive's name attribute.

Parameters
keepEmptyNameif the current primitive has no name attribute or its name is empty, then if this flag is true, return a string "N ()", otherwise return a string "N" omitting the empty name
UT_String getPrimitiveName ( const UT_String &  defaultName = "") const

Return the value of the current VDB primitive's name attribute.

Parameters
defaultNameif the current primitive has no name attribute or its name is empty, return this name instead
UT_String getPrimitiveNameOrIndex ( ) const

Return the value of the current VDB primitive's name attribute or, if the name is empty, the primitive's index (as a UT_String).

operator bool ( ) const
inline

Return false if there are no more VDB primitives.

const GU_PrimVDB* operator* ( ) const
inline

Return a pointer to the current VDB primitive (nullptr if at end).

VdbPrimCIterator& operator++ ( )
inline

Advance to the next VDB primitive.

const GU_PrimVDB* operator-> ( ) const
inline

Return a pointer to the current VDB primitive (nullptr if at end).

VdbPrimCIterator& operator= ( const VdbPrimCIterator )

Member Data Documentation

FilterFunc mFilter
protected
UT_SharedPtr<GA_GBPrimitiveIterator> mIter
protected

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