OpenVDB: openvdb_houdini/Utils.h Source File

OpenVDB 13.0.0

Loading...
Searching...
No Matches
Utils.h
Go to the documentation of this file.
1// Copyright Contributors to the OpenVDB Project
2// SPDX-License-Identifier: Apache-2.0
3//
4/// @file openvdb_houdini/Utils.h
5/// @author FX R&D Simulation team
6/// @brief Utility classes and functions for OpenVDB plugins
7
8#ifndef OPENVDB_HOUDINI_UTILS_HAS_BEEN_INCLUDED
9#define OPENVDB_HOUDINI_UTILS_HAS_BEEN_INCLUDED
10
11#include <GU/GU_PrimVDB.h>
12#include <OP/OP_Node.h> // for OP_OpTypeId
13#include <UT/UT_SharedPtr.h>
14#include <UT/UT_Interrupt.h>
15#include <UT/UT_Version.h>
16#include <openvdb/openvdb.h>
17#include <openvdb/util/NullInterrupter.h>
18#include <functional>
19#include <type_traits>
20
21
22#ifdef SESI_OPENVDB
23#ifdef OPENVDB_HOUDINI_API
24 #undef OPENVDB_HOUDINI_API
25 #define OPENVDB_HOUDINI_API
26#endif
27#endif
28
29class GEO_PrimVDB;
30class GU_Detail;
31class UT_String;
32
33
34// Prior to Houdini 21.0 this was an unsigned.
35// After 21 they are defined in OP_DataTypes.h
36#if SYS_VERSION_MAJOR_INT < 21
37 using OP_InputIdx = unsigned;
38 using OP_OutputIdx = unsigned;
39#endif
40
41namespace openvdb_houdini {
42
43 using Grid = openvdb::GridBase;
44 using GridPtr = openvdb::GridBase::Ptr;
45 using GridCPtr = openvdb::GridBase::ConstPtr;
46 using GridRef = openvdb::GridBase&;
47 using GridCRef = const openvdb::GridBase&;
48
49
50/// @brief Iterator over const VDB primitives on a geometry detail
51///
52/// @details At least until @c GEO_PrimVDB becomes a built-in primitive type
53/// (that can be used as the mask for a @c GA_GBPrimitiveIterator), use this
54/// iterator to iterate over all VDB grids belonging to a gdp and, optionally,
55/// belonging to a particular group.
56 class OPENVDB_HOUDINI_API VdbPrimCIterator
57{
58public:
59 using FilterFunc = std::function<bool (const GU_PrimVDB&)>;
60
61 /// @param gdp
62 /// the geometry detail over which to iterate
63 /// @param group
64 /// a group in the detail over which to iterate (if @c nullptr,
65 /// iterate over all VDB primitives)
66 /// @param filter
67 /// an optional function or functor that takes a const reference
68 /// to a GU_PrimVDB and returns a boolean specifying whether
69 /// that primitive should be visited (@c true) or not (@c false)
70 explicit VdbPrimCIterator(const GEO_Detail* gdp, const GA_PrimitiveGroup* group = nullptr,
71 FilterFunc filter = FilterFunc());
72
73 VdbPrimCIterator(const VdbPrimCIterator&);
74 VdbPrimCIterator& operator=(const VdbPrimCIterator&);
75
76 //@{
77 /// Advance to the next VDB primitive.
78 void advance();
79 VdbPrimCIterator& operator++() { advance(); return *this; }
80 //@}
81
82 //@{
83 /// Return a pointer to the current VDB primitive (@c nullptr if at end).
84 const GU_PrimVDB* getPrimitive() const;
85 const GU_PrimVDB* operator*() const { return getPrimitive(); }
86 const GU_PrimVDB* operator->() const { return getPrimitive(); }
87 //@}
88
89 //@{
90 GA_Offset getOffset() const { return getPrimitive()->getMapOffset(); }
91 GA_Index getIndex() const { return getPrimitive()->getMapIndex(); }
92 //@}
93
94 /// Return @c false if there are no more VDB primitives.
95 operator bool() const { return getPrimitive() != nullptr; }
96
97 /// @brief Return the value of the current VDB primitive's @c name attribute.
98 /// @param defaultName
99 /// if the current primitive has no @c name attribute
100 /// or its name is empty, return this name instead
101 UT_String getPrimitiveName(const UT_String& defaultName = "") const;
102
103 /// @brief Return the value of the current VDB primitive's @c name attribute
104 /// or, if the name is empty, the primitive's index (as a UT_String).
105 UT_String getPrimitiveNameOrIndex() const;
106
107 /// @brief Return a string of the form "N (NAME)", where @e N is
108 /// the current VDB primitive's index and @e NAME is the value
109 /// of the primitive's @c name attribute.
110 /// @param keepEmptyName if the current primitive has no @c name attribute
111 /// or its name is empty, then if this flag is @c true, return a string
112 /// "N ()", otherwise return a string "N" omitting the empty name
113 UT_String getPrimitiveIndexAndName(bool keepEmptyName = true) const;
114
115protected:
116 /// Allow primitives to be deleted during iteration.
117 VdbPrimCIterator(const GEO_Detail*, GA_Range::safedeletions,
118 const GA_PrimitiveGroup* = nullptr, FilterFunc = FilterFunc());
119
120 UT_SharedPtr<GA_GBPrimitiveIterator> mIter;
121 FilterFunc mFilter;
122}; // class VdbPrimCIterator
123
124
125/// @brief Iterator over non-const VDB primitives on a geometry detail
126///
127/// @details At least until @c GEO_PrimVDB becomes a built-in primitive type
128/// (that can be used as the mask for a @c GA_GBPrimitiveIterator), use this
129/// iterator to iterate over all VDB grids belonging to a gdp and, optionally,
130/// belonging to a particular group.
131 class OPENVDB_HOUDINI_API VdbPrimIterator: public VdbPrimCIterator
132{
133public:
134 /// @param gdp
135 /// the geometry detail over which to iterate
136 /// @param group
137 /// a group in the detail over which to iterate (if @c nullptr,
138 /// iterate over all VDB primitives)
139 /// @param filter
140 /// an optional function or functor that takes a @c const reference
141 /// to a GU_PrimVDB and returns a boolean specifying whether
142 /// that primitive should be visited (@c true) or not (@c false)
143 explicit VdbPrimIterator(GEO_Detail* gdp, const GA_PrimitiveGroup* group = nullptr,
144 FilterFunc filter = FilterFunc()):
145 VdbPrimCIterator(gdp, group, filter) {}
146 /// @brief Allow primitives to be deleted during iteration.
147 /// @param gdp
148 /// the geometry detail over which to iterate
149 /// @param group
150 /// a group in the detail over which to iterate (if @c nullptr,
151 /// iterate over all VDB primitives)
152 /// @param filter
153 /// an optional function or functor that takes a @c const reference
154 /// to a GU_PrimVDB and returns a boolean specifying whether
155 /// that primitive should be visited (@c true) or not (@c false)
156 VdbPrimIterator(GEO_Detail* gdp, GA_Range::safedeletions,
157 const GA_PrimitiveGroup* group = nullptr, FilterFunc filter = FilterFunc()):
158 VdbPrimCIterator(gdp, GA_Range::safedeletions(), group, filter) {}
159
160 VdbPrimIterator(const VdbPrimIterator&);
161 VdbPrimIterator& operator=(const VdbPrimIterator&);
162
163 /// Advance to the next VDB primitive.
164 VdbPrimIterator& operator++() { advance(); return *this; }
165
166 //@{
167 /// Return a pointer to the current VDB primitive (@c nullptr if at end).
168 GU_PrimVDB* getPrimitive() const {
169 return const_cast<GU_PrimVDB*>(VdbPrimCIterator::getPrimitive());
170 }
171 GU_PrimVDB* operator*() const { return getPrimitive(); }
172 GU_PrimVDB* operator->() const { return getPrimitive(); }
173 //@}
174}; // class VdbPrimIterator
175
176
177////////////////////////////////////////
178
179
180/// @brief Wrapper class that adapts a Houdini @c UT_Interrupt object
181/// for use with OpenVDB library routines
182/// @sa openvdb/util/NullInterrupter.h
183 class HoudiniInterrupter final: public openvdb::util::NullInterrupter
184{
185public:
186 explicit HoudiniInterrupter(const char* title = nullptr):
187 mUTI{UTgetInterrupt()}, mRunning{false}, mTitle{title ? title : ""}
188 {}
189 ~HoudiniInterrupter() override final { if (mRunning) this->end(); }
190
191 HoudiniInterrupter(const HoudiniInterrupter&) = default;
192 HoudiniInterrupter& operator=(const HoudiniInterrupter&) = default;
193
194 /// @brief Signal the start of an interruptible operation.
195 /// @param name an optional descriptive name for the operation
196 void start(const char* name = nullptr) override final {
197 if (!mRunning) { mRunning = true; mUTI->opStart(name ? name : mTitle.c_str()); }
198 }
199 /// Signal the end of an interruptible operation.
200 void end() override final { if (mRunning) { mUTI->opEnd(); mRunning = false; } }
201
202 /// @brief Check if an interruptible operation should be aborted.
203 /// @param percent an optional (when >= 0) percentage indicating
204 /// the fraction of the operation that has been completed
205 bool wasInterrupted(int percent=-1) override final { return mUTI->opInterrupt(percent); }
206
207private:
208 UT_Interrupt* mUTI;
209 bool mRunning;
210 std::string mTitle;
211};
212
213
214////////////////////////////////////////
215
216
217// Utility methods
218
219/// @brief Store a VDB grid in a new VDB primitive and add the primitive
220/// to a geometry detail.
221/// @return the newly-created VDB primitive.
222/// @param gdp the detail to which to add the primitive
223/// @param grid the VDB grid to be added
224/// @param name if non-null, set the new primitive's @c name attribute to this string
225/// @note This operation clears the input grid's metadata.
226 OPENVDB_HOUDINI_API
227GU_PrimVDB* createVdbPrimitive(GU_Detail& gdp, GridPtr grid, const char* name = nullptr);
228
229
230/// @brief Replace an existing VDB primitive with a new primitive that contains
231/// the given grid.
232/// @return the newly-created VDB primitive.
233/// @param gdp the detail to which to add the primitive
234/// @param grid the VDB grid to be added
235/// @param src replace this primitive with the newly-created primitive
236/// @param copyAttrs if @c true, copy attributes and group membership from the @a src primitive
237/// @param name if non-null, set the new primitive's @c name attribute to this string;
238/// otherwise, if @a copyAttrs is @c true, copy the name from @a src
239/// @note This operation clears the input grid's metadata.
240 OPENVDB_HOUDINI_API
241GU_PrimVDB* replaceVdbPrimitive(GU_Detail& gdp, GridPtr grid, GEO_PrimVDB& src,
242 const bool copyAttrs = true, const char* name = nullptr);
243
244
245/// @brief Return in @a corners the corners of the given grid's active voxel bounding box.
246/// @return @c false if the grid has no active voxels.
247 OPENVDB_HOUDINI_API
248 bool evalGridBBox(GridCRef grid, UT_Vector3 corners[8], bool expandHalfVoxel = false);
249
250
251/// Construct an index-space CoordBBox from a UT_BoundingBox.
252 OPENVDB_HOUDINI_API
253 openvdb::CoordBBox makeCoordBBox(const UT_BoundingBox&, const openvdb::math::Transform&);
254
255
256/// @{
257/// @brief Start forwarding OpenVDB log messages to the Houdini error manager
258/// for all operators of the given type.
259/// @details Typically, log forwarding is enabled for specific operator types
260/// during initialization of the openvdb_houdini library, and there's no need
261/// for client code to call this function.
262/// @details This function has no effect unless OpenVDB was built with
263/// <A HREF="http://log4cplus.sourceforge.net/">log4cplus</A>.
264/// @note OpenVDB messages are typically logged to the console as well.
265/// This function has no effect on console logging.
266/// @sa stopLogForwarding(), isLogForwarding()
267 OPENVDB_HOUDINI_API
268 void startLogForwarding(OP_OpTypeId);
269
270/// @brief Stop forwarding OpenVDB log messages to the Houdini error manager
271/// for all operators of the given type.
272/// @details Typically, log forwarding is enabled for specific operator types
273/// during initialization of the openvdb_houdini library, and there's no need
274/// for client code to disable it.
275/// @details This function has no effect unless OpenVDB was built with
276/// <A HREF="http://log4cplus.sourceforge.net/">log4cplus</A>.
277/// @note OpenVDB messages are typically logged to the console as well.
278/// This function has no effect on console logging.
279/// @sa startLogForwarding(), isLogForwarding()
280 OPENVDB_HOUDINI_API
281 void stopLogForwarding(OP_OpTypeId);
282
283/// @brief Return @c true if OpenVDB messages logged by operators
284/// of the given type are forwarded to the Houdini error manager.
285/// @sa startLogForwarding(), stopLogForwarding()
286 OPENVDB_HOUDINI_API
287 bool isLogForwarding(OP_OpTypeId);
288/// @}
289
290
291////////////////////////////////////////
292
293
294// Grid type lists, for use with GEO_PrimVDB::apply(), GEOvdbApply(),
295// or openvdb::GridBase::apply()
296
297 using ScalarGridTypes = openvdb::TypeList<
298 openvdb::BoolGrid,
299 openvdb::FloatGrid,
300 openvdb::DoubleGrid,
301 openvdb::Int32Grid,
302 openvdb::Int64Grid>;
303
304 using NumericGridTypes = openvdb::TypeList<
305 openvdb::FloatGrid,
306 openvdb::DoubleGrid,
307 openvdb::Int32Grid,
308 openvdb::Int64Grid>;
309
310 using RealGridTypes = openvdb::TypeList<
311 openvdb::FloatGrid,
312 openvdb::DoubleGrid>;
313
314 using Vec3GridTypes = openvdb::TypeList<
315 openvdb::Vec3SGrid,
316 openvdb::Vec3DGrid,
317 openvdb::Vec3IGrid>;
318
319 using PointGridTypes = openvdb::TypeList<
320 openvdb::points::PointDataGrid>;
321
322 using VolumeGridTypes = ScalarGridTypes::Append<Vec3GridTypes>;
323
324 using AllGridTypes = VolumeGridTypes::Append<PointGridTypes>;
325
326
327/// @brief If the given primitive's grid resolves to one of the listed grid types,
328/// invoke the functor @a op on the resolved grid.
329/// @return @c true if the functor was invoked, @c false otherwise
330template<typename GridTypeListT, typename OpT>
331inline bool
332GEOvdbApply(const GEO_PrimVDB& vdb, OpT& op)
333{
334 if (auto gridPtr = vdb.getConstGridPtr()) {
335 return gridPtr->apply<GridTypeListT>(op);
336 }
337 return false;
338}
339
340/// @brief If the given primitive's grid resolves to one of the listed grid types,
341/// invoke the functor @a op on the resolved grid.
342/// @return @c true if the functor was invoked, @c false otherwise
343/// @details If @a makeUnique is true, deep copy the grid's tree before
344/// invoking the functor if the tree is shared with other grids.
345template<typename GridTypeListT, typename OpT>
346inline bool
347 GEOvdbApply(GEO_PrimVDB& vdb, OpT& op, bool makeUnique = true)
348{
349 if (vdb.hasGrid()) {
350 auto gridPtr = vdb.getGridPtr();
351 if (makeUnique) {
352 auto treePtr = gridPtr->baseTreePtr();
353 if (treePtr.use_count() > 2) { // grid + treePtr = 2
354 // If the grid resolves to one of the listed types and its tree
355 // is shared with other grids, replace the tree with a deep copy.
356 gridPtr->apply<GridTypeListT>(
357 [](Grid& baseGrid) { baseGrid.setTree(baseGrid.constBaseTree().copy()); });
358 }
359 }
360 return gridPtr->apply<GridTypeListT>(op);
361 }
362 return false;
363}
364
365} // namespace openvdb_houdini
366
367#endif // OPENVDB_HOUDINI_UTILS_HAS_BEEN_INCLUDED
NullInterrupter.h
OPENVDB_HOUDINI_API
#define OPENVDB_HOUDINI_API
Definition Platform.h:299
openvdb::v13_0::GridBase
Abstract base class for typed grids.
Definition Grid.h:78
openvdb::v13_0::math::CoordBBox
Axis-aligned bounding box of signed integer coordinates.
Definition Coord.h:252
openvdb_houdini::HoudiniInterrupter::end
void end() override final
Signal the end of an interruptible operation.
Definition Utils.h:200
openvdb_houdini::HoudiniInterrupter::operator=
HoudiniInterrupter & operator=(const HoudiniInterrupter &)=default
openvdb_houdini::HoudiniInterrupter::start
void start(const char *name=nullptr) override final
Signal the start of an interruptible operation.
Definition Utils.h:196
openvdb_houdini::HoudiniInterrupter::~HoudiniInterrupter
~HoudiniInterrupter() override final
Definition Utils.h:189
openvdb_houdini::HoudiniInterrupter::HoudiniInterrupter
HoudiniInterrupter(const HoudiniInterrupter &)=default
openvdb_houdini::HoudiniInterrupter::HoudiniInterrupter
HoudiniInterrupter(const char *title=nullptr)
Definition Utils.h:186
openvdb_houdini::HoudiniInterrupter::wasInterrupted
bool wasInterrupted(int percent=-1) override final
Check if an interruptible operation should be aborted.
Definition Utils.h:205
openvdb_houdini::VdbPrimCIterator::operator*
const GU_PrimVDB * operator*() const
Definition Utils.h:85
openvdb_houdini::VdbPrimCIterator::FilterFunc
std::function< bool(const GU_PrimVDB &)> FilterFunc
Definition Utils.h:59
openvdb_houdini::VdbPrimCIterator::mIter
UT_SharedPtr< GA_GBPrimitiveIterator > mIter
Definition Utils.h:120
openvdb_houdini::VdbPrimCIterator::getIndex
GA_Index getIndex() const
Definition Utils.h:91
openvdb_houdini::VdbPrimCIterator::getPrimitive
const GU_PrimVDB * getPrimitive() const
Return a pointer to the current VDB primitive (nullptr if at end).
openvdb_houdini::VdbPrimCIterator::operator->
const GU_PrimVDB * operator->() const
Definition Utils.h:86
openvdb_houdini::VdbPrimCIterator::VdbPrimCIterator
VdbPrimCIterator(const GEO_Detail *gdp, const GA_PrimitiveGroup *group=nullptr, FilterFunc filter=FilterFunc())
openvdb_houdini::VdbPrimCIterator::mFilter
FilterFunc mFilter
Definition Utils.h:121
openvdb_houdini::VdbPrimCIterator::advance
void advance()
Advance to the next VDB primitive.
openvdb_houdini::VdbPrimCIterator::operator=
VdbPrimCIterator & operator=(const VdbPrimCIterator &)
openvdb_houdini::VdbPrimCIterator::VdbPrimCIterator
VdbPrimCIterator(const GEO_Detail *, GA_Range::safedeletions, const GA_PrimitiveGroup *=nullptr, FilterFunc=FilterFunc())
Allow primitives to be deleted during iteration.
openvdb_houdini::VdbPrimCIterator::operator++
VdbPrimCIterator & operator++()
Definition Utils.h:79
openvdb_houdini::VdbPrimCIterator::getPrimitiveIndexAndName
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 ...
openvdb_houdini::VdbPrimCIterator::getOffset
GA_Offset getOffset() const
Definition Utils.h:90
openvdb_houdini::VdbPrimCIterator::getPrimitiveName
UT_String getPrimitiveName(const UT_String &defaultName="") const
Return the value of the current VDB primitive's name attribute.
openvdb_houdini::VdbPrimCIterator::VdbPrimCIterator
VdbPrimCIterator(const VdbPrimCIterator &)
openvdb_houdini::VdbPrimCIterator::getPrimitiveNameOrIndex
UT_String getPrimitiveNameOrIndex() const
Return the value of the current VDB primitive's name attribute or, if the name is empty,...
openvdb_houdini::VdbPrimIterator::operator=
VdbPrimIterator & operator=(const VdbPrimIterator &)
openvdb_houdini::VdbPrimIterator::operator->
GU_PrimVDB * operator->() const
Definition Utils.h:172
openvdb_houdini::VdbPrimIterator::operator++
VdbPrimIterator & operator++()
Advance to the next VDB primitive.
Definition Utils.h:164
openvdb_houdini::VdbPrimIterator::VdbPrimIterator
VdbPrimIterator(const VdbPrimIterator &)
openvdb_houdini::VdbPrimIterator::operator*
GU_PrimVDB * operator*() const
Definition Utils.h:171
openvdb_houdini::VdbPrimIterator::VdbPrimIterator
VdbPrimIterator(GEO_Detail *gdp, const GA_PrimitiveGroup *group=nullptr, FilterFunc filter=FilterFunc())
Definition Utils.h:143
openvdb_houdini::VdbPrimIterator::getPrimitive
GU_PrimVDB * getPrimitive() const
Return a pointer to the current VDB primitive (nullptr if at end).
Definition Utils.h:168
openvdb_houdini::VdbPrimIterator::VdbPrimIterator
VdbPrimIterator(GEO_Detail *gdp, GA_Range::safedeletions, const GA_PrimitiveGroup *group=nullptr, FilterFunc filter=FilterFunc())
Allow primitives to be deleted during iteration.
Definition Utils.h:156
openvdb::v13_0::FloatGrid
Grid< FloatTree > FloatGrid
Definition openvdb.h:76
openvdb::v13_0::Vec3DGrid
Grid< Vec3DTree > Vec3DGrid
Definition openvdb.h:81
openvdb::v13_0::BoolGrid
Grid< BoolTree > BoolGrid
Common grid types.
Definition openvdb.h:74
openvdb::v13_0::Vec3IGrid
Grid< Vec3ITree > Vec3IGrid
Definition openvdb.h:82
openvdb::v13_0::Int64Grid
Grid< Int64Tree > Int64Grid
Definition openvdb.h:79
openvdb::v13_0::Vec3SGrid
Grid< Vec3STree > Vec3SGrid
Definition openvdb.h:83
openvdb::v13_0::Int32Grid
Grid< Int32Tree > Int32Grid
Definition openvdb.h:78
openvdb::v13_0::DoubleGrid
Grid< DoubleTree > DoubleGrid
Definition openvdb.h:75
openvdb_houdini
Definition AttributeTransferUtil.h:34
openvdb_houdini::evalGridBBox
OPENVDB_HOUDINI_API bool evalGridBBox(GridCRef grid, UT_Vector3 corners[8], bool expandHalfVoxel=false)
Return in corners the corners of the given grid's active voxel bounding box.
openvdb_houdini::PointGridTypes
openvdb::TypeList< openvdb::points::PointDataGrid > PointGridTypes
Definition Utils.h:319
openvdb_houdini::ScalarGridTypes
openvdb::TypeList< openvdb::BoolGrid, openvdb::FloatGrid, openvdb::DoubleGrid, openvdb::Int32Grid, openvdb::Int64Grid > ScalarGridTypes
Definition Utils.h:297
openvdb_houdini::isLogForwarding
OPENVDB_HOUDINI_API bool isLogForwarding(OP_OpTypeId)
Return true if OpenVDB messages logged by operators of the given type are forwarded to the Houdini er...
openvdb_houdini::GridPtr
openvdb::GridBase::Ptr GridPtr
Definition Utils.h:44
openvdb_houdini::stopLogForwarding
OPENVDB_HOUDINI_API void stopLogForwarding(OP_OpTypeId)
Stop forwarding OpenVDB log messages to the Houdini error manager for all operators of the given type...
openvdb_houdini::AllGridTypes
VolumeGridTypes::Append< PointGridTypes > AllGridTypes
Definition Utils.h:324
openvdb_houdini::RealGridTypes
openvdb::TypeList< openvdb::FloatGrid, openvdb::DoubleGrid > RealGridTypes
Definition Utils.h:310
openvdb_houdini::GridCRef
const openvdb::GridBase & GridCRef
Definition Utils.h:47
openvdb_houdini::startLogForwarding
OPENVDB_HOUDINI_API void startLogForwarding(OP_OpTypeId)
Start forwarding OpenVDB log messages to the Houdini error manager for all operators of the given typ...
openvdb_houdini::GridRef
openvdb::GridBase & GridRef
Definition Utils.h:46
openvdb_houdini::createVdbPrimitive
OPENVDB_HOUDINI_API GU_PrimVDB * createVdbPrimitive(GU_Detail &gdp, GridPtr grid, const char *name=nullptr)
Store a VDB grid in a new VDB primitive and add the primitive to a geometry detail.
openvdb_houdini::Grid
openvdb::GridBase Grid
Definition Utils.h:43
openvdb_houdini::VolumeGridTypes
ScalarGridTypes::Append< Vec3GridTypes > VolumeGridTypes
Definition Utils.h:322
openvdb_houdini::GEOvdbApply
bool GEOvdbApply(const GEO_PrimVDB &vdb, OpT &op)
If the given primitive's grid resolves to one of the listed grid types, invoke the functor op on the ...
Definition Utils.h:332
openvdb_houdini::replaceVdbPrimitive
OPENVDB_HOUDINI_API GU_PrimVDB * replaceVdbPrimitive(GU_Detail &gdp, GridPtr grid, GEO_PrimVDB &src, const bool copyAttrs=true, const char *name=nullptr)
Replace an existing VDB primitive with a new primitive that contains the given grid.
openvdb_houdini::Vec3GridTypes
openvdb::TypeList< openvdb::Vec3SGrid, openvdb::Vec3DGrid, openvdb::Vec3IGrid > Vec3GridTypes
Definition Utils.h:314
openvdb_houdini::makeCoordBBox
OPENVDB_HOUDINI_API openvdb::CoordBBox makeCoordBBox(const UT_BoundingBox &, const openvdb::math::Transform &)
Construct an index-space CoordBBox from a UT_BoundingBox.
openvdb_houdini::GridCPtr
openvdb::GridBase::ConstPtr GridCPtr
Definition Utils.h:45
openvdb_houdini::NumericGridTypes
openvdb::TypeList< openvdb::FloatGrid, openvdb::DoubleGrid, openvdb::Int32Grid, openvdb::Int64Grid > NumericGridTypes
Definition Utils.h:304
openvdb.h
OP_InputIdx
unsigned OP_InputIdx
Definition Utils.h:37
OP_OutputIdx
unsigned OP_OutputIdx
Definition Utils.h:38
openvdb::v13_0::TypeList
A list of types (not necessarily unique).
Definition TypeList.h:578
openvdb::v13_0::TypeList< openvdb::BoolGrid, openvdb::FloatGrid, openvdb::DoubleGrid, openvdb::Int32Grid, openvdb::Int64Grid >::Append
typename typelist_internal::TSAppendImpl< Self, TypesToAppend... >::type Append
Definition TypeList.h:656