OpenVDB  6.0.0
PointAttribute.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2012-2018 DreamWorks Animation LLC
4 //
5 // All rights reserved. This software is distributed under the
6 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
7 //
8 // Redistributions of source code must retain the above copyright
9 // and license notice and the following restrictions and disclaimer.
10 //
11 // * Neither the name of DreamWorks Animation nor the names of
12 // its contributors may be used to endorse or promote products derived
13 // from this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 // IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
27 // LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
28 //
30 
36 
37 #ifndef OPENVDB_POINTS_POINT_ATTRIBUTE_HAS_BEEN_INCLUDED
38 #define OPENVDB_POINTS_POINT_ATTRIBUTE_HAS_BEEN_INCLUDED
39 
40 #include <openvdb/openvdb.h>
41 
42 #include "AttributeArrayString.h"
43 #include "AttributeSet.h"
44 #include "AttributeGroup.h"
45 #include "PointDataGrid.h"
46 
47 
48 namespace openvdb {
50 namespace OPENVDB_VERSION_NAME {
51 namespace points {
52 
53 namespace point_attribute_internal {
54 
55 template <typename ValueType>
56 struct Default
57 {
58  static inline ValueType value() { return zeroVal<ValueType>(); }
59 };
60 
61 } // namespace point_attribute_internal
62 
63 
75 template <typename PointDataTreeT>
76 inline void appendAttribute(PointDataTreeT& tree,
77  const Name& name,
78  const NamePair& type,
79  const Index strideOrTotalSize = 1,
80  const bool constantStride = true,
81  Metadata::Ptr metaDefaultValue = Metadata::Ptr(),
82  const bool hidden = false,
83  const bool transient = false);
84 
95 template <typename ValueType,
96  typename CodecType = NullCodec,
97  typename PointDataTreeT = PointDataTree>
98 inline void appendAttribute(PointDataTreeT& tree,
99  const std::string& name,
100  const ValueType& uniformValue =
101  point_attribute_internal::Default<ValueType>::value(),
102  const Index strideOrTotalSize = 1,
103  const bool constantStride = true,
104  Metadata::Ptr metaDefaultValue = Metadata::Ptr(),
105  const bool hidden = false,
106  const bool transient = false);
107 
113 template <typename ValueType, typename PointDataTreeT>
114 inline void collapseAttribute( PointDataTreeT& tree,
115  const Name& name,
116  const ValueType& uniformValue =
117  point_attribute_internal::Default<ValueType>::value());
118 
123 template <typename PointDataTreeT>
124 inline void dropAttributes( PointDataTreeT& tree,
125  const std::vector<size_t>& indices);
126 
131 template <typename PointDataTreeT>
132 inline void dropAttributes( PointDataTreeT& tree,
133  const std::vector<Name>& names);
134 
139 template <typename PointDataTreeT>
140 inline void dropAttribute( PointDataTreeT& tree,
141  const size_t& index);
142 
147 template <typename PointDataTreeT>
148 inline void dropAttribute( PointDataTreeT& tree,
149  const Name& name);
150 
160 template <typename PointDataTreeT>
161 inline void renameAttributes(PointDataTreeT& tree,
162  const std::vector<Name>& oldNames,
163  const std::vector<Name>& newNames);
164 
172 template <typename PointDataTreeT>
173 inline void renameAttribute(PointDataTreeT& tree,
174  const Name& oldName,
175  const Name& newName);
176 
180 template <typename PointDataTreeT>
181 inline void compactAttributes(PointDataTreeT& tree);
182 
183 
185 
186 
187 namespace point_attribute_internal {
188 
189 template<typename PointDataTreeT>
191 
193  using LeafRangeT = typename LeafManagerT::LeafRange;
194 
196  const size_t pos,
197  const Index strideOrTotalSize = 1,
198  const bool constantStride = true,
199  const bool hidden = false,
200  const bool transient = false)
201  : mDescriptor(descriptor)
202  , mPos(pos)
203  , mStrideOrTotalSize(strideOrTotalSize)
204  , mConstantStride(constantStride)
205  , mHidden(hidden)
206  , mTransient(transient) { }
207 
208  void operator()(const LeafRangeT& range) const {
209 
210  for (auto leaf = range.begin(); leaf; ++leaf) {
211  const AttributeSet::Descriptor::Ptr expected = leaf->attributeSet().descriptorPtr();
212 
213  AttributeArray::Ptr attribute = leaf->appendAttribute(
214  *expected, mDescriptor, mPos, mStrideOrTotalSize, mConstantStride);
215 
216  if (mHidden) attribute->setHidden(true);
217  if (mTransient) attribute->setTransient(true);
218  }
219  }
220 
222 
224  const size_t mPos;
226  const bool mConstantStride;
227  const bool mHidden;
228  const bool mTransient;
229 }; // class AppendAttributeOp
230 
231 
233 
234 
235 template <typename ValueType, typename PointDataTreeT>
237 
239  using LeafRangeT = typename LeafManagerT::LeafRange;
240 
241  CollapseAttributeOp(const size_t pos,
242  const ValueType& uniformValue)
243  : mPos(pos)
244  , mUniformValue(uniformValue) { }
245 
246  void operator()(const LeafRangeT& range) const {
247 
248  for (auto leaf = range.begin(); leaf; ++leaf) {
249  assert(leaf->hasAttribute(mPos));
250  AttributeArray& array = leaf->attributeArray(mPos);
251  AttributeWriteHandle<ValueType> handle(array);
252  handle.collapse(mUniformValue);
253  }
254  }
255 
257 
258  const size_t mPos;
259  const ValueType mUniformValue;
260 }; // class CollapseAttributeOp
261 
262 
264 
265 
266 template <typename PointDataTreeT>
267 struct CollapseAttributeOp<Name, PointDataTreeT> {
268 
270  using LeafRangeT = typename LeafManagerT::LeafRange;
271 
272  CollapseAttributeOp(const size_t pos,
273  const Name& uniformValue)
274  : mPos(pos)
275  , mUniformValue(uniformValue) { }
276 
277  void operator()(const LeafRangeT& range) const {
278 
279  for (auto leaf = range.begin(); leaf; ++leaf) {
280  assert(leaf->hasAttribute(mPos));
281  AttributeArray& array = leaf->attributeArray(mPos);
282 
283  const AttributeSet::Descriptor& descriptor = leaf->attributeSet().descriptor();
284  const MetaMap& metadata = descriptor.getMetadata();
285 
286  StringAttributeWriteHandle handle(array, metadata);
287  handle.collapse(mUniformValue);
288  }
289  }
290 
292 
293  const size_t mPos;
295 }; // class CollapseAttributeOp
296 
297 
299 
300 
301 template<typename PointDataTreeT>
303 
305  using LeafRangeT = typename LeafManagerT::LeafRange;
306  using Indices = std::vector<size_t>;
307 
308  DropAttributesOp( const Indices& indices,
309  AttributeSet::DescriptorPtr& descriptor)
310  : mIndices(indices)
311  , mDescriptor(descriptor) { }
312 
313  void operator()(const LeafRangeT& range) const {
314 
315  for (auto leaf = range.begin(); leaf; ++leaf) {
316 
317  const AttributeSet::Descriptor::Ptr expected = leaf->attributeSet().descriptorPtr();
318 
319  leaf->dropAttributes(mIndices, *expected, mDescriptor);
320  }
321  }
322 
324 
327 }; // class DropAttributesOp
328 
329 
331 
332 
333 template<typename PointDataTreeT>
335 
337  using LeafRangeT = typename LeafManagerT::LeafRange;
338 
339  void operator()(const LeafRangeT& range) const {
340  for (auto leaf = range.begin(); leaf; ++leaf) {
341  leaf->compactAttributes();
342  }
343  }
344 }; // class CompactAttributesOp
345 
346 
348 
349 
350 template <typename ValueType, typename CodecType>
352 {
353  static const NamePair& type() {
355  }
356 };
357 
358 
359 template <typename CodecType>
360 struct AttributeTypeConversion<Name, CodecType>
361 {
362  static const NamePair& type() { return StringAttributeArray::attributeType(); }
363 };
364 
365 
367 
368 
369 template <typename PointDataTreeT, typename ValueType>
371 {
372  static void add(PointDataTreeT&, const ValueType&) {}
373 
374  template<typename AttributeListType>
375  static void add(PointDataTreeT&, const AttributeListType&) {}
376 };
377 
378 
379 template <typename PointDataTreeT>
380 struct MetadataStorage<PointDataTreeT, Name>
381 {
382  static void add(PointDataTreeT& tree, const Name& uniformValue) {
383  MetaMap& metadata = makeDescriptorUnique(tree)->getMetadata();
384  StringMetaInserter inserter(metadata);
385  inserter.insert(uniformValue);
386  }
387 
388  template<typename AttributeListType>
389  static void add(PointDataTreeT& tree, const AttributeListType& data) {
390  MetaMap& metadata = makeDescriptorUnique(tree)->getMetadata();
391  StringMetaInserter inserter(metadata);
392  Name value;
393 
394  for (size_t i = 0; i < data.size(); i++) {
395  data.get(value, i);
396  inserter.insert(value);
397  }
398  }
399 };
400 
401 
402 } // namespace point_attribute_internal
403 
404 
406 
407 
408 template <typename PointDataTreeT>
409 inline void appendAttribute(PointDataTreeT& tree,
410  const Name& name,
411  const NamePair& type,
412  const Index strideOrTotalSize,
413  const bool constantStride,
414  Metadata::Ptr metaDefaultValue,
415  const bool hidden,
416  const bool transient)
417 {
418  using Descriptor = AttributeSet::Descriptor;
419 
421 
422  auto iter = tree.cbeginLeaf();
423 
424  if (!iter) return;
425 
426  // do not append a non-unique attribute
427 
428  const Descriptor& descriptor = iter->attributeSet().descriptor();
429  const size_t index = descriptor.find(name);
430 
431  if (index != AttributeSet::INVALID_POS) {
433  "Cannot append an attribute with a non-unique name - " << name << ".");
434  }
435 
436  // create a new attribute descriptor
437 
438  Descriptor::Ptr newDescriptor = descriptor.duplicateAppend(name, type);
439 
440  // store the attribute default value in the descriptor metadata
441 
442  if (metaDefaultValue) {
443  newDescriptor->setDefaultValue(name, *metaDefaultValue);
444  }
445 
446  // extract new pos
447 
448  const size_t pos = newDescriptor->find(name);
449 
450  // insert attributes using the new descriptor
451 
452  tree::LeafManager<PointDataTreeT> leafManager(tree);
453  AppendAttributeOp<PointDataTreeT> append(newDescriptor, pos, strideOrTotalSize,
454  constantStride, hidden, transient);
455  tbb::parallel_for(leafManager.leafRange(), append);
456 }
457 
458 
460 
461 
462 template <typename ValueType, typename CodecType, typename PointDataTreeT>
463 inline void appendAttribute(PointDataTreeT& tree,
464  const std::string& name,
465  const ValueType& uniformValue,
466  const Index strideOrTotalSize,
467  const bool constantStride,
468  Metadata::Ptr metaDefaultValue,
469  const bool hidden,
470  const bool transient)
471 {
472  static_assert(!std::is_base_of<AttributeArray, ValueType>::value,
473  "ValueType must not be derived from AttributeArray");
474 
478 
479  appendAttribute(tree, name, AttributeTypeConversion<ValueType, CodecType>::type(),
480  strideOrTotalSize, constantStride, metaDefaultValue, hidden, transient);
481 
482  if (!math::isExactlyEqual(uniformValue, Default<ValueType>::value())) {
483  MetadataStorage<PointDataTreeT, ValueType>::add(tree, uniformValue);
484  collapseAttribute<ValueType>(tree, name, uniformValue);
485  }
486 }
487 
488 
490 
491 
492 template <typename ValueType, typename PointDataTreeT>
493 inline void collapseAttribute( PointDataTreeT& tree,
494  const Name& name,
495  const ValueType& uniformValue)
496 {
497  static_assert(!std::is_base_of<AttributeArray, ValueType>::value,
498  "ValueType must not be derived from AttributeArray");
499 
500  using LeafManagerT = typename tree::LeafManager<PointDataTreeT>;
501  using Descriptor = AttributeSet::Descriptor;
502 
504 
505  auto iter = tree.cbeginLeaf();
506 
507  if (!iter) return;
508 
509 
510  const Descriptor& descriptor = iter->attributeSet().descriptor();
511 
512  // throw if attribute name does not exist
513 
514  const size_t index = descriptor.find(name);
515  if (index == AttributeSet::INVALID_POS) {
516  OPENVDB_THROW(KeyError, "Cannot find attribute name in PointDataTree.");
517  }
518 
519  LeafManagerT leafManager(tree);
520  tbb::parallel_for(leafManager.leafRange(),
521  CollapseAttributeOp<ValueType, PointDataTreeT>(index, uniformValue));
522 }
523 
524 
526 
527 
528 template <typename PointDataTreeT>
529 inline void dropAttributes( PointDataTreeT& tree,
530  const std::vector<size_t>& indices)
531 {
532  using LeafManagerT = typename tree::LeafManager<PointDataTreeT>;
533  using Descriptor = AttributeSet::Descriptor;
534 
536 
537  auto iter = tree.cbeginLeaf();
538 
539  if (!iter) return;
540 
541  const Descriptor& descriptor = iter->attributeSet().descriptor();
542 
543  // throw if position index present in the indices as this attribute is mandatory
544 
545  const size_t positionIndex = descriptor.find("P");
546  if (positionIndex!= AttributeSet::INVALID_POS &&
547  std::find(indices.begin(), indices.end(), positionIndex) != indices.end()) {
548  OPENVDB_THROW(KeyError, "Cannot drop mandatory position attribute.");
549  }
550 
551  // insert attributes using the new descriptor
552 
553  Descriptor::Ptr newDescriptor = descriptor.duplicateDrop(indices);
554 
555  LeafManagerT leafManager(tree);
556  tbb::parallel_for(leafManager.leafRange(),
557  DropAttributesOp<PointDataTreeT>(indices, newDescriptor));
558 }
559 
560 
562 
563 
564 template <typename PointDataTreeT>
565 inline void dropAttributes( PointDataTreeT& tree,
566  const std::vector<Name>& names)
567 {
568  auto iter = tree.cbeginLeaf();
569 
570  if (!iter) return;
571 
572  const AttributeSet& attributeSet = iter->attributeSet();
573  const AttributeSet::Descriptor& descriptor = attributeSet.descriptor();
574 
575  std::vector<size_t> indices;
576 
577  for (const Name& name : names) {
578  const size_t index = descriptor.find(name);
579 
580  // do not attempt to drop an attribute that does not exist
581  if (index == AttributeSet::INVALID_POS) {
583  "Cannot drop an attribute that does not exist - " << name << ".");
584  }
585 
586  indices.push_back(index);
587  }
588 
589  dropAttributes(tree, indices);
590 }
591 
592 
594 
595 
596 template <typename PointDataTreeT>
597 inline void dropAttribute( PointDataTreeT& tree,
598  const size_t& index)
599 {
600  std::vector<size_t> indices{index};
601  dropAttributes(tree, indices);
602 }
603 
604 
605 template <typename PointDataTreeT>
606 inline void dropAttribute( PointDataTreeT& tree,
607  const Name& name)
608 {
609  std::vector<Name> names{name};
610  dropAttributes(tree, names);
611 }
612 
613 
615 
616 
617 template <typename PointDataTreeT>
618 inline void renameAttributes( PointDataTreeT& tree,
619  const std::vector<Name>& oldNames,
620  const std::vector<Name>& newNames)
621 {
622  if (oldNames.size() != newNames.size()) {
623  OPENVDB_THROW(ValueError, "Mis-matching sizes of name vectors, cannot rename attributes.");
624  }
625 
626  using Descriptor = AttributeSet::Descriptor;
627 
628  auto iter = tree.beginLeaf();
629 
630  if (!iter) return;
631 
632  const AttributeSet& attributeSet = iter->attributeSet();
633  const Descriptor::Ptr descriptor = attributeSet.descriptorPtr();
634  auto newDescriptor = std::make_shared<Descriptor>(*descriptor);
635 
636  for (size_t i = 0; i < oldNames.size(); i++) {
637  const Name& oldName = oldNames[i];
638  if (descriptor->find(oldName) == AttributeSet::INVALID_POS) {
639  OPENVDB_THROW(KeyError, "Cannot find requested attribute - " << oldName << ".");
640  }
641 
642  const Name& newName = newNames[i];
643  if (descriptor->find(newName) != AttributeSet::INVALID_POS) {
645  "Cannot rename attribute as new name already exists - " << newName << ".");
646  }
647 
648  const AttributeArray* array = attributeSet.getConst(oldName);
649  assert(array);
650 
651  if (isGroup(*array)) {
652  OPENVDB_THROW(KeyError, "Cannot rename group attribute - " << oldName << ".");
653  }
654 
655  newDescriptor->rename(oldName, newName);
656  }
657 
658  for (; iter; ++iter) {
659  iter->renameAttributes(*descriptor, newDescriptor);
660  }
661 }
662 
663 
664 template <typename PointDataTreeT>
665 inline void renameAttribute(PointDataTreeT& tree,
666  const Name& oldName,
667  const Name& newName)
668 {
669  renameAttributes(tree, {oldName}, {newName});
670 }
671 
672 
674 
675 
676 template <typename PointDataTreeT>
677 inline void compactAttributes(PointDataTreeT& tree)
678 {
679  using LeafManagerT = typename tree::LeafManager<PointDataTreeT>;
680 
682 
683  auto iter = tree.beginLeaf();
684  if (!iter) return;
685 
686  LeafManagerT leafManager(tree);
687  tbb::parallel_for(leafManager.leafRange(), CompactAttributesOp<PointDataTreeT>());
688 }
689 
690 
692 
693 
694 template <typename PointDataTreeT>
695 OPENVDB_DEPRECATED inline void bloscCompressAttribute( PointDataTreeT&,
696  const Name&)
697 {
698  // in-memory compression is no longer supported
699 }
700 
701 
703 
704 
705 } // namespace points
706 } // namespace OPENVDB_VERSION_NAME
707 } // namespace openvdb
708 
709 #endif // OPENVDB_POINTS_POINT_ATTRIBUTE_HAS_BEEN_INCLUDED
710 
711 // Copyright (c) 2012-2018 DreamWorks Animation LLC
712 // All rights reserved. This software is distributed under the
713 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
typename LeafManagerT::LeafRange LeafRangeT
Definition: PointAttribute.h:337
Attribute Group access and filtering for iteration.
#define OPENVDB_DEPRECATED
Definition: Platform.h:49
Index32 Index
Definition: Types.h:61
typename tree::LeafManager< PointDataTreeT > LeafManagerT
Definition: PointAttribute.h:269
typename tree::LeafManager< PointDataTreeT > LeafManagerT
Definition: PointAttribute.h:336
typename LeafManagerT::LeafRange LeafRangeT
Definition: PointAttribute.h:305
const Indices & mIndices
Definition: PointAttribute.h:325
Typed class for storing attribute data.
Definition: AttributeArray.h:574
Write-able version of AttributeHandle.
Definition: AttributeArray.h:903
static void add(PointDataTreeT &tree, const Name &uniformValue)
Definition: PointAttribute.h:382
const ValueType mUniformValue
Definition: PointAttribute.h:259
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:109
Definition: AttributeArrayString.h:83
bool isExactlyEqual(const T0 &a, const T1 &b)
Return true if a is exactly equal to b.
Definition: Math.h:395
static void add(PointDataTreeT &, const ValueType &)
Definition: PointAttribute.h:372
void operator()(const LeafRangeT &range) const
Definition: PointAttribute.h:208
CollapseAttributeOp(const size_t pos, const ValueType &uniformValue)
Definition: PointAttribute.h:241
Descriptor & descriptor()
Return a reference to this attribute set's descriptor, which might be shared with other sets.
Definition: AttributeSet.h:121
std::pair< Name, Name > NamePair
Definition: AttributeArray.h:65
static void add(PointDataTreeT &tree, const AttributeListType &data)
Definition: PointAttribute.h:389
bool isGroup(const AttributeArray &array)
Definition: AttributeGroup.h:93
void compactAttributes(PointDataTreeT &tree)
Compact attributes in a VDB tree (if possible).
Definition: PointAttribute.h:677
void collapse()
Replace the existing array with a uniform value (zero if none provided).
Definition: AttributeArray.h:2247
void dropAttributes(PointDataTreeT &tree, const std::vector< Name > &names)
Drops attributes from the VDB tree.
Definition: PointAttribute.h:565
void operator()(const LeafRangeT &range) const
Definition: PointAttribute.h:277
Definition: Exceptions.h:86
const AttributeArray * getConst(const std::string &name) const
Return a pointer to the attribute array whose name is name or a null pointer if no match is found.
AttributeSet::Descriptor::Ptr makeDescriptorUnique(PointDataTreeT &tree)
Deep copy the descriptor across all leaf nodes.
Definition: PointDataGrid.h:1604
Container that maps names (strings) to values of arbitrary types.
Definition: MetaMap.h:46
Ordered collection of uniquely-named attribute arrays.
Definition: AttributeSet.h:62
typename LeafManagerT::LeafRange LeafRangeT
Definition: PointAttribute.h:193
typename tree::LeafManager< PointDataTreeT > LeafManagerT
Definition: PointAttribute.h:192
void collapse()
Set membership for the whole array and attempt to collapse.
tree::Tree< tree::RootNode< tree::InternalNode< tree::InternalNode< PointDataLeafNode< PointDataIndex32, 3 >, 4 >, 5 > >> PointDataTree
Point index tree configured to match the default VDB configurations.
Definition: PointDataGrid.h:216
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:136
AttributeSet::DescriptorPtr & mDescriptor
Definition: PointAttribute.h:223
typename LeafManagerT::LeafRange LeafRangeT
Definition: PointAttribute.h:239
void collapseAttribute(PointDataTreeT &tree, const Name &name, const ValueType &uniformValue=point_attribute_internal::Default< ValueType >::value())
Collapse the attribute into a uniform value.
Definition: PointAttribute.h:493
CollapseAttributeOp(const size_t pos, const Name &uniformValue)
Definition: PointAttribute.h:272
void operator()(const LeafRangeT &range) const
Definition: PointAttribute.h:246
const bool mConstantStride
Definition: PointAttribute.h:226
Definition: Exceptions.h:40
static ValueType value()
Definition: PointAttribute.h:58
void renameAttributes(PointDataTreeT &tree, const std::vector< Name > &oldNames, const std::vector< Name > &newNames)
Rename attributes in a VDB tree.
Definition: PointAttribute.h:618
T::Ptr getMetadata(const Name &)
Return a pointer to a TypedMetadata object of type T and with the given name. If no such field exists...
Definition: MetaMap.h:165
std::shared_ptr< AttributeArray > Ptr
Definition: AttributeArray.h:144
typename tree::LeafManager< PointDataTreeT > LeafManagerT
Definition: PointAttribute.h:238
This class manages a linear array of pointers to a given tree's leaf nodes, as well as optional auxil...
Definition: LeafManager.h:110
DropAttributesOp(const Indices &indices, AttributeSet::DescriptorPtr &descriptor)
Definition: PointAttribute.h:308
SharedPtr< Metadata > Ptr
Definition: Metadata.h:53
const bool mTransient
Definition: PointAttribute.h:228
static void add(PointDataTreeT &, const AttributeListType &)
Definition: PointAttribute.h:375
std::shared_ptr< Descriptor > DescriptorPtr
Definition: AttributeSet.h:72
void insert(const Name &name)
Insert the string into the metadata.
Base class for storing attribute data.
Definition: AttributeArray.h:118
AppendAttributeOp(AttributeSet::DescriptorPtr &descriptor, const size_t pos, const Index strideOrTotalSize=1, const bool constantStride=true, const bool hidden=false, const bool transient=false)
Definition: PointAttribute.h:195
void operator()(const LeafRangeT &range) const
Definition: PointAttribute.h:339
typename tree::LeafManager< PointDataTreeT > LeafManagerT
Definition: PointAttribute.h:304
Attribute-owned data structure for points. Point attributes are stored in leaf nodes and ordered by v...
typename LeafManagerT::LeafRange LeafRangeT
Definition: PointAttribute.h:270
void dropAttribute(PointDataTreeT &tree, const Name &name)
Drop one attribute from the VDB tree (convenience method).
Definition: PointAttribute.h:606
std::vector< size_t > Indices
Definition: PointAttribute.h:306
LeafRange leafRange(size_t grainsize=1) const
Return a TBB-compatible LeafRange.
Definition: LeafManager.h:386
Attribute array storage for string data using Descriptor Metadata.
const Index mStrideOrTotalSize
Definition: PointAttribute.h:225
Definition: Exceptions.h:92
const bool mHidden
Definition: PointAttribute.h:227
static const NamePair & type()
Definition: PointAttribute.h:353
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:188
Definition: AttributeArrayString.h:160
const size_t mPos
Definition: PointAttribute.h:224
void operator()(const LeafRangeT &range) const
Definition: PointAttribute.h:313
std::string Name
Definition: Name.h:44
Set of Attribute Arrays which tracks metadata about each array.
void renameAttribute(PointDataTreeT &tree, const Name &oldName, const Name &newName)
Rename an attribute in a VDB tree.
Definition: PointAttribute.h:665
DescriptorPtr descriptorPtr() const
Return a pointer to this attribute set's descriptor, which might be shared with other sets.
Definition: AttributeSet.h:127
AttributeSet::DescriptorPtr & mDescriptor
Definition: PointAttribute.h:326
void appendAttribute(PointDataTreeT &tree, const std::string &name, const ValueType &uniformValue=point_attribute_internal::Default< ValueType >::value(), const Index strideOrTotalSize=1, const bool constantStride=true, Metadata::Ptr metaDefaultValue=Metadata::Ptr(), const bool hidden=false, const bool transient=false)
Appends a new attribute to the VDB tree.
Definition: PointAttribute.h:463
OPENVDB_DEPRECATED void bloscCompressAttribute(PointDataTreeT &, const Name &)
Definition: PointAttribute.h:695