OpenVDB 13.0.0

Loading...
Searching...
No Matches
VdbPrimIterator Class Reference

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

`#include <openvdb_houdini/Utils.h>`

Inheritance diagram for VdbPrimIterator:

## Public Types
using | FilterFunc = std::function<bool (const GU_PrimVDB&)>

## Public Member Functions
| VdbPrimIterator (GEO_Detail *gdp, const GA_PrimitiveGroup *group=nullptr, FilterFunc filter=FilterFunc())
| VdbPrimIterator (GEO_Detail *gdp, GA_Range::safedeletions, const GA_PrimitiveGroup *group=nullptr, FilterFunc filter=FilterFunc())
| Allow primitives to be deleted during iteration.
| VdbPrimIterator (const VdbPrimIterator &)
VdbPrimIterator & | operator= (const VdbPrimIterator &)
VdbPrimIterator & | operator++ ()
| Advance to the next VDB primitive.
GU_PrimVDB * | getPrimitive () const
| Return a pointer to the current VDB primitive (`nullptr` if at end).
GU_PrimVDB * | operator* () const
GU_PrimVDB * | operator-> () const
void | advance ()
| Advance to the next VDB primitive.
GA_Offset | getOffset () const
GA_Index | getIndex () const
| operator bool () const
| Return `false` if there are no more VDB primitives.
UT_String | getPrimitiveName (const UT_String &defaultName="") const
| Return the value of the current VDB primitive's `name` attribute.
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).
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.

## Protected Attributes
UT_SharedPtr< GA_GBPrimitiveIterator > | mIter
FilterFunc | mFilter

## Detailed Description

Iterator over non-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

## ◆ FilterFunc

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

## Constructor & Destructor Documentation

## ◆ VdbPrimIterator() [1/3]

VdbPrimIterator | ( | GEO_Detail * | gdp,
|  | const GA_PrimitiveGroup * | group = nullptr,
|  | FilterFunc | filter = FilterFunc() )
| inline explicit

Parameters

  gdp | the geometry detail over which to iterate
  group | a group in the detail over which to iterate (if `nullptr`, iterate over all VDB primitives)
  filter | an 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`)

## ◆ VdbPrimIterator() [2/3]

VdbPrimIterator | ( | GEO_Detail * | gdp,
|  | GA_Range::safedeletions | ,
|  | const GA_PrimitiveGroup * | group = nullptr,
|  | FilterFunc | filter = FilterFunc() )
| inline

Allow primitives to be deleted during iteration.

Parameters

  gdp | the geometry detail over which to iterate
  group | a group in the detail over which to iterate (if `nullptr`, iterate over all VDB primitives)
  filter | an 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`)

## ◆ VdbPrimIterator() [3/3]

VdbPrimIterator | ( | const VdbPrimIterator & |  | ) |

## Member Function Documentation

## ◆ advance()

void advance | ( |  | ) |
| inherited

Advance to the next VDB primitive.

## ◆ getIndex()

GA_Index getIndex | ( |  | ) | const
| inline inherited

## ◆ getOffset()

GA_Offset getOffset | ( |  | ) | const
| inline inherited

## ◆ getPrimitive()

GU_PrimVDB * getPrimitive | ( |  | ) | const
| inline

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

## ◆ getPrimitiveIndexAndName()

UT_String getPrimitiveIndexAndName | ( | bool | keepEmptyName = true | ) | const
| inherited

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

  keepEmptyName | if 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

## ◆ getPrimitiveName()

UT_String getPrimitiveName | ( | const UT_String & | defaultName = "" | ) | const
| inherited

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

Parameters

  defaultName | if the current primitive has no `name` attribute or its name is empty, return this name instead

## ◆ getPrimitiveNameOrIndex()

UT_String getPrimitiveNameOrIndex | ( |  | ) | const
| inherited

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()

operator bool | ( |  | ) | const
| inline inherited

Return `false` if there are no more VDB primitives.

## ◆ operator*()

GU_PrimVDB * operator* | ( |  | ) | const
| inline

## ◆ operator++()

VdbPrimIterator & operator++ | ( |  | ) |
| inline

Advance to the next VDB primitive.

## ◆ operator->()

GU_PrimVDB * operator-> | ( |  | ) | const
| inline

## ◆ operator=()

VdbPrimIterator & operator= | ( | const VdbPrimIterator & |  | ) |

## Member Data Documentation

## ◆ mFilter

FilterFunc mFilter
| protected inherited

## ◆ mIter

UT_SharedPtr<GA_GBPrimitiveIterator> mIter
| protected inherited