HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_Detail.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GA_Detail.h ( GA Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #pragma once
12 
13 #ifndef __GA_Detail__
14 #define __GA_Detail__
15 
16 #include "GA_API.h"
17 #include "GA_ATITopology.h"
18 #include "GA_AttributeRef.h"
19 #include "GA_AttributeSet.h"
20 #include "GA_Defaults.h"
21 #include "GA_EdgeGroup.h"
22 #include "GA_EdgeGroupTable.h"
23 #include "GA_ElementGroup.h"
24 #include "GA_ElementGroupOrder.h"
25 #include "GA_ElementGroupTable.h"
26 #include "GA_Handle.h"
27 #include "GA_IndexMap.h"
28 #include "GA_IntrinsicManager.h"
29 #include "GA_OffsetList.h"
30 #include "GA_PrimitiveFactory.h"
31 #include "GA_PrimitiveList.h"
32 #include "GA_PrimitiveTypeMask.h"
33 #include "GA_Range.h"
34 #include "GA_Topology.h"
35 #include "GA_Types.h"
36 
37 #include <UT/UT_Assert.h>
38 #include <UT/UT_BoundingBox.h>
39 #include <UT/UT_BoundingRect.h>
40 #include <UT/UT_Vector2.h>
41 #include <UT/UT_Vector3.h>
42 #include <UT/UT_Vector4.h>
43 
44 #include <SYS/SYS_Compiler.h>
45 #include <SYS/SYS_Inline.h>
46 #include <SYS/SYS_Types.h>
47 
48 #include <iosfwd>
49 
50 class UT_IStream;
51 class UT_JSONParser;
52 class UT_JSONWriter;
53 class UT_MemoryCounter;
54 class UT_Options;
55 class UT_String;
56 class UT_StringArray;
57 class UT_StringHolder;
58 class UT_StringRef;
59 class UT_WorkBuffer;
60 template <typename T> class UT_Array;
61 
62 class GA_ATINumeric;
65 class GA_Attribute;
66 class GA_AttributeDict;
67 class GA_AttributeFilter;
70 class GA_AttributeType;
71 class GA_Group;
72 class GA_GroupTable;
73 class GA_IntrinsicEval;
74 class GA_IO;
75 class GA_LoadMap;
76 class GA_LoadOptions;
77 class GA_MergeMap;
78 class GA_MergeOptions;
79 class GA_PolyCounts;
80 class GA_Primitive;
81 class GA_PrimitiveTypeId;
83 class GA_SaveOptions;
84 class GA_Stat;
85 class ga_TailInitializeTable;
86 
87 namespace GA_FileFormatH9 { class PrimTypeXlate; }
88 
89 /// @brief Container class for all geometry.
90 ///
91 /// All Houdini geometry is stored in a GA_Detail class. The detail stores
92 /// lists of attributes (GA_Attribute) which are maintained in GA_AttributeSet
93 /// collections. The attribute set contains 4 separate classes of attribute
94 /// based on the GA_AttributeOwner enum.
96 {
97 public:
98  /// @param Pstorage determines the precision of the @b P attribute.
99  /// @param isprimary determines the default value of the @b P attribute.
100  /// true yields (0,0,0) as the default, and false yields (0,0,1),
101  /// for use by GD_Detail, where the z component is actually the
102  /// point weight for NURBS/Bezier trim/profile curves.
103  /// P will have typeinfo "hpoint" if secondary, and "point" if primary.
104  /// @param full_topology indicates whether the detail should maintain
105  /// additional attributes which make it easy to lookup
106  /// - Primitives using a shared point
107  /// - The primitive containing a unique point (vertex)
108  /// - The list of vertices referencing a shared point
109  /// @see typedef::GA_Storage.
111  bool isprimary=true,
112  bool full_topology=true);
113  /// Destructor
114  virtual ~GA_Detail();
115 
116  exint getUniqueId() const { return myUniqueId; }
117 
118  /// Re-initialize:
119  /// - Clears all attributes
120  /// - Clears all geometry elements (points, primitives, vertices, etc.)
121  /// - Clears all groups
122  /// NOTE: Does *NOT* clear caches like the primitive stash or selections,
123  /// though it does clear the attribute instance matrix. It has
124  /// to keep the stash, because it's used by stashAll().
125  /// Use clearAndDestroy() to clear everything.
126  void clear() { clearData(false); }
127 
128  /// Returns true if the detail is empty. This is not just
129  /// having zero points/primitives, but also only having trivial
130  /// attributes.
131  bool isEmpty() const;
132 
133  /// These two functions should be used instead of the more
134  /// destructive clearAndDestroy() when it it likely the
135  /// geometry it relatively stable between operations
136  /// @{
137  void stashAll()
138  {
139  clearCaches();
140 
141  getPrimitiveList().stashAll();
142 
143  // We have to clear the primitive index map before calling the virtual
144  // clearAndDestroy() to prevent primitive iterators from ending up in
145  // a bad state with expected entries missing from the primitive list.
146  getIndexMap(GA_ATTRIB_PRIMITIVE).clear(/*clear_capacity*/ true);
147 
148  // Increment the meta-cache count, since it did so before, in case
149  // anything is relying on it being incremented here.
150  incrementMetaCacheCount();
151 
152  // remove the rest
153  clear();
154  }
156  {
157  getPrimitiveList().destroyStashed();
158  }
159  ///@}
160 
161  // -------------- P attribute ----------------------------
162  /// Convenience method to access the @b P attribute
163  GA_Attribute *getP() { return myP; }
164  const GA_Attribute *getP() const { return myP; }
165 
166  /// The ptoff passed is the point offset. @see vertexPoint()
168  {
169  UT_Vector3 v3 = myHandlePV3.get(ptoff);
170  return UT_Vector2(v3.x(), v3.y());
171  }
172  /// The ptoff passed is the point offset. @see vertexPoint()
174  getPos3(GA_Offset ptoff) const
175  {
176  return myHandlePV3.get(ptoff);
177  }
178  /// Get an array of all positions from the given point range.
179  /// The template parameter T is must be one of: fpreal, fpreal32, or
180  /// fpreal64.
181  template <typename T>
183  const GA_Range &ptrange,
184  UT_Array< UT_Vector3T<T> > &positions) const
185  {
186  return getAttributeAsArray(getP(), ptrange, positions);
187  }
188  /// Get an array of all positions from the given point range.
189  /// The template parameter T is must be one of: fpreal, fpreal32, or
190  /// fpreal64.
191  template <typename T>
193  const GA_Range &ptrange,
194  const UT_Array< UT_Vector3T<T> > &positions)
195  {
196  return setAttributeFromArray(getP(), ptrange, positions);
197  }
198 
199  /// Set @b P from a UT_Vector2
200  void setPos2(GA_Offset ptoff, const UT_Vector2 &P)
201  {
202  UT_Vector3 v3 = UT_Vector3(P.x(), P.y(), myHandlePV3.get(ptoff).z());
203  myHandlePV3.set(ptoff, v3);
204  }
205  /// Set @b P from a UT_Vector3
207  void setPos3(GA_Offset ptoff, const UT_Vector3 &P)
208  {
209  myHandlePV3.set(ptoff, P);
210  }
211  /// Set @b P given the x, y, z components.
214  {
215  myHandlePV3.set(ptoff, UT_Vector3(x,y,z));
216  }
217 
218  /// Apply a translation to the specified point index. @see vertexPoint()
219  /// Effectively setPos3(offset, getPos3(offset) + delta)
221  void translatePoint(GA_Offset ptoff, const UT_Vector3 &delta)
222  {
223  myHandlePV3.add(ptoff, delta);
224  }
225 
226  //
227  // Functions for handling Pw: specific to rational NURBS and Bezier
228  // curves and surfaces! DO NOT USE unless you actually need to adjust the
229  // point weights!
230  //
231 
232  /// Get the homogeneous coordinate for a point
233  fpreal getPw(GA_Offset ptoff) const;
234  /// Set the homogeneous coordinate for a point
235  void setPw(GA_Offset ptoff, fpreal w);
236  /// NOTE: This will usually return nullptr, because very
237  /// few things actually set the homogenous coordinate
238  /// to anything other than 1.0, in which case, the
239  /// attribute won't be created.
240  /// @{
242  {
243  return myPw;
244  }
246  {
247  return myPw;
248  }
249  /// @}
250 
251  /// The ptoff passed is the point offset. @see vertexPoint()
253  {
254  return UT_Vector4(getPos3(ptoff), getPw(ptoff));
255  }
256 
257  /// Set @b P from a UT_Vector4
258  void setPos4(GA_Offset ptoff, const UT_Vector4 &P)
259  {
260  setPos3(ptoff, UT_Vector3(P));
261  setPw(ptoff, P.w());
262  }
263  /// Set @b P given the x, y, z, w components.
265  fpreal z, fpreal w)
266  {
267  setPos3(ptoff, UT_Vector3(x, y, z));
268  setPw(ptoff, w);
269  }
270 
271  //
272  // -------------- Element Interface ----------------------
273  //
274 
275  /// Append a new point, returning its new data offset
278  { return appendPointBlock(1); }
279  /// Append new points, returning the first offset of the contiguous block
282  { return myPointMap.addElementBlock(npoints); }
283  /// Return the number of points
286  { return myPointMap.indexSize(); }
287  /// This will be an exclusive, possibly loose, upper bound when iterating
288  /// over point offsets.
289  /// Every point offset in this detail will be strictly less than this.
290  /// @note (getNumPoints() <= getNumPointOffsets()) is always true.
293  { return myPointMap.offsetSize(); }
294  /// Given a point's index (in append order), return its data offset
297  { return myPointMap.offsetFromIndex(index); }
298  /// Given a point's data offset, return its index
301  { return myPointMap.indexFromOffset(offset); }
302  /// Reorder a point. The index of the point at the given data offset
303  /// will be changed to the new order (provided that the ordered position is
304  /// in a valid range).
305  /// @return The new index of the point, or -1 if there was an error
306  GA_Index reorderPoint(GA_Offset ptoff, GA_Index new_order);
307 
308  /// Append a primitive by GA_PrimitiveTypeId
309  GA_Primitive *appendPrimitive(const GA_PrimitiveTypeId &type);
310  /// Append a primitive by type name string
311  GA_Primitive *appendPrimitive(const UT_StringRef &type);
312  /// Append a contiguous block of primitives by GA_PrimitiveTypeId
313  GA_Offset appendPrimitiveBlock(const GA_PrimitiveTypeId &type,
314  GA_Size nprimitives);
315 
316  /// Append a contiguous block of primitives and a contiguous
317  /// block of vertices, with each primitive having nvertices_each vertices,
318  /// though the vertices will be unwired, so the caller is responsible
319  /// for wiring the vertices to points.
320  /// Make absolutely sure you know what you're doing if you call this!
321  /// It's used by GEO_PrimPoly::buildBlock() and GEO_PrimTetrahedron::
322  /// buildBlock().
323  /// The return value is the start offset of the primitive block,
324  /// and vertex_block_start is filled with the start offset of the
325  /// vertex block.
326  GA_Offset appendPrimitivesAndVertices(
327  const GA_PrimitiveTypeId &type,
328  GA_Size nprimitives,
329  GA_Size nvertices_each,
330  GA_Offset &vertex_block_start,
331  bool closed_flag = false);
332 
333  /// Append a contiguous block of primitives and a contiguous
334  /// block of vertices, with vertex_counts being a run-length encoded
335  /// array indicating the number of vertices in each primitive,
336  /// though the vertices will be unwired, so the caller is responsible
337  /// for wiring the vertices to points.
338  /// Make absolutely sure you know what you're doing if you call this!
339  /// It's used by GEO_PrimPoly::buildBlock() and GEO_PrimTetrahedron::
340  /// buildBlock().
341  /// The return value is the start offset of the primitive block,
342  /// and vertex_block_start is filled with the start offset of the
343  /// vertex block.
344  GA_Offset appendPrimitivesAndVertices(
345  const GA_PrimitiveTypeId &type,
346  const GA_PolyCounts &vertex_counts,
347  GA_Offset &vertex_block_start,
348  bool closed_flag = false);
349 
350  GA_Offset appendPrimitivesAndVertices(
351  const std::pair<int,exint> *primtype_count_pairs,
352  const GA_PolyCounts &vertex_counts,
353  GA_Offset &vertex_block_start,
354  const exint *closed_span_length = nullptr,
355  exint ncopies=1);
356 
357  /// Return the number of primitives
360  { return myPrimitiveMap.indexSize(); }
361  /// This will be an exclusive, possibly loose, upper bound when iterating
362  /// over primitive offsets.
363  /// Every primitive offset in this detail will be strictly less than this.
364  /// @note (getNumPrimitives() <= getNumPrimitiveOffsets()) is always true.
367  { return myPrimitiveMap.offsetSize(); }
368  /// Given a primitive's index (in append order), return its data offset
371  { return myPrimitiveMap.offsetFromIndex(index); }
372  /// Given a primitive's data offset, return its index
375  { return myPrimitiveMap.indexFromOffset(offset); }
376 
377  /// Get the primitive by offset
378  /// @{
381  { return myPrimitiveList.get(prim_off); }
383  const GA_Primitive *getPrimitive(GA_Offset prim_off) const
384  { return myPrimitiveList.get(prim_off); }
385  /// @}
386 
387  /// Get the primitive by index
388  /// @{
390  { return myPrimitiveList.get(primitiveOffset(prim_idx)); }
392  { return myPrimitiveList.get(primitiveOffset(prim_idx)); }
393  /// @}
394 
395  /// Returns a shallow copy of the vertex list of the primitive at the
396  /// specified primitive offset.
397  /// You must include GA_Primitive.h to use this.
399  GA_OffsetListRef getPrimitiveVertexList(GA_Offset primoff) const;
400 
401  /// Returns the number of vertices in the primitive at the specified
402  /// primitive offset.
403  /// You must include GA_Primitive.h to use this.
405  GA_Size getPrimitiveVertexCount(GA_Offset primoff) const;
406 
407  /// Returns the vertex offset in the primitive at the specified
408  /// primitive offset in vertex list position i.
409  /// If you're accessing all vertex offsets, it'll be faster to
410  /// call getVertexList() once and either read from that or
411  /// call forEach(fucntor) on it.
412  /// You must include GA_Primitive.h to use this.
414  GA_Offset getPrimitiveVertexOffset(GA_Offset primoff, GA_Size i) const;
415 
416  /// Returns the type ID of the primitive at the specified
417  /// primitive offset.
418  /// You must include GA_Primitive.h to use this.
420  int getPrimitiveTypeId(GA_Offset primoff) const;
421 
422  /// Returns the "closed" flag for polygon, NURBS curve, or Bezier curve
423  /// primitives, or false for other primitive types.
424  /// You must include GA_Primitive.h to use this.
426  bool getPrimitiveClosedFlag(GA_Offset primoff) const;
427 
428  /// Sets the "closed" flag for polygon primitives.
429  /// For NURBS curve or Bezier curve primitives, use GEO_Face::close()
430  /// or GEO_Face::open().
431  /// You must include GA_Primitive.h to use this.
433  void setPrimitiveClosedFlag(GA_Offset primoff, bool closed);
434 
435 
436  /// Reorder a primitive. The index of the primitive at the given data
437  /// offset will be changed to the new order (provided that the ordered
438  /// position is in a valid range).
439  /// @return The new index of the primitive, or -1 if there was an error
440  GA_Index reorderPrimitive(GA_Offset offset, GA_Index new_order);
441 
442  /// Swap the order of the two specified primitive data offsets.
443  bool swapPrimitiveOrder(GA_Offset offset1,
444  GA_Offset offset2);
445 
446  /// Append a vertex (for the entire detail)
448  GA_Offset appendVertex() { return appendVertexBlock(1); }
449  /// Append new vertices, returning the first offset of the contiguous block
452  { return myVertexMap.addElementBlock(nvertices); }
453  /// Return the number verticies in the entire detail
456  { return myVertexMap.indexSize(); }
457  /// This will be an exclusive, possibly loose, upper bound when iterating
458  /// over vertex offsets.
459  /// Every vertex offset in this detail will be strictly less than this.
460  /// @note (getNumVertices() <= getNumVertexOffsets()) is always true.
463  { return myVertexMap.offsetSize(); }
464  /// Given a vertex's index (in append order), return its data offset
467  { return myVertexMap.offsetFromIndex(index); }
468  /// Given a vertex's data offset, return its index
471  { return myVertexMap.indexFromOffset(offset); }
472 
473  /// @private @see GA_WorkVertexBuffer
474  GA_Offset appendTemporaryPoint();
475  /// @private @see GA_WorkVertexBuffer
476  GA_Offset appendTemporaryVertex();
477 
478  /// Given a vertex, return the point it references
481  {
482  UT_ASSERT_P(!myVertexMap.isOffsetVacant(vertex));
483  return myTopology.getPointRef()->getLink(vertex);
484  }
485  /// Given a vertex, return primitive it references
486  /// Returns -1 if no topology attributes exist.
489  {
490  UT_ASSERT_P(!myVertexMap.isOffsetVacant(vertex));
491  const GA_ATITopology *pref = myTopology.getPrimitiveRef();
492  UT_ASSERT_P(pref);
493  return pref->getLink(vertex);
494  }
495 
496  /// Given a point, returns *a* vertex that it references.
497  /// More than one vertex may refer to a single point, and it is
498  /// quite possible that no vertices refer to the point.
499  /// GA_INVALID_OFFSET is returned if no vertices match.
500  /// See getVerticesReferencingPoint() for methods to get all the points.
503  {
504  UT_ASSERT_P(!myPointMap.isOffsetVacant(point));
505  const GA_ATITopology *ref = myTopology.getVertexRef();
506  UT_ASSERT_P(ref);
507  return ref->getLink(point);
508  }
509 
510  /// Given a vertex, returns the next one that shares the same
511  /// point as this vertex. GA_INVALID_OFFSET if no further
512  /// vertices match
515  {
516  UT_ASSERT_P(!myVertexMap.isOffsetVacant(vtx));
517  const GA_ATITopology *ref = myTopology.getVertexNextRef();
518  UT_ASSERT_P(ref);
519  return ref->getLink(vtx);
520  }
521 
522  /// Given a vertex, returns the previous one that shares the same
523  /// point as this vertex. GA_INVALID_OFFSET if no further
524  /// vertices match
527  {
528  UT_ASSERT_P(!myVertexMap.isOffsetVacant(vtx));
529  const GA_ATITopology *ref = myTopology.getVertexPrevRef();
530  UT_ASSERT_P(ref);
531  return ref->getLink(vtx);
532  }
533 
534  /// Given a point and primitive, find the corresponding vertex. Note that
535  /// this is O(N) on the number of vertices which share the point. If the
536  /// primitive offset is -1, then the "first" vertex which references the
537  /// point will be returned. The order of the "first" vertex is arbitrary,
538  /// though it will likely be the same for each call.
539  ///
540  /// Returns -1 if no topology attributes exist.
541  GA_Offset getVertexReferencingPoint(GA_Offset ptoff,
542  GA_Offset primoff = GA_INVALID_OFFSET) const;
543 
544  /// Given a point offset, return a list of all vertices which reference it.
545  /// NOTE: The vertex offsets might be in ANY order, and may even be
546  /// different from run to run, so DO NOT rely on the order!
547  GA_Size getVerticesReferencingPoint(
548  GA_OffsetArray &vertices,
549  GA_Offset point_offset) const;
550  /// Given a point offset, return a list of all primitives which reference it.
551  /// The primitive offsets will be in ascending order and have no duplicates,
552  /// so you can do:
553  /// detail.getPrimitivesReferencingPoint(prims0, p0off);
554  /// detail.getPrimitivesReferencingPoint(prims1, p1off);
555  /// prims0.sortedIntersection(prims1);
556  /// to quickly get a list of primitives that contain both p0off and p1off,
557  /// (not necessarily as an edge, but this can be used as a first pass check.)
558  GA_Size getPrimitivesReferencingPoint(
559  GA_OffsetArray &primitives,
560  GA_Offset point_offset) const;
561 
562  /// Returns false if any point is shared, ie, more than one vertex
563  /// points to the same point. This being true means each point
564  /// has at most one vertex and belongs to at most one primitive.
565  /// Note that points can belong to zero vertices and zero primitives
566  /// still. Requires topology.
567  bool hasNoSharedPoints() const;
568 
569  /// When destroying points, there are three different modes when dealing
570  /// with primitives that reference the points. These modes cause different
571  /// behaviours when notifying primitives about point deletion. The
572  /// behaviour is determined by the result of @c
573  /// primitive->dereferencePoint() or @c primitive->dereferencePoints().
574  /// - GA_LEAVE_PRIMITIVES @n
575  /// Primitive is destroyed if it returns GA_DEREFERENCE_DESTROY.
576  /// Point will @b not be destroyed if prim returns GA_DEREFERENCE_FAIL.
577  /// - GA_DESTROY_DEGENERATE @n
578  /// Primitive is destroyed if it returns GA_DEREFERENCE_DEGENERATE or
579  /// GA_DEREFERENCE_DESTROY. Point is not destroyed if prim returns
580  /// GA_DEREFERENCE_FAIL.
581  /// - GA_DESTROY_DEGENERATE_INCOMPATIBLE @n
582  /// Primitive is destroyed if it returns GA_DEREFERENCE_DEGENERATE,
583  /// GA_DEREFERENCE_DESTROY, or GA_DEREFERENCE_FAIL. The point will
584  /// always be destroyed.
586  {
590  };
591 
592  /// @{
593  /// Destroy the given point. This may leave dangling vertex references if
594  /// there is no full topology.
595  ///
596  /// If the @c guarantee_no_vertex_references flag is true, the operation
597  /// will be more efficient, but you must truly guarantee that there are no
598  /// vertices referring to the point.
599  bool destroyPointOffset(GA_Offset ptoff,
600  GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES,
601  bool guarantee_no_vertex_references=false);
602  bool destroyPointIndex(GA_Index index,
603  GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES,
604  bool guarantee_no_vertex_references=false);
605  /// @}
606  /// Destroy the given vertex
607  bool destroyVertexOffset(GA_Offset offset);
608  /// Destroy the given primitive. Optionally destroy any referenced points
609  /// that will no longer be in use after this operation. Note that this
610  /// option requires full topology.
611  virtual bool destroyPrimitiveOffset(GA_Offset offset,
612  bool and_points = false);
613  bool destroyPrimitiveIndex(GA_Index index,
614  bool and_points = false);
615  bool destroyPrimitive(GA_Primitive &prim,
616  bool and_points = false);
617 
618  /// Destroy the given primitives. Optionally destroy any referenced points
619  /// that will no longer be in use after this operation. Note that this
620  /// option requires full topology.
621  virtual GA_Size destroyPrimitiveOffsets(const GA_Range &it,
622  bool and_points = false);
624  bool and_points = false)
625  { return destroyPrimitiveOffsets(it, and_points); }
626  GA_Size destroyDegeneratePrimitives(const GA_Range &it,
627  bool and_points = false);
628  GA_Size destroyDegeneratePrimitives(const GA_PrimitiveGroup *prims=0, bool and_points = false);
629 
630 
631  /// Destroy unused points. If ptgrp is given, then only within the group
633  {
634  return destroyUnusedPoints(getPointRange(ptgrp));
635  }
636  /// @{
637  /// Destroy unused points in given point range
638  GA_Size destroyUnusedPoints(const GA_Range &point_range);
640  GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES,
641  bool guarantee_no_vertex_references=false)
642  {
643  return destroyElements(range, mode,
644  guarantee_no_vertex_references);
645  }
647  GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES,
648  bool guarantee_no_vertex_references=false)
649  {
650  return destroyPointOffsets(range, mode,
651  guarantee_no_vertex_references);
652  }
653  /// @}
654 
655 
657  { return destroyElements(range); }
659  { return destroyVertexOffsets(range); }
660 
661  /// Returns whether a point is referenced by any vertices
662  /// This may be a slow operation if there is no topology allocated
663  bool isPointUsed(GA_Offset point) const;
664  /// Returns if a point is referenced. Fails catastrophically
665  /// if you do not have full topology.
666  bool isPointUsedFast(GA_Offset point) const
667  {
668  return GAisValid(pointVertex(point));
669  }
670 
671  /// Returns true if there are any unused points.
672  /// If the offset list is given, it is set to all of the found
673  /// unused points.
674  bool findUnusedPoints(GA_OffsetList *unused=nullptr) const;
675 
676  // -------------- Index Maps -----------------------------
677  const GA_IndexMap &getIndexMap(GA_AttributeOwner owner) const;
679  {
680  return const_cast<GA_IndexMap &>(
681  static_cast<const GA_Detail *>(this)
682  ->getIndexMap(owner));
683  }
684  const GA_IndexMap &getPointMap() const { return myPointMap; }
685  const GA_IndexMap &getVertexMap() const { return myVertexMap; }
686  const GA_IndexMap &getPrimitiveMap() const { return myPrimitiveMap; }
687  const GA_IndexMap &getGlobalMap() const { return myGlobalMap; }
688 
689  /// This is a helpful class for getting the ranges of elements
690  /// created after such an OffsetMarker is declared. For example,
691  ///
692  /// GA_Detail::OffsetMarker marker(*gdp);
693  /// ... // Some code that creates points, vertices, or primitives
694  /// for (GA_Iterator it(marker.pointRange()); !it.atEnd(); ++it)
695  /// ... // Do something to each created point
696  /// for (GA_Iterator it(marker.vertexRange()); !it.atEnd(); ++it)
697  /// ... // Do something to each created vertex
698  /// for (GA_Iterator it(marker.primitiveRange()); !it.atEnd(); ++it)
699  /// ... // Do something to each created primitive
700  ///
701  /// NOTE: The code doing the creating can't delete elements from
702  /// the detail before adding any new elements.
704  {
705  public:
706  OffsetMarker(const GA_Detail &detail)
707  : myPointMarker(detail.getPointMap())
708  , myVertexMarker(detail.getVertexMap())
709  , myPrimitiveMarker(detail.getPrimitiveMap())
710  {}
712  { return myPointMarker.getRange(); }
714  { return myVertexMarker.getRange(); }
716  { return myPrimitiveMarker.getRange(); }
718  { return myPointMarker.getBegin(); }
720  { return myVertexMarker.getBegin(); }
722  { return myPrimitiveMarker.getBegin(); }
724  { return myPointMarker.getEnd(); }
726  { return myVertexMarker.getEnd(); }
728  { return myPrimitiveMarker.getEnd(); }
729  private:
730  const GA_IndexMap::Marker myPointMarker;
731  const GA_IndexMap::Marker myVertexMarker;
732  const GA_IndexMap::Marker myPrimitiveMarker;
733  };
734 
736  { return myPrimitiveList; }
738  { return myPrimitiveList; }
739  GA_AttributeSet &getAttributes() { return myAttributes; }
740  const GA_AttributeSet &getAttributes() const{ return myAttributes; }
741  GA_Topology &getTopology() { return myTopology; }
742  const GA_Topology &getTopology() const { return myTopology; }
743  bool checkValidTopology() const;
744  void createTopologyAttributes();
745  void clearTopologyAttributes();
746 
747  /// This bumps all data IDs in this detail, including
748  /// point, vertex, primitive, and detail attribute data IDs,
749  /// the primitive list data ID, and edge group data IDs.
750  void bumpAllDataIds();
751 
752  /// Call this to bump the appropriate topology data IDs when
753  /// vertices have been rewired to different points.
754  ///
755  /// If vertices have been added or removed, or if they've been
756  /// "stolen" by a different primitive,
757  /// just call bumpDataIdsForAddOrRemove(____,true,____) instead.
758  /// If points have been added or removed, but vertices have
759  /// only been rewired, call bumpDataIdsForAddOrRemove(true,false,false)
760  /// in addition to this.
761  void bumpDataIdsForRewire();
762 
763  /// Call this to bump the appropriate data IDs when points, vertices,
764  /// or primitives have been added or removed. If you're not 100%
765  /// sure whether an element type has been added or removed,
766  /// it's better to err on the side of safety and pass true for it.
767  void bumpDataIdsForAddOrRemove(
768  bool added_or_removed_points,
769  bool added_or_removed_vertices,
770  bool added_or_removed_primitives);
771 
772  /// @{
773  /// Get access to the attributes for one element type
774  GA_AttributeOwner getAttributeOwner(const GA_AttributeDict &dict) const;
776  { return myAttributes.getDict(owner); }
777  /// @}
778 
779  /// Defragment index maps
780  /// NOTE: To make sure that it actually defragments when there is even just
781  /// one hole, you must pass a UT_Options with a "removeholes"
782  /// bool option set to true.
783  /// NOTE: If any defragmenting occurs, this bumps data IDs for everything
784  /// that is modified.
785  bool defragment(GA_AttributeOwner owner,
786  const UT_Options *options = nullptr);
787  /// Defragment everything.
788  /// NOTE: To make sure that it actually defragments when there is even just
789  /// one hole, you must pass a UT_Options with a "removeholes"
790  /// bool option set to true.
791  /// NOTE: If any defragmenting occurs, this bumps data IDs for everything
792  /// that is modified.
793  bool defragment(const UT_Options *options = nullptr);
794 
795  /// Optimized layout of vertex index map. This sorts the vertex index map
796  /// by the primitive order use. The map will be defragmented after this
797  /// function is called.
798  void sortVertexMapByPrimitiveUse();
799 
800  // -------------- Attributes ----------------------------
801 
802  /// @{
803  /// createAttribute is very general purpose method, requiring
804  /// some knowledge about ATIs, etc. Unless you are creating
805  /// your own user-defined attributes, it would likely be better
806  /// to use something at the GEO_Detail level, like addFloatTuple.
808  GA_AttributeScope scope,
809  const UT_StringHolder &name,
810  const UT_Options *create_args,
811  const GA_AttributeOptions *attribute_options,
812  const UT_StringRef &attribtype)
813  {
814  return myAttributes.createAttribute(
815  owner, scope, name, create_args,
816  attribute_options, attribtype);
817  }
819  const UT_StringHolder &name,
820  const UT_Options *create_args,
821  const GA_AttributeOptions *attribute_options,
822  const UT_StringRef &attribtype)
823  {
824  return myAttributes.createAttribute(
825  owner, name, create_args,
826  attribute_options, attribtype);
827  }
828  /// @}
829 
830  /// This will create detached attributes. They will have the right number
831  /// of elements at the moment of creation, but will not update with changes
832  /// to the detail. These attributes will have no name.
833  /// @{
836  GA_AttributeOwner owner,
838  int tuple_size,
839  const GA_Defaults &defaults=GA_Defaults(0.0f),
840  const GA_AttributeOptions *attribute_options = nullptr) const
841  {
842  return myAttributes.createDetachedTupleAttribute(
843  owner, storage, tuple_size,
844  defaults, attribute_options);
845  }
846 
849  GA_AttributeOwner owner,
850  const UT_StringRef &attribtype,
851  const UT_Options *create_args = nullptr,
852  const GA_AttributeOptions *attribute_options = nullptr) const
853  {
854  return myAttributes.createDetachedAttribute(
855  owner, attribtype, create_args,
856  attribute_options);
857  }
858 
861  GA_AttributeOwner owner,
862  const GA_AttributeType &attribtype,
863  const UT_Options *create_args = nullptr,
864  const GA_AttributeOptions *attribute_options = nullptr) const
865  {
866  return myAttributes.createDetachedAttribute(
867  owner, attribtype, create_args,
868  attribute_options);
869  }
870  /// @}
871 
874  GA_AttributeScope scope,
875  const UT_StringRef &name)
876  {
877  return myAttributes.destroyAttribute(owner,
878  scope, name);
879  }
882  const UT_StringRef &name)
883  {
884  return myAttributes.destroyAttribute(owner, name);
885  }
888  GA_AttributeScope scope,
889  const UT_StringRef &fromName,
890  const UT_StringHolder &toName)
891  {
892  return myAttributes.renameAttribute(owner, scope,
893  fromName, toName);
894  }
895 
896  // Convenience attribute methods
898  GA_AttributeScope scope,
899  const UT_StringHolder &name,
900  GA_Storage storage,
901  int tuple_size,
902  const GA_Defaults &defaults = GA_Defaults(0.0f),
903  const UT_Options *create_args = nullptr,
904  const GA_AttributeOptions *attribute_options = nullptr)
905  {
906  return myAttributes.createTupleAttribute(
907  owner, scope, name, storage,
908  tuple_size, defaults,
909  create_args,
910  attribute_options);
911  }
913  const UT_StringHolder &name,
914  GA_Storage storage,
915  int tuple_size,
916  const GA_Defaults &defaults = GA_Defaults(0.0f),
917  const UT_Options *create_args = nullptr,
918  const GA_AttributeOptions *attribute_options = nullptr)
919  {
920  return myAttributes.createTupleAttribute(
921  owner, name, storage,
922  tuple_size, defaults,
923  create_args,
924  attribute_options);
925  }
927  GA_AttributeScope scope,
928  const UT_StringHolder &name,
929  const UT_Options *create_args=nullptr,
930  const GA_AttributeOptions *attribute_options=nullptr)
931  {
932  return myAttributes.createStringAttribute(
933  owner, scope, name, 1,
934  create_args,
935  attribute_options);
936  }
938  const UT_StringHolder &name,
939  const UT_Options *create_args=nullptr,
940  const GA_AttributeOptions *attribute_options=nullptr)
941  {
942  return myAttributes.createStringAttribute(
943  owner, name, 1, create_args,
944  attribute_options);
945  }
946 
947  /// Find an existing attribute, returning a read-only reference.
948  ///
951  const UT_StringRef &name,
952  const GA_AttributeOwner search_order[],
953  int search_size) const
954  {
955  return myAttributes.findAttribute(
956  scope, name, search_order,
957  search_size);
958  }
961  const GA_AttributeOwner search_order[],
962  int search_size) const
963  {
964  return myAttributes.findAttribute(
965  name, search_order, search_size);
966  }
969  GA_AttributeScope scope,
970  const UT_StringRef &name) const
971  { return findAttribute(scope, name, &owner, 1); }
974  const UT_StringRef &name) const
975  { return findAttribute(name, &owner, 1); }
978  const UT_StringRef &name) const
979  { return findAttribute(GA_ATTRIB_POINT, s, name); }
981  const GA_Attribute *findPointAttribute(const UT_StringRef &name) const
982  { return findAttribute(GA_ATTRIB_POINT, name); }
985  const UT_StringRef &name) const
986  { return findAttribute(GA_ATTRIB_VERTEX,s, name); }
989  { return findAttribute(GA_ATTRIB_VERTEX, name); }
992  const UT_StringRef &name) const
993  {return findAttribute(GA_ATTRIB_PRIMITIVE,s,name);}
996  {return findAttribute(GA_ATTRIB_PRIMITIVE, name);}
999  const UT_StringRef &name) const
1000  { return findAttribute(GA_ATTRIB_GLOBAL,s, name); }
1003  { return findAttribute(GA_ATTRIB_GLOBAL, name); }
1004 
1005  /// Find an existing attribute, returning a read-write reference.
1006  ///
1009  const UT_StringRef &name,
1010  const GA_AttributeOwner search_order[],
1011  int search_size)
1012  {
1013  return myAttributes.findAttribute(
1014  scope, name, search_order,
1015  search_size);
1016  }
1019  const GA_AttributeOwner search_order[],
1020  int search_size)
1021  {
1022  return myAttributes.findAttribute(
1023  name, search_order, search_size);
1024  }
1027  GA_AttributeScope scope,
1028  const UT_StringRef &name)
1029  { return findAttribute(scope, name, &owner, 1); }
1032  const UT_StringRef &name)
1033  { return findAttribute(name, &owner, 1); }
1036  const UT_StringRef &name)
1037  { return findAttribute(GA_ATTRIB_POINT, s, name); }
1040  { return findAttribute(GA_ATTRIB_POINT, name); }
1043  const UT_StringRef &name)
1044  { return findAttribute(GA_ATTRIB_VERTEX,s, name); }
1047  { return findAttribute(GA_ATTRIB_VERTEX, name); }
1050  const UT_StringRef &name)
1051  {return findAttribute(GA_ATTRIB_PRIMITIVE,s,name);}
1054  {return findAttribute(GA_ATTRIB_PRIMITIVE, name);}
1057  const UT_StringRef &name)
1058  { return findAttribute(GA_ATTRIB_GLOBAL,s, name); }
1061  { return findAttribute(GA_ATTRIB_GLOBAL, name); }
1062 
1063  /// Get/set all the point attribute data from/to a contiguous array
1064  // @{
1065 
1066  /// Valid types for T are:
1067  /// int32, int64, fpreal32, fpreal64,
1068  /// UT_Vector2T<S>, UT_Vector3T<S>, UT_Vector4T<S>,
1069  /// UT_QuaternionT<S>, UT_Matrix3T<S>, UT_Matrix4T<S>
1070  /// where S is one of: fpreal, fpreal32, fpreal64,
1071  /// For the UT_Vector classes, S can also be one of: int, int32, int64
1072  template <typename T>
1073  bool getAttributeAsArray(
1074  const GA_Attribute *atr,
1075  const GA_Range &range,
1076  UT_Array<T> &result) const;
1077 
1078  /// Valid types for T are:
1079  /// int32, int64, fpreal32, fpreal64,
1080  /// UT_Vector2T<S>, UT_Vector3T<S>, UT_Vector4T<S>,
1081  /// UT_QuaternionT<S>, UT_Matrix3T<S>, UT_Matrix4T<S>
1082  /// where S is one of: fpreal, fpreal32, fpreal64,
1083  /// For the UT_Vector classes, S can also be one of: int, int32, int64
1084  template <typename T>
1085  bool setAttributeFromArray(
1086  GA_Attribute *atr,
1087  const GA_Range &range,
1088  const UT_Array<T> &src);
1089  // @}
1090 
1091  // -------------- Groups ---------------------------------
1092  GA_ElementGroup *createElementGroup(GA_AttributeOwner owner,
1093  const UT_StringHolder &name,
1094  bool ordered=false);
1095  GA_ElementGroup *createInternalElementGroup(GA_AttributeOwner owner,
1096  bool ordered=false);
1097  GA_ElementGroup *findElementGroup(GA_AttributeOwner owner,
1098  const UT_StringRef &name);
1099  const GA_ElementGroup *findElementGroup(GA_AttributeOwner owner,
1100  const UT_StringRef &name) const;
1101 
1102  // Only accepts GA_ATTRIB_POINT,GA_ATTRIB_VERTEX,GA_ATTRIB_PRIMITIVE
1103  const GA_ElementGroupTable &
1104  getElementGroupTable(GA_AttributeOwner owner) const;
1107  {
1108  return const_cast<GA_ElementGroupTable &>(
1109  static_cast<const GA_Detail *>(this)
1110  ->getElementGroupTable(owner));
1111  }
1112 
1113  // Gets any group table.
1114  GA_GroupTable *getGroupTable(GA_GroupType group_type);
1115  const GA_GroupTable *getGroupTable(GA_GroupType group_type) const;
1116 
1117  /// @{
1118  /// Access point, primitive, vertex, or edge group tables
1120  { return myPointGroups; }
1122  { return myPointGroups; }
1124  { return myPrimitiveGroups; }
1126  { return myPrimitiveGroups; }
1128  { return myVertexGroups; }
1130  { return myVertexGroups; }
1132  { return myEdgeGroups; }
1134  { return myEdgeGroups; }
1135  /// @}
1136 
1137  template <GA_AttributeOwner OWNER>
1141  bool ordered=false)
1142  {
1144  createElementGroup(OWNER, name, ordered));
1145  }
1146 
1147  template <GA_AttributeOwner OWNER>
1150  createInternalElementGroup(bool ordered=false)
1151  {
1153  createInternalElementGroup(OWNER,ordered));
1154  }
1155 
1156  template <GA_AttributeOwner OWNER>
1160  {
1162  findElementGroup(OWNER, name));
1163  }
1164  template <GA_AttributeOwner OWNER>
1167  findElementGroup(const UT_StringRef &name) const
1168  {
1170  findElementGroup(OWNER, name));
1171  }
1172 
1173  void getElementGroupList(GA_AttributeOwner owner,
1174  UT_Array<const GA_ElementGroup *> &list) const;
1175  void getElementGroupList(GA_AttributeOwner owner,
1179  const UT_StringRef &name)
1180  { return getElementGroupTable(owner).destroy(name); }
1183  const char *name)
1184  { return getElementGroupTable(owner).destroy(name); }
1185  bool destroyElementGroup(GA_ElementGroup *group);
1186  bool destroyGroup(GA_Group *group);
1187 
1188  // Convenience group methods
1190  const GA_PointGroup *findPointGroup(const UT_StringRef &name) const
1191  { return findElementGroup<GA_ATTRIB_POINT>(name); }
1193  const GA_VertexGroup *findVertexGroup(const UT_StringRef &name) const
1194  { return findElementGroup<GA_ATTRIB_VERTEX>(name); }
1197  { return findElementGroup<GA_ATTRIB_PRIMITIVE>(name); }
1198 
1201  { return findElementGroup<GA_ATTRIB_POINT>(name); }
1204  { return findElementGroup<GA_ATTRIB_VERTEX>(name); }
1207  { return findElementGroup<GA_ATTRIB_PRIMITIVE>(name); }
1208 
1209  GA_EdgeGroup *createEdgeGroup(const UT_StringHolder &name);
1210  GA_EdgeGroup *createInternalEdgeGroup();
1211  const GA_EdgeGroup *findEdgeGroup(const UT_StringRef &name) const;
1212  GA_EdgeGroup *findEdgeGroup(const UT_StringRef &name);
1213  void getEdgeGroupList(
1214  UT_Array<const GA_EdgeGroup *> &list) const;
1215  void getEdgeGroupList(
1216  UT_Array<GA_EdgeGroup *> &list);
1218  bool destroyEdgeGroup(const UT_StringRef &name)
1219  { return myEdgeGroups.destroy(name); }
1222  { return g ? myEdgeGroups.destroy(g) : false; }
1223 
1224  // Utility group functions
1225  GA_Size destroyEmptyGroups(GA_AttributeOwner owner);
1226  GA_Size destroyAllEmptyGroups();
1227 
1228  /// Creates a non-internal group with the specified name,
1229  /// owned by this detail.
1230  /// @{
1232  {
1233  return static_cast<GA_PointGroup *>(pointGroups().newGroup(name));
1234  }
1236  {
1237  return static_cast<GA_VertexGroup *>(vertexGroups().newGroup(name));
1238  }
1240  {
1241  return static_cast<GA_PrimitiveGroup *>(primitiveGroups().newGroup(name));
1242  }
1244  {
1245  return static_cast<GA_EdgeGroup *>(edgeGroups().newGroup(name));
1246  }
1247  /// @}
1248 
1249  /// Creates an internal group with a unique name,
1250  /// owned by this detail.
1251  /// Be sure to call GA_Detail::destroyGroup (or destroyElementGroup)
1252  /// with this group to clean it up.
1253  /// @{
1255  {
1256  return static_cast<GA_PointGroup *>(pointGroups().newInternalGroup());
1257  }
1259  {
1260  return static_cast<GA_VertexGroup *>(vertexGroups().newInternalGroup());
1261  }
1263  {
1264  return static_cast<GA_PrimitiveGroup *>(primitiveGroups().newInternalGroup());
1265  }
1267  {
1268  return static_cast<GA_EdgeGroup *>(edgeGroups().newInternalGroup());
1269  }
1270  /// @}
1271 
1272  /// Creates a detached group with no name, owned by the caller.
1273  /// Be sure to do "delete group;" to clean it up.
1274  /// NOTE: The detail knows nothing about any detached groups that
1275  /// are created.
1276  /// @{
1278  {
1279  return new GA_PointGroup(*this);
1280  }
1282  {
1283  return new GA_PrimitiveGroup(*this);
1284  }
1286  {
1287  return new GA_VertexGroup(*this);
1288  }
1290  {
1291  return new GA_EdgeGroup(*this);
1292  }
1293 
1295  {
1296  return UTmakeUnique<GA_PointGroup>(*this);
1297  }
1299  {
1300  return UTmakeUnique<GA_PrimitiveGroup>(*this);
1301  }
1303  {
1304  return UTmakeUnique<GA_VertexGroup>(*this);
1305  }
1307  {
1308  return UTmakeUnique<GA_EdgeGroup>(*this);
1309  }
1310  /// @}
1311 
1312  /// TODO: Deprecate internal groups with user-specified names.
1313  /// @{
1314  GA_PointGroup *newPointGroup(const UT_StringHolder &name, bool internal)
1315  {
1316  return static_cast<GA_PointGroup *>(pointGroups().newGroup(name, internal));
1317  }
1319  {
1320  return static_cast<GA_PrimitiveGroup *>(primitiveGroups().newGroup(name, internal));
1321  }
1322  GA_VertexGroup *newVertexGroup(const UT_StringHolder &name, bool internal)
1323  {
1324  return static_cast<GA_VertexGroup *>(vertexGroups().newGroup(name, internal));
1325  }
1326  GA_EdgeGroup *newEdgeGroup(const UT_StringHolder &name, bool internal)
1327  {
1328  return static_cast<GA_EdgeGroup *>(edgeGroups().newGroup(name, internal));
1329  }
1330  /// @}
1331 
1332  // -------------- Intrinsics ------------------------
1333  /// Register global intrinsics.
1334  /// Each subclass should have registration which looks like: @code
1335  /// SubClass::registerIntrinsics(GA_PrimitiveFactory &factory)
1336  /// {
1337  /// GA_LocalIntrinsicMap map(factory.getDetailIntrinsics());
1338  /// BaseClass::registerIntrinsics(factory);
1339  /// map.addAttribute(...);
1340  /// map.addAttribute(...);
1341  /// }
1342  /// @endcode
1344  registerIntrinsics(GA_PrimitiveFactory &factory);
1345 
1346  /// Get the intrinsic manager for global/detail intrinsics.
1347  ///
1348  /// At the current time, these include:
1349  /// - "string globaltokens[]" @n List of all global/detail intrinsics
1350  /// - "string primitivetokens[]" @n List of all primitive intrinsics
1351  /// - "int vertexcount" @n Number of vertices in the detail
1352  /// - "int pointcount" @n Number of points in the detail
1353  /// - "int primitivecount" @n Number of primitives in the detail
1355  { return myPrimitiveFactory.getDetailIntrinsics(); }
1356 
1357  /// @{
1358  /// Query properties of the @b global/detail intrinsic
1359  /// Note that the tuple size calls the virtual method since the tuple size
1360  /// may be dynamic (i.e. basis knot vector)
1361  GA_LocalIntrinsic findIntrinsic(const char *nm) const
1362  { return getIntrinsicManager().getLocalHandle(nm); }
1364  { return getIntrinsicManager().getLocalHandle(h); }
1366  { return getIntrinsicManager().getGlobalHandle(h); }
1367 
1369  { return getIntrinsicManager().getName(h); }
1370  GA_Size getIntrinsicTupleSize(GA_LocalIntrinsic h) const;
1372  { return getIntrinsicManager().getStorage(h); }
1374  { return getIntrinsicManager().getReadOnly(h); }
1376  { return getIntrinsicManager().getOptions(h); }
1377  /// @}
1378 
1379  /// @{
1380  /// Get the value of a global/detail intrinsic.
1381  /// These methods return the number of items retrieved.
1382  GA_Size getIntrinsic(GA_LocalIntrinsic h, UT_String &val) const;
1383  GA_Size getIntrinsic(GA_LocalIntrinsic h, UT_StringArray &val) const;
1384  GA_Size getIntrinsic(GA_LocalIntrinsic h, UT_OptionsHolder &val) const;
1386  GA_Size getIntrinsic(GA_LocalIntrinsic h, int64 *v, GA_Size size) const;
1387  GA_Size getIntrinsic(GA_LocalIntrinsic h, fpreal64 *v, GA_Size sz) const;
1388  /// @}
1389 
1390  /// @{
1391  /// Get the value of a global/detail intrinsic.
1392  /// Returns false if not the right type or not found.
1393  /// Always will clear out the provided value.
1394  bool getIntrinsic(GA_LocalIntrinsic h, float &v) const;
1395  bool getIntrinsic(GA_LocalIntrinsic h, int &v) const;
1396  bool getIntrinsic(GA_LocalIntrinsic h, UT_Vector2 &v) const;
1397  bool getIntrinsic(GA_LocalIntrinsic h, UT_Vector3 &v) const;
1398  bool getIntrinsic(GA_LocalIntrinsic h, UT_Vector4 &v) const;
1399  bool getIntrinsic(GA_LocalIntrinsic h, UT_Matrix2 &v) const;
1400  bool getIntrinsic(GA_LocalIntrinsic h, UT_Matrix3 &v) const;
1401  bool getIntrinsic(GA_LocalIntrinsic h, UT_Matrix4 &v) const;
1402  bool getIntrinsic(GA_LocalIntrinsic h, double &v) const;
1403  bool getIntrinsic(GA_LocalIntrinsic h, int64 &v) const;
1404  bool getIntrinsic(GA_LocalIntrinsic h, UT_Vector2D &v) const;
1405  bool getIntrinsic(GA_LocalIntrinsic h, UT_Vector3D &v) const;
1406  bool getIntrinsic(GA_LocalIntrinsic h, UT_Vector4D &v) const;
1407  bool getIntrinsic(GA_LocalIntrinsic h, UT_Matrix2D &v) const;
1408  bool getIntrinsic(GA_LocalIntrinsic h, UT_Matrix3D &v) const;
1409  bool getIntrinsic(GA_LocalIntrinsic h, UT_Matrix4D &v) const;
1410 
1411  /// @}
1412 
1413  /// @{
1414  /// Set intrinsic. This will fail if the intrinsic is read-only.
1415  /// These methods return the number of items set.
1416  GA_Size setIntrinsic(GA_LocalIntrinsic h, const char *value);
1417  GA_Size setIntrinsic(GA_LocalIntrinsic h, const UT_StringArray &value);
1418  GA_Size setIntrinsic(GA_LocalIntrinsic h, const char **val, GA_Size s);
1419  GA_Size setIntrinsic(GA_LocalIntrinsic h, const UT_OptionsHolder &val);
1421  GA_Size setIntrinsic(GA_LocalIntrinsic h, const UT_OptionsHolder *val, GA_Size s);
1422  GA_Size setIntrinsic(GA_LocalIntrinsic h, const int64 val);
1423  GA_Size setIntrinsic(GA_LocalIntrinsic h, const fpreal64 val);
1424  GA_Size setIntrinsic(GA_LocalIntrinsic h, const int64 *val, GA_Size sz);
1425  GA_Size setIntrinsic(GA_LocalIntrinsic h, const fpreal64 *v, GA_Size sz);
1426  /// @}
1427 
1428  /// Calls functor on every active point offset.
1429  /// This is easiest to use with C++ lambdas, e.g.:
1430  /// detail.forEachPoint([&vec,&detail](GA_Offset ptoff) {
1431  /// vec += detail.getPos3(ptoff);
1432  /// });
1433  template<typename FUNCTOR>
1435  void forEachPoint(FUNCTOR &&functor) const
1436  {
1437  myPointMap.forEachOffset(functor);
1438  }
1439 
1440  /// Calls functor on every point offset in a group.
1441  /// This is easiest to use with C++ lambdas, e.g.:
1442  /// detail.forEachPoint(group, [&vec,&detail](GA_Offset ptoff) {
1443  /// vec += detail.getPos3(ptoff);
1444  /// });
1445  template<typename FUNCTOR>
1447  void forEachPoint(const GA_PointGroup *group, FUNCTOR &&functor) const
1448  {
1449  forEachOffset(functor, myPointMap, group);
1450  }
1451 
1452  /// Calls functor on every point offset in a group, (or not in a group
1453  /// if complement is true).
1454  template<typename FUNCTOR>
1456  void forEachPoint(const GA_PointGroup *group, bool complement, FUNCTOR &&functor) const
1457  {
1458  forEachOffset(functor, myPointMap, group, complement);
1459  }
1460 
1461  /// Like forEachPoint, except taking a functor that
1462  /// returns true to continue, and false to break.
1463  /// @{
1464  template<typename FUNCTOR>
1466  void forEachPointBreak(FUNCTOR &&functor) const
1467  {
1468  myPointMap.forEachOffsetBreak(functor);
1469  }
1470  template<typename FUNCTOR>
1472  void forEachPointBreak(const GA_PointGroup *group, FUNCTOR &&functor) const
1473  {
1474  forEachOffset(functor, myPointMap, group);
1475  }
1476  template<typename FUNCTOR>
1478  void forEachPointBreak(const GA_PointGroup *group, bool complement, FUNCTOR &&functor) const
1479  {
1480  forEachOffset(functor, myPointMap, group, complement);
1481  }
1482  /// @}
1483 
1484  /// Calls functor on every active primitive offset.
1485  /// This is easiest to use with C++ lambdas, e.g.:
1486  /// detail.forEachPrimitive([&tris,&detail](GA_Offset primoff) {
1487  /// if (detail.getPrimitiveMap().getTypeId(primoff) != GA_PRIMPOLY)
1488  /// return;
1489  /// GA_OffsetListRef vertices = detail.getPrimitiveMap().getVertexList(primoff);
1490  /// if (vertices.size() == 3 && vertices.getExtraFlag())
1491  /// tris.addOffset(primoff);
1492  /// });
1493  template<typename FUNCTOR>
1495  void forEachPrimitive(FUNCTOR &&functor) const
1496  {
1497  myPrimitiveMap.forEachOffset(functor);
1498  }
1499 
1500  /// Calls functor on every primitive offset in a group.
1501  /// This is easiest to use with C++ lambdas, e.g.:
1502  /// detail.forEachPrimitive(group, [&tris,&detail](GA_Offset primoff) {
1503  /// if (detail.getPrimitiveMap().getTypeId(primoff) != GA_PRIMPOLY)
1504  /// return;
1505  /// GA_OffsetListRef vertices = detail.getPrimitiveMap().getVertexList(primoff);
1506  /// if (vertices.size() == 3 && vertices.getExtraFlag())
1507  /// tris.addOffset(primoff);
1508  /// });
1509  template<typename FUNCTOR>
1511  void forEachPrimitive(const GA_PrimitiveGroup *group, FUNCTOR &&functor) const
1512  {
1513  forEachOffset(functor, myPrimitiveMap, group);
1514  }
1515 
1516  /// Calls functor on every primitive offset in a group, (or not in a group
1517  /// if complement is true).
1518  template<typename FUNCTOR>
1520  void forEachPrimitive(const GA_PrimitiveGroup *group, bool complement, FUNCTOR &&functor) const
1521  {
1522  forEachOffset(functor, myPrimitiveMap, group, complement);
1523  }
1524 
1525  /// Like forEachPrimitive, except taking a functor that
1526  /// returns true to continue, and false to break.
1527  /// @{
1528  template<typename FUNCTOR>
1530  void forEachPrimitiveBreak(FUNCTOR &&functor) const
1531  {
1532  myPrimitiveMap.forEachOffsetBreak(functor);
1533  }
1534  template<typename FUNCTOR>
1536  void forEachPrimitiveBreak(const GA_PrimitiveGroup *group, FUNCTOR &&functor) const
1537  {
1538  forEachOffsetBreak(functor, myPrimitiveMap, group);
1539  }
1540  template<typename FUNCTOR>
1542  void forEachPrimitiveBreak(const GA_PrimitiveGroup *group, bool complement, FUNCTOR &&functor) const
1543  {
1544  forEachOffsetBreak(functor, myPrimitiveMap, group, complement);
1545  }
1546  /// @}
1547 
1548  template<typename FUNCTOR>
1549  static void forEachOffset(FUNCTOR &&functor, const GA_IndexMap &index_map, const GA_ElementGroup *group = nullptr, bool complement = false)
1550  {
1551  // Fall back to regular case if no group.
1552  if (!group)
1553  {
1554  if (!complement)
1555  index_map.forEachOffset(functor);
1556  return;
1557  }
1558 
1559  // Group order is only relevant if not complemented.
1560  if (!complement)
1561  {
1562  const GA_ElementGroupOrder *order = group->getOrdered();
1563  if (order)
1564  {
1565  for (GA_ElementGroupOrderIndex i(0), n(order->entries()); i != n; ++i)
1566  {
1567  GA_Offset off = order->getElement(i);
1568  functor(off);
1569  }
1570  return;
1571  }
1572  }
1573 
1574  // We have a group, treated as unordered.
1575  const GA_Offset veryend = index_map.offsetSize();
1576  GA_Offset off(0);
1577  while (true)
1578  {
1579  bool value;
1580  GA_Size span_size;
1581  group->getConstantSpan(off, veryend, span_size, value);
1582  if (span_size == 0)
1583  break;
1584  if (value == complement)
1585  {
1586  off += span_size;
1587  continue;
1588  }
1589  const GA_Offset span_end = off+span_size;
1590  while (true)
1591  {
1592  off = index_map.findActiveOffset(off, span_end);
1593  GA_Offset end = index_map.findInactiveOffset(off, span_end);
1594  if (off == end)
1595  break;
1596  do
1597  {
1598  functor(off);
1599  ++off;
1600  } while (off != end);
1601  }
1602  }
1603  }
1604 
1605  template<typename FUNCTOR>
1606  static void forEachOffsetBreak(FUNCTOR &&functor, const GA_IndexMap &index_map, const GA_ElementGroup *group = nullptr, bool complement = false)
1607  {
1608  // Fall back to regular case if no group.
1609  if (!group)
1610  {
1611  if (!complement)
1612  index_map.forEachOffsetBreak(functor);
1613  return;
1614  }
1615 
1616  // Group order is only relevant if not complemented.
1617  if (!complement)
1618  {
1619  const GA_ElementGroupOrder *order = group->getOrdered();
1620  if (order)
1621  {
1622  for (GA_ElementGroupOrderIndex i(0), n(order->entries()); i != n; ++i)
1623  {
1624  GA_Offset off = order->getElement(i);
1625  if (!functor(off))
1626  return;
1627  }
1628  return;
1629  }
1630  }
1631 
1632  // We have a group, treated as unordered.
1633  const GA_Offset veryend = index_map.offsetSize();
1634  GA_Offset off(0);
1635  while (true)
1636  {
1637  bool value;
1638  GA_Size span_size;
1639  group->getConstantSpan(off, veryend, span_size, value);
1640  if (span_size == 0)
1641  break;
1642  if (value == complement)
1643  {
1644  off += span_size;
1645  continue;
1646  }
1647  const GA_Offset span_end = off+span_size;
1648  while (true)
1649  {
1650  off = index_map.findActiveOffset(off, span_end);
1651  GA_Offset end = index_map.findInactiveOffset(off, span_end);
1652  if (off == end)
1653  break;
1654  do
1655  {
1656  if (!functor(off))
1657  return;
1658  ++off;
1659  } while (off != end);
1660  }
1661  }
1662  }
1663 
1664  // -------------- Range Accessors --------------------------
1665  /// Get a range of all points in the detail
1667  { return GA_Range(getPointMap(), group); }
1668  /// Get a range of all primitives in the detail
1670  { return GA_Range(getPrimitiveMap(), group); }
1671 
1672  /// Get ordered point range from base_ptnum to end_ptnum, or the end
1674  GA_Index begin_ptnum,
1675  GA_Index end_ptnum = GA_INVALID_INDEX) const
1676  {
1677  GA_Range::ordered ordered;
1678  if (!GAisValid(end_ptnum))
1679  end_ptnum = GA_Index(getNumPoints());
1680  return GA_Range(getPointMap(), begin_ptnum, end_ptnum,
1681  ordered);
1682  }
1683  /// Get ordered primitive range from base_prim to end_prim, or the end
1685  GA_Index begin_prim,
1686  GA_Index end_prim = GA_INVALID_INDEX) const
1687  {
1688  GA_Range::ordered ordered;
1689  if (!GAisValid(end_prim))
1690  end_prim = GA_Index(getNumPrimitives());
1691  return GA_Range(getPrimitiveMap(),
1692  begin_prim, end_prim, ordered);
1693  }
1694 
1695  /// Get a range of all vertices in the detail
1697  { return GA_Range(getVertexMap(), group); }
1698  /// Get a range representing the global (detail) data
1700  { return GA_Range(getGlobalMap()); }
1701 
1702  // -------------- Common Operations ------------------------
1703  /// Compute memory usage (includes all shared memory)
1704  virtual int64 getMemoryUsage(bool inclusive) const;
1705 
1706  /// Count memory usage using a UT_MemoryCounter in order to count
1707  /// shared memory correctly.
1708  /// If inclusive is true, the size of this object is counted,
1709  /// else only memory owned by this object is counted.
1710  /// If this is pointed to by the calling object, inclusive should be true.
1711  /// If this is contained in the calling object, inclusive should be false.
1712  /// (Its memory was already counted in the size of the calling object.)
1713  virtual void countMemory(UT_MemoryCounter &counter, bool inclusive) const;
1714 
1715  // Computing the bounding box. Depending on the element being iterated,
1716  // either the point or primitive bounding box will be computed. When a
1717  // P attribute argument is not present, the detail's position attribute
1718  // is used.
1719  bool enlargeBoundingBox(UT_BoundingRect &box,
1720  const GA_Range &range) const;
1721  bool enlargeBoundingBox(UT_BoundingRect &box,
1722  const GA_Range &range,
1723  const GA_Attribute *P) const;
1724  bool enlargeBoundingBox(UT_BoundingBox &box,
1725  const GA_Range &range) const;
1726  bool enlargeBoundingBox(UT_BoundingBox &box,
1727  const GA_Range &range,
1728  const GA_Attribute *P) const;
1729 
1730  /// Compute the bounding box quickly by:
1731  /// - Computing the point bounding box of "P"
1732  /// - Computing the maximum extents of all primitives
1733  /// This requires a single pass through the P attribute along with a single
1734  /// pass through primitives.
1735  void computeQuickBounds(UT_BoundingBox &box) const;
1736 
1737  /// Compute the bounding box quickly by:
1738  /// - Computing the point bounding box of "P"
1739  /// - Computing the maximum extents of all primitives
1740  /// - Count the number of each type of primitive in the detail
1741  /// This requires a single pass through the P attribute along with a single
1742  /// pass through primitives.
1743  /// The @c counts buffer will be filled with the count of each primitive
1744  /// type in the detail. The count_buf_size should be set to
1745  /// @c getPrimitiveFactory().getPrimTypeCount();
1746  void computeQuickBounds(UT_BoundingBox &box,
1747  GA_Size counts[], GA_Size count_buf_size) const;
1748 
1749  /// Create a new detail that has all the same attributes, groups, etc. but
1750  /// has no elements.
1751  /// Subclasses should look at: cloneCopyGroupsAndAttributes()
1752  virtual GA_Detail *cloneEmptyDetail(bool clone_attributes) const = 0;
1753 
1754  /// Copy groups and attribute definitions from the source detail.
1755  ///
1756  /// The caller should ensure that all attributes are cleared before calling
1757  /// this method (i.e. call clear())
1758  void cloneCopyGroupsAndAttributes(const GA_Detail &src,
1759  bool copydetailattribs = false);
1760 
1761  /// Copy all attribute values from srcoff to destoff for
1762  /// attributes accepted by filter. If no filter is specified,
1763  /// all public attributes and non-internal groups are copied.
1764  ///
1765  /// NOTE: If you're copying multiple offsets, it's *much* faster to do:
1766  /// For each attribute, copy data for all offsets;
1767  /// rather than:
1768  /// For each offset, copy data in all attributes.
1769  /// These functions are only for if the former is too awkward
1770  /// to do in some case.
1771  /// @{
1772  void copyAttributes(
1773  GA_AttributeOwner owner,
1774  GA_Offset destoff,
1775  GA_Offset srcoff,
1776  const GA_AttributeFilter *filter = nullptr);
1777  void copyAttributes(
1778  GA_AttributeOwner owner,
1779  GA_Offset destoff,
1780  const GA_Detail &srcdetail,
1781  GA_Offset srcoff,
1782  const GA_AttributeFilter *filter = nullptr);
1783  /// @}
1784 
1785  /// Copy all attribute values from srcptoff to destptoff for point
1786  /// attributes accepted by filter. If no filter is specified,
1787  /// all public attributes and non-internal groups are copied.
1790  GA_Offset destptoff,
1791  GA_Offset srcptoff,
1792  const GA_AttributeFilter *filter = nullptr)
1793  {
1794  copyAttributes(GA_ATTRIB_POINT, destptoff, srcptoff, filter);
1795  }
1796 
1797  /// Copy all attribute values from srcvtxoff to destvtxoff for vertex
1798  /// attributes accepted by filter. If no filter is specified,
1799  /// all public attributes and non-internal groups are copied.
1800  /// If ref_point_dont_copy is true, the point of srcvtxoff is
1801  /// referenced by destvtxoff, otherwise point attributes are also
1802  /// copied.
1803  /// NOTE: If you only want to copy vertex attributes, and not the
1804  /// point, call copyAttributes(GA_ATTRIB_VERTEX, ...)
1806  GA_Offset destvtxoff,
1807  GA_Offset srcvtxoff,
1808  bool ref_point_dont_copy,
1809  const GA_AttributeFilter *filter = nullptr)
1810  {
1811  GA_Offset srcptoff = vertexPoint(srcvtxoff);
1812  if (ref_point_dont_copy)
1813  myTopology.wireVertexPoint(destvtxoff, srcptoff);
1814  else
1815  copyPoint(vertexPoint(destvtxoff), srcptoff, filter);
1816  copyAttributes(GA_ATTRIB_VERTEX, destvtxoff, srcvtxoff, filter);
1817  }
1818 
1819  /// Merge the source detail into this detail (using default options)
1820  void baseMerge(const GA_Detail &src);
1821  /// Merge the source detail into this detail with options
1822  void baseMerge(const GA_Detail &src,
1823  GA_MergeOptions &options);
1824 
1825  /// Fast version of merge for the common case of completely replacing
1826  /// all of this detail with the source detail, using data IDs to avoid
1827  /// copying things that are the same. This does not copy private
1828  /// scope attributes (except topology) or internal groups.
1829  /// When skip is given, all processing of attributes matching the filter
1830  /// will be skipped. The result is that skipped attributes may or may not
1831  /// exist afterwards, and they also won't be initialized in any expected
1832  /// way. The assumption is that the caller will fully handle creation,
1833  /// initialization, or deletion of skipped attributes.
1834  void replaceWith(const GA_Detail &src,
1835  const GA_AttributeFilter *skip = nullptr);
1836 
1837  /// Fast version of merge for the case of completely replacing all of this
1838  /// detail with the points from the source detail, using data IDs to avoid
1839  /// copying things that are the same. This does not copy private
1840  /// scope attributes (except topology) or internal groups.
1841  /// It will act as if replaceWith was called and then all primitives
1842  /// were deleted, so vertex/primitive attributes will be transferred,
1843  /// but there will be no vertices or primitives.
1844  /// When skip is given, all processing of attributes matching the filter
1845  /// will be skipped. The result is that skipped attributes may or may not
1846  /// exist afterwards, and they also won't be initialized in any expected
1847  /// way. The assumption is that the caller will fully handle creation,
1848  /// initialization, or deletion of skipped attributes.
1849  void replaceWithPoints(const GA_Detail &src,
1850  const GA_AttributeFilter *skip = nullptr);
1851 
1852  /// This clears any caches that subclasses of GA_Detail may have, so that
1853  /// replacing the content of the detail doesn't cause crashes.
1854  /// NOTE: You may or may not also have to call refreshCachedHandles later
1855  /// if P or Pw might be replaced or change storage.
1856  virtual void clearCaches()
1857  {
1858  clearInstanceMatrix();
1859  getPrimitiveList().destroyStashed();
1860  }
1861 
1862  /// Merge global attributes (using default options)
1863  void mergeGlobalAttributes(const GA_Detail &src);
1864  /// Merge source global attributes using options
1865  void mergeGlobalAttributes(const GA_Detail &src,
1866  GA_MergeOptions &options);
1867 
1868  /// Clone any missing attributes from the source detail, skipping P, any
1869  /// topology, and any group attributes.
1870  void cloneMissingAttributes(const GA_Detail &src,
1871  GA_AttributeOwner owner,
1872  const GA_AttributeFilter &filter);
1873  /// Clone any missing groups from the source detail.
1874  void cloneMissingGroups(const GA_Detail &src,
1875  GA_AttributeOwner owner,
1876  const GA_AttributeFilter &filter);
1877 
1878  // -------------- Stream I/O METHODS ------------------------
1879  /// Register an IO file format
1880  bool registerIO(GA_IO *io) const
1881  { return myPrimitiveFactory.registerIO(io); }
1882 
1883  /// Find an IO class. If no name is specified, the "default" IO class will
1884  /// be returned (the one specified by HOUDINI_GEOMETRY_FORMAT).
1885  const GA_IO *findIO(const char *name = nullptr) const
1886  { return myPrimitiveFactory.findIO(name); }
1887 
1888  /// Get a list of all the IO names registered. Returns the number of names
1889  /// in the array.
1891  { return myPrimitiveFactory.getIONames(names); }
1892 
1893  /// This class is used to return the status from I/O operations on a
1894  /// GA_Detail.
1895  class IOStatus
1896  {
1897  public:
1898  IOStatus(bool success=false)
1899  : mySuccess(success)
1900  {}
1902  : mySuccess(src.mySuccess)
1903  {}
1905 
1907  {
1908  if (this != &src)
1909  mySuccess = src.mySuccess;
1910  return *this;
1911  }
1912 
1913  /// Return a boolean for success or failure.
1914  /// true means success
1915  bool success() const { return mySuccess; }
1916 
1917  /// bool operator
1918  SYS_SAFE_BOOL operator bool() const { return mySuccess; }
1919 
1920  /// For backward compatibility in older code, you can query the status
1921  /// as an integer, 0 for success, less than zero for failure.
1922  int gbstatus() const { return mySuccess ? 0 : -1; }
1923 
1924  private:
1925  bool mySuccess;
1926  };
1927 
1928  /// Save to a given filename. An extension of .gz will enable zlib
1929  /// compression (for JSON format only)
1930  /// Options include:
1931  /// - string geo:format @n Use the IO format specified by the string
1932  /// See also the options for the stream save
1933  IOStatus save(const char *filename,
1934  const GA_SaveOptions *options,
1935  UT_StringArray *errors = 0) const;
1936 
1937  /// Save to an existing ostream. JSON format will check the options for:
1938  /// - bool geo:gzip @n Enable gzip compression for JSON (false)
1939  /// - bool geo:saveinfo @n Output optional "info" section [true]
1940  /// - string info:software - Software
1941  /// - string info:artist - Artist
1942  /// - string info:hostname - Hostname comment
1943  /// - string info:comment - Arbitrary Comment
1944  /// - any info:token - Saved in the "info" section
1945  /// - bool group:saveinternal @n Save "internal" groups (debugging)
1946  IOStatus save(std::ostream &os, bool binary,
1947  const GA_SaveOptions *options,
1948  UT_StringArray *errors = 0) const;
1949  /// @{
1950  /// Save in "hclassic" format.
1951  IOStatus saveClassic(const char *, const GA_SaveOptions *) const;
1952  IOStatus saveClassic(std::ostream &os, bool, const GA_SaveOptions *) const;
1953  /// @}
1954 
1955  /// @section JSON-GA_Detail JSON Schema: GA_Detail
1956  ///
1957  /// The JSON schema for a detail can be broken down into 5 major sections
1958  /// - Header: The global information about the detail
1959  /// - References: Topological references
1960  /// - Attributes: Attribute data for elements
1961  /// - Primitives: List of primitives in the detail
1962  /// - Groups: Groups
1963  ///
1964  /// @code
1965  /// {
1966  /// "name" : "GA_Detail-Header",
1967  /// "description" : "Storage for an entire geometry object",
1968  /// "type" : "orderedmap",
1969  /// "properties": {
1970  /// // Header section
1971  /// "file_version": {
1972  /// "type" : "string",
1973  /// "description" : "File Version",
1974  /// "optional" : true,
1975  /// },
1976  /// "info": {
1977  /// "type" : "object",
1978  /// "description" :
1979  /// "Optional tags including:
1980  /// 'software' : Software used to create geometry,
1981  /// 'artist' : Artist name,
1982  /// 'hostname' : Computer name,
1983  /// 'comment' : Arbitrary comment
1984  /// etc.",
1985  /// "optional" : true,
1986  /// }
1987  /// "pointcount": {
1988  /// "type" : "integer",
1989  /// "description" : "The number of points in the geometry",
1990  /// },
1991  /// "vertexcount": {
1992  /// "type" : "integer",
1993  /// "description" : "The number of vertices in the geometry",
1994  /// },
1995  /// "primitivecount": {
1996  /// "type" : "integer",
1997  /// "description" : "The number of primitives in the geometry",
1998  /// },
1999  ///
2000  /// // Topology section
2001  /// "topology" : {
2002  /// "type" : "orderedmap",
2003  /// "description" : "Topological information",
2004  /// "properties" : {
2005  /// "pointref" : {
2006  /// "type" : [{ "$ref" : "GA_ATITopology" }],
2007  /// "description" :
2008  /// "An list of points referenced by each
2009  /// vertex. The array of 'vertexcount' items
2010  /// must contain integer values in the range of
2011  /// (0,pointcount-1)"
2012  /// }
2013  /// }
2014  /// },
2015  ///
2016  /// // Attributes section
2017  /// "attributes": {
2018  /// "type" : { "$ref" : "GA_AttributeSet" } ,
2019  /// "description" : "Vertex attributes",
2020  /// }
2021  ///
2022  /// // Primitives section
2023  /// "primitives": {
2024  /// "type" : { "$ref" : "GA_PrimitiveList" } ,
2025  /// "description" : "An array of primitives",
2026  /// }
2027  ///
2028  /// // Groups section
2029  /// "pointgroups": {
2030  /// "type" : { "$ref" : "GA_GroupTable" },
2031  /// "description" : "The list of point groups",
2032  /// "optional" : true,
2033  /// },
2034  /// "primitivegroups": {
2035  /// "type" : { "$ref" : "GA_GroupTable" },
2036  /// "description" : "The list of primitive groups",
2037  /// "optional" : true,
2038  /// },
2039  /// "vertexgroups": {
2040  /// "type" : { "$ref" : "GA_GroupTable" },
2041  /// "description" : "The list of vertex groups",
2042  /// "optional" : true,
2043  /// },
2044  /// "edgegroups": {
2045  /// "type" : { "$ref" : "GA_GroupTable" },
2046  /// "description" : "The list of edge groups",
2047  /// "optional" : true,
2048  /// },
2049  /// },
2050  /// }
2051  /// @endcode
2052  /// @see @ref JSON_FileFormat
2053  /// @note This method uses <tt>findIO(GA_IOTable::getJSONToken())</tt> and
2054  /// uses a dynamic cast to GA_IOJSON to actually do the writing.
2055  IOStatus save(UT_JSONWriter &w, const GA_SaveOptions *opts=0) const;
2056 
2057  /// Load a geometry file
2058  IOStatus load(const char *filename,
2059  const GA_LoadOptions *opts=0,
2060  UT_StringArray *errors=0);
2061 
2062  /// Load a geometry file given a UT_IStream.
2063  IOStatus load(UT_IStream &is,
2064  const GA_LoadOptions *opts=0,
2065  UT_StringArray *errors=0);
2066 
2067  /// Load geometry from a JSON stream.
2068  /// @note This method uses <tt>findIO(GA_IOTable::getJSONToken())</tt> and
2069  /// uses a dynamic cast to GA_IOJSON to actually do the loading.
2070  IOStatus load(UT_JSONParser &p,
2071  const GA_LoadOptions *opts=0,
2072  UT_StringArray *errors=0);
2073 
2074  /// @{
2075  /// Stat a disk file rather than loading the entire geometry.
2076  /// (see @ref GA_STAT_LEVEL)
2077  /// The method cannot be static since the primitive factory is required.
2078  /// The primitive factory stores the IO table for the geometry.
2079  ///
2080  /// When performing a stat on a disk file, if the format supports it, only
2081  /// the header of the file is loaded. This means that the full
2082  /// information for the geometry isn't available. Thus, this will give
2083  /// you different information than if you run stat() on geometry that's
2084  /// fully loaded into memory.
2085  ///
2086  /// If you inspect a .geo file, you can see the information that's
2087  /// available. For example, you can get the "primcount_summary" using the
2088  /// GA_Stat::getInfoOptions() method.
2089  IOStatus statFile(const char *filename, GA_Stat &stat,
2090  uint level=0xffff,
2091  const GA_LoadOptions *opts=nullptr) const;
2092  IOStatus stat(UT_JSONParser &p, GA_Stat &stat, uint level) const;
2093  /// @}
2094 
2095  /// Private methods
2096  /// @private
2097  void batchDeletion(GA_AttributeOwner owner);
2098  /// @private
2099  void adjustArraySize(GA_AttributeOwner owner, GA_Offset size);
2100  /// @private
2101  void constructElementBlock(GA_AttributeOwner owner, GA_Offset offset, GA_Offset nelements)
2102  { myAttributes.constructElementBlock(owner, offset, nelements); }
2103  /// @private
2104  void destructElement(GA_AttributeOwner owner, GA_Offset offset)
2105  { myAttributes.destructElement(owner, offset); }
2106 
2107  /// @private mergeGrowArrays() is called during the merging process
2108  /// @b prior to the actual addition of new elements to the detail.
2109  /// At this point, attribute arrays are grown to store the incoming data
2110  void mergeGrowArrays(GA_MergeMap &map, GA_AttributeOwner owner);
2111 
2112  /// Get information about the detail.
2113  /// @param stat @n - Information about detail
2114  /// @param level @n - Mask of information to retrieve
2115  /// (see @ref GA_STAT_LEVEL)
2116  /// Note that since this method queries the geometry that's fully loaded
2117  /// into memory, you will get different information than the @c statFile()
2118  /// method.
2119  bool stat(GA_Stat &stat, uint level=0xffff) const;
2120 
2121  /// Fill out only the attribute information on the stat
2122  void statAttributes(GA_Stat &stat, uint level=0xffff) const;
2123  /// Fill out only the group information on the stat
2124  void statGroups(GA_Stat &stat, uint level=0xffff) const;
2125  /// Fill out only the volume information.
2126  virtual void statVolumes(GA_Stat &stat, uint level=0xffff) const;
2127 
2128  /// Debugging output of detail
2129  static int64 printMemory(UT_WorkBuffer &buffer,
2130  bool include_total=true,
2131  int indent=3,
2132  const char *title="Geometry Memory Tracking");
2133 
2134  /// @{
2135  /// Utility casting functions used by GA_GBMacros.h to maintain (source
2136  /// code) type compatibility with the old implementations that used the
2137  /// derived GD/GEO_PrimList objects.
2138  ///
2139  /// The first argument is used solely to infer the templatized type.
2140  /// Derived classes (GD_Detail/GEO_Detail) should contain embedded
2141  /// GB_MACRO_PRIM_TYPE typedef to specify
2142  /// the proper derived type to use for the cast.
2143  template <typename T> static inline const typename T::GB_MACRO_PRIM_TYPE *
2144  GB_MACRO_CAST(const T *, const GA_Primitive *prim)
2145  { return static_cast<const typename T::GB_MACRO_PRIM_TYPE *>(prim);}
2146  template <typename T> static inline typename T::GB_MACRO_PRIM_TYPE *
2147  GB_MACRO_CAST(const T *, GA_Primitive *prim)
2148  { return static_cast<typename T::GB_MACRO_PRIM_TYPE *>(prim); }
2149  /// @}
2150 
2152 
2153  /// @{
2154  /// @private
2155  /// Methods used by GEO primitives to save/load vertex references
2156  bool loadVertexPointReferenceH9(UT_IStream &is,
2157  GA_Offset &point_offset);
2158  bool saveVertexPointReferenceH9(std::ostream &os,
2159  int binary, GA_Offset vertex_offset) const;
2160 
2161  static bool loadAttribDataH9(UT_IStream &is, GA_Offset offset,
2163  static bool saveAttribDataH9(std::ostream &os, int binary,
2164  GA_Offset offset,
2166  char delim_ch = '(');
2167  /// Convenience methods for saving/loading both a vertex's point reference
2168  /// and its attribute values in a Houdini9 compatible style. Note that the
2169  /// load wires the vertex to the loaded point.
2170  bool loadVertexH9(UT_IStream &is, GA_Offset vertex_offset,
2171  const UT_Array<GA_AttribLoadDataH9> &vtx_l);
2172  bool saveVertexH9(std::ostream &os, int binary,
2173  GA_Offset vertex_offset,
2174  const UT_Array<GA_AttribSaveDataH9> &vtx_l)
2175  const;
2176  /// @}
2177 
2178  /// Provide access to the factory. This allows users to query information
2179  /// about factories.
2181  { return myPrimitiveFactory; }
2182 
2183  /// Refreshes handles cached in the detail. This method must be called
2184  /// after changing the storage of the P attribute.
2185  virtual void refreshCachedHandles();
2186  /// Refreshes the cached myP attribute.
2187  void refreshCachedAttributes();
2188 
2189  /// @{
2190  /// Add/Remove an attribute to the tail-initialization list.
2191  ///
2192  /// When attributes grow in size, they usually initialize their values to
2193  /// the default value. However, some attributes may not adhere to this
2194  /// rule, or due to space optimizations, may have the values set to
2195  /// non-default values. In this case, they should be added to the
2196  /// tail-initialization list. When new elements are appended to the
2197  /// detail, they will be told to re-initialize the new element. Otherwise,
2198  /// the detail will assume that the element values are at their default
2199  /// value.
2200  ///
2201  /// When removing, the method will return @c true if the attribute was a
2202  /// tail initializer.
2203  ///
2204  /// @note These methods are thread-safe
2205  /// @note DO NOT CALL THESE: Use the GA_Attribute::setTailInitialization
2206  /// instead.
2207  void addTailInitializer(GA_Attribute *attrib);
2208  bool removeTailInitializer(GA_Attribute *attrib);
2209  /// @}
2210 
2211  /// Tell all tail initialization attributes to initialize the given offset
2212  /// @note This method is not thread-safe
2215  {
2216  if (myTailInitializers)
2217  doConstructTailInitializers(owner, start, size);
2218  }
2219 
2221  { return myPrimitiveList.containsType(type); }
2223  { return myPrimitiveList.containsOnlyTypes(type); }
2225  { return myPrimitiveList.countType(type); }
2227  { return myPrimitiveList.
2228  hasLocalTransform(myPrimitiveFactory); }
2230  UT_Array<const GA_Primitive *> &prims) const
2231  { return myPrimitiveList.getPrimitivesOfType(type, prims); }
2232 
2233  // ------------- Primitive Type Masks ----------------------
2234 
2235  /// Returns a primitive typemask that represents all known primitive type
2236  /// by the primitive factory that is associated with this detail.
2237  GA_PrimitiveTypeMask getPrimitiveTypeMaskAll() const;
2238 
2239  /// Returns the primitive typemask that represents all primitives in this
2240  /// detail.
2241  GA_PrimitiveTypeMask getPrimitiveTypeMask(
2242  const GA_PrimitiveGroup *group = 0) const;
2243 
2244 
2245  /// Return cached attribute instance matrix pointer
2246  const GA_AttributeInstanceMatrix &getInstanceMatrix() const;
2247 
2248  /// Clear the attribute instance matrix pointer. This is called
2249  /// automatically when point attributes are added or deleted.
2250  void clearInstanceMatrix();
2251 
2252  /// This function is entirely here so that GA has a way to check if a
2253  /// GA_Detail is a GEO_Detail (true) or GD_Detail (false).
2254  bool isPrimary() const
2255  {
2256  return myPrimitiveFactory.isForPrimaryDetail();
2257  }
2258 
2259  /// All GPU buffers that have been written to will be copied back
2260  /// to the CPU & marked clean.
2261  void flushCEWriteCaches();
2262 
2263  /// Flush all GPU-backed CE attributes, clearing them from this
2264  /// geometry.
2265  void flushCECaches();
2266 
2267  /// Copy changed/non transforming attribute values from inputgeo
2268  /// owner specifies the attribute class to act upon
2269  /// This is used by SOP_Deform/SOP_AttribVop to speed up the duplication of input gdp.
2270  void copyChangedNonTransforming(const GA_Detail *inputgeo, GA_AttributeOwner owner);
2271 
2272  static const int64 INVALID_CACHE_COUNT = -1;
2273 
2274  void incrementMetaCacheCount() { myMetaCacheCount++; }
2275  int64 getMetaCacheCount() const { return myMetaCacheCount; }
2276 
2277  /// The preferred precision for both computation and creation of
2278  /// attributes. Default precision is 32bit.
2279  GA_Precision getPreferredPrecision() const;
2280  /// Override the preferred precision. Currently will accept
2281  /// 32 and 64bit.
2282  void setPreferredPrecision(GA_Precision prec);
2283 
2284  /// @{
2285  /// @private
2286  class GA_API MantraGeometry
2287  {
2288  public:
2289  MantraGeometry() {}
2290  virtual ~MantraGeometry() {}
2291  virtual void refreshCachedHandles();
2292  };
2293  MantraGeometry *mantraGeometry()
2294  { return myMantraGeometry; }
2295  const MantraGeometry *mantraGeometry() const
2296  { return myMantraGeometry; }
2297  void setMantraGeometry(MantraGeometry *m)
2298  { myMantraGeometry = m; }
2299  /// @}
2300 
2301 protected:
2302  void doConstructTailInitializers(GA_AttributeOwner owner,
2303  GA_Offset start, GA_Offset size);
2304 
2305  bool loadPrimitivesH9(UT_IStream &is, int count,
2306  const GA_FileFormatH9::PrimTypeXlate &type_map,
2307  const UT_Array<GA_AttribLoadDataH9> &prim_attribs,
2308  const UT_Array<GA_AttribLoadDataH9> &vtx_attribs);
2309  bool savePrimitivesH9(std::ostream &os, int binary,
2310  const UT_Array<const GA_Primitive *> &list,
2311  const GA_FileFormatH9::PrimTypeXlate &type_map,
2312  const UT_Array<GA_AttribSaveDataH9> &prim_attribs,
2313  const UT_Array<GA_AttribSaveDataH9> &vx_attribs) const;
2314 
2315  /// @{
2316  /// Virtual implementation of intrinsic attributes. See GA_IntrinsicEval
2317  /// for further details.
2318  virtual GA_Size localIntrinsicTupleSize(GA_IntrinsicEval &eval) const;
2319  virtual GA_Size localGetIntrinsicS(GA_IntrinsicEval &eval,
2320  UT_String &value) const;
2321  virtual GA_Size localGetIntrinsicSA(GA_IntrinsicEval &eval,
2322  UT_StringArray &value) const;
2323  virtual GA_Size localGetIntrinsicD(GA_IntrinsicEval &eval,
2324  UT_OptionsHolder &value) const;
2325  virtual GA_Size localGetIntrinsicDA(GA_IntrinsicEval &eval,
2327  virtual GA_Size localGetIntrinsicI(GA_IntrinsicEval &eval,
2328  int64 *value, GA_Size size) const;
2329  virtual GA_Size localGetIntrinsicF(GA_IntrinsicEval &eval,
2330  fpreal64 *value, GA_Size size) const;
2331  virtual GA_Size localSetIntrinsicS(GA_IntrinsicEval &eval,
2332  const char *value);
2333  virtual GA_Size localSetIntrinsicSA(GA_IntrinsicEval &eval,
2334  const UT_StringArray &value);
2335  virtual GA_Size localSetIntrinsicSS(GA_IntrinsicEval &eval,
2336  const char **value, GA_Size size);
2337  virtual GA_Size localSetIntrinsicDA(GA_IntrinsicEval &eval,
2339  virtual GA_Size localSetIntrinsicDS(GA_IntrinsicEval &eval,
2341  virtual GA_Size localSetIntrinsicI(GA_IntrinsicEval &eval,
2342  const int64 *value, GA_Size size);
2343  virtual GA_Size localSetIntrinsicF(GA_IntrinsicEval &eval,
2344  const fpreal64 *value, GA_Size size);
2345  /// @}
2346 
2347  // Methods used by GEO when loading old style geometry files.
2348  static void finishLoadH9(
2350  );
2351 
2352  friend class GA_AttributeSet;
2353  /// This is here just so that GA_AttributeSet::jsonSave() can call
2354  /// GEOcomputeNormals()
2355  virtual void privateComputeNormal(
2356  const GA_RWHandleV3 &normalattrib,
2357  const GA_Group *group,
2358  const float cuspangledegrees,
2359  const int method) const
2360  {}
2361  /// This is here so that GA_AttributeSet::jsonLoad() can call it
2362  /// after loading attributes, since VDB primitive loading tries to
2363  /// write to P, and we might as well have it correctly split up
2364  /// before anything might read/write it.
2365  void splitAnyFloat4P();
2366 
2367  // Allow derived classes to modify myUniqueId and myMetaCacheCount
2368  // Don't make public, as this shouldn't be used in normal cooking.
2369  // Used by GU_Detail::cloneForCache() to make separated details act
2370  // as the same detail.
2371  void setUniqueId(exint i) { myUniqueId = i; }
2372  void setMetaCacheCount(int64 i) { myMetaCacheCount=i; }
2373 
2374 private:
2375  void init(GA_Storage Pstore, bool isprimary, bool full_topology);
2376 
2377  GA_Offset newPrimitiveOffset();
2378 
2379  void clearData(bool for_deletion);
2380 
2381  /// Destroy elements. When destroying points, if the
2382  /// guarantee_no_vertex_point_references is true, we don't bother
2383  /// dereferencing the points (which speeds up the operation).
2384  GA_Size destroyElements(const GA_Range &range,
2385  GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES,
2386  bool guarantee_no_vertex_point_references=false);
2387 
2388  // Try to make primitives de-reference the point
2389  bool dereferencePoint(GA_Offset point,
2390  GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES);
2391  // Try to make primitives de-reference a range of points. A return value
2392  // of true means that all points in the range are no longer referenced by
2393  // primitives, while a return value of false means that some points in the
2394  // range continue to be referenced. This method may allocate a membership
2395  // query object, in which case, the caller is responsible for deleting it.
2396  bool dereferencePoints(const GA_Range &point_range,
2397  const GA_RangeMemberQuery *&point_range_query,
2398  GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES);
2399 
2400 
2401  /// Called by GA_IO during loading of optimized formats
2402  bool setLoadCounts(GA_Size npoint, GA_Size nvertex, GA_Size nprim,
2403  GA_LoadMap &load);
2404 
2405  friend class GA_IO;
2406  friend class GA_PrimitiveList;
2407 
2408  GA_PrimitiveFactory &myPrimitiveFactory;
2409  GA_IndexMap myPointMap;
2410  GA_IndexMap myVertexMap;
2411  GA_IndexMap myPrimitiveMap;
2412  GA_IndexMap myGlobalMap; // Always has a single entry
2413  GA_PrimitiveList myPrimitiveList;
2414  GA_AttributeSet myAttributes;
2415  GA_Topology myTopology;
2416  GA_Attribute *myP;
2417  GA_RWHandleV3 myHandlePV3;
2418  GA_Attribute *myPw;
2419  ga_TailInitializeTable *myTailInitializers;
2420  MantraGeometry *myMantraGeometry;
2421  mutable GA_AttributeInstanceMatrix *myInstanceMatrix;
2422  GA_PointGroupTable myPointGroups;
2423  GA_VertexGroupTable myVertexGroups;
2424  GA_PrimitiveGroupTable myPrimitiveGroups;
2425  GA_EdgeGroupTable myEdgeGroups;
2426  exint myUniqueId;
2427 
2428 
2429  /// Checking this meta cache count and the unique ID of the
2430  /// detail is sufficient to determine whether this detail
2431  /// has been modified since it was last examined, so long as it's
2432  /// not currently being used in a cook. Any cook only needs to
2433  /// increment the meta cache count once, and only if the detail
2434  /// is actually modified, (e.g. don't need to inc if instancing).
2435  ///
2436  /// NOTE: Do not rely on the detail pointer to check for modification,
2437  /// since a different detail could happen to be allocated
2438  /// at the same address in memory.
2439  int64 myMetaCacheCount;
2440 };
2441 
2442 #endif
GLdouble s
Definition: glew.h:1390
UT_Vector2 getPos2(GA_Offset ptoff) const
The ptoff passed is the point offset.
Definition: GA_Detail.h:167
virtual void clearCaches()
Definition: GA_Detail.h:1856
void stashAll()
Definition: GA_Detail.h:137
A class to manage an ordered array which has fixed offset handles.
Definition: GA_IndexMap.h:63
GA_PointGroup * newDetachedPointGroup() const
Definition: GA_Detail.h:1277
SYS_FORCE_INLINE void forEachPrimitiveBreak(const GA_PrimitiveGroup *group, FUNCTOR &&functor) const
Definition: GA_Detail.h:1536
SYS_FORCE_INLINE void setPos3(GA_Offset ptoff, const UT_Vector3 &P)
Set P from a UT_Vector3.
Definition: GA_Detail.h:207
GA_PointGroupTable & pointGroups()
Definition: GA_Detail.h:1119
GLenum GLint * range
Definition: glew.h:3500
bool isPointUsedFast(GA_Offset point) const
Definition: GA_Detail.h:666
SYS_FORCE_INLINE const GA_PrimitiveGroup * findPrimitiveGroup(const UT_StringRef &name) const
Definition: GA_Detail.h:1196
Definition of a geometry attribute.
Definition: GA_Attribute.h:196
GA_Range primitiveRange() const
Definition: GA_Detail.h:715
const UT_Options * getIntrinsicOptions(GA_LocalIntrinsic h) const
Definition: GA_Detail.h:1375
void incrementMetaCacheCount()
Definition: GA_Detail.h:2274
bool containsLocalTransformPrimitive() const
Definition: GA_Detail.h:2226
GT_API const UT_StringHolder filename
GA_Range getPrimitiveRangeSlice(GA_Index begin_prim, GA_Index end_prim=GA_INVALID_INDEX) const
Get ordered primitive range from base_prim to end_prim, or the end.
Definition: GA_Detail.h:1684
SYS_FORCE_INLINE const GA_Attribute * findGlobalAttribute(GA_AttributeScope s, const UT_StringRef &name) const
Definition: GA_Detail.h:998
const GA_VertexGroupTable & vertexGroups() const
Definition: GA_Detail.h:1129
SYS_FORCE_INLINE GA_Primitive * getPrimitive(GA_Offset prim_off)
Definition: GA_Detail.h:380
GA_PrimitiveGroupUPtr createDetachedPrimitiveGroup() const
Definition: GA_Detail.h:1298
SYS_FORCE_INLINE void copyPoint(GA_Offset destptoff, GA_Offset srcptoff, const GA_AttributeFilter *filter=nullptr)
Definition: GA_Detail.h:1789
GLsizeiptr size
Definition: glew.h:1681
GA_Attribute * createAttribute(GA_AttributeOwner owner, const UT_StringHolder &name, const UT_Options *create_args, const GA_AttributeOptions *attribute_options, const UT_StringRef &attribtype)
Definition: GA_Detail.h:818
bool setLoadCounts(GA_Detail &gdp, GA_Size npoints, GA_Size nvertex, GA_Size nprimitive, GA_LoadMap &loadmap) const
GLenum src
Definition: glew.h:2410
SYS_FORCE_INLINE const GA_Attribute * findVertexAttribute(const UT_StringRef &name) const
Definition: GA_Detail.h:988
GLenum GLint ref
Definition: glew.h:1845
GA_Primitive GB_MACRO_PRIM_TYPE
Definition: GA_Detail.h:2151
SYS_FORCE_INLINE GA_AttributeUPtr createDetachedAttribute(GA_AttributeOwner owner, const UT_StringRef &attribtype, const UT_Options *create_args=nullptr, const GA_AttributeOptions *attribute_options=nullptr) const
Definition: GA_Detail.h:848
GA_Primitive * getPrimitiveByIndex(GA_Index prim_idx)
Definition: GA_Detail.h:389
GA_Range getVertexRange(const GA_VertexGroup *group=0) const
Get a range of all vertices in the detail.
Definition: GA_Detail.h:1696
GLuint const GLchar * name
Definition: glew.h:1814
int gbstatus() const
Definition: GA_Detail.h:1922
SYS_FORCE_INLINE void forEachPointBreak(const GA_PointGroup *group, bool complement, FUNCTOR &&functor) const
Definition: GA_Detail.h:1478
void getIONames(UT_StringArray &names) const
Definition: GA_Detail.h:1890
const GA_IndexMap & getPrimitiveMap() const
Definition: GA_Detail.h:686
SYS_FORCE_INLINE GA_Attribute * findGlobalAttribute(const UT_StringRef &name)
Definition: GA_Detail.h:1060
static T::GB_MACRO_PRIM_TYPE * GB_MACRO_CAST(const T *, GA_Primitive *prim)
Definition: GA_Detail.h:2147
GA_Size destroyVertexOffsets(const GA_Range &range)
Definition: GA_Detail.h:656
GA_PointGroup * newInternalPointGroup()
Definition: GA_Detail.h:1254
void constructTailInitializers(GA_AttributeOwner owner, GA_Offset start, GA_Offset size=GA_Offset(1))
Definition: GA_Detail.h:2213
GLenum mode
Definition: glew.h:2163
Class which stores the default values for a GA_Attribute.
Definition: GA_Defaults.h:35
UT_Vector2T< float > UT_Vector2
const GA_IO * findIO(const char *name=nullptr) const
Definition: GA_Detail.h:1885
SYS_FORCE_INLINE const GA_Attribute * findVertexAttribute(GA_AttributeScope s, const UT_StringRef &name) const
Definition: GA_Detail.h:984
GA_StorageClass
Definition: GA_Types.h:71
void skip(T &in, int n)
Definition: ImfXdr.h:885
GLuint index
Definition: glew.h:1814
UT_UniquePtr< GA_VertexGroup > GA_VertexGroupUPtr
GA_Precision
Definition: GA_Types.h:86
UT_Vector4 getPos4(GA_Offset ptoff) const
The ptoff passed is the point offset.
Definition: GA_Detail.h:252
GLuint const GLfloat * val
Definition: glew.h:2794
GA_IndexMap & getIndexMap(GA_AttributeOwner owner)
Definition: GA_Detail.h:678
bool GAisValid(GA_Size v)
Definition: GA_Types.h:647
OffsetMarker(const GA_Detail &detail)
Definition: GA_Detail.h:706
SYS_FORCE_INLINE void setPos3(GA_Offset ptoff, fpreal x, fpreal y, fpreal z)
Set P given the x, y, z components.
Definition: GA_Detail.h:213
GA_EdgeGroup * newEdgeGroup(const UT_StringHolder &name, bool internal)
Definition: GA_Detail.h:1326
void setMantraGeometry(MantraGeometry *m)
Definition: GA_Detail.h:2297
const GLint * attribs
Definition: glew.h:14385
UT_Vector3T< float > UT_Vector3
GA_VertexGroup * newInternalVertexGroup()
Definition: GA_Detail.h:1258
const GA_IndexMap & getGlobalMap() const
Definition: GA_Detail.h:687
const MantraGeometry * mantraGeometry() const
Definition: GA_Detail.h:2295
The merge map keeps track of information when merging details.
Definition: GA_MergeMap.h:53
int64 exint
Definition: SYS_Types.h:125
GA_Attribute * getP()
Convenience method to access the P attribute.
Definition: GA_Detail.h:163
const GA_Primitive * getPrimitiveByIndex(GA_Index prim_idx) const
Definition: GA_Detail.h:391
GA_Range pointRange() const
Definition: GA_Detail.h:711
GA_StorageClass getIntrinsicStorage(GA_LocalIntrinsic h) const
Definition: GA_Detail.h:1371
const GA_Attribute * getP() const
Definition: GA_Detail.h:164
SYS_FORCE_INLINE const GA_Attribute * findAttribute(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringRef &name) const
Definition: GA_Detail.h:968
SYS_FORCE_INLINE GA_Attribute * findAttribute(GA_AttributeOwner owner, const UT_StringRef &name)
Definition: GA_Detail.h:1031
SYS_FORCE_INLINE GA_ElementGroupTableT< OWNER >::GROUP_TYPE * createElementGroup(const UT_StringHolder &name, bool ordered=false)
Definition: GA_Detail.h:1140
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:76
SYS_FORCE_INLINE const GA_Attribute * findGlobalAttribute(const UT_StringRef &name) const
Definition: GA_Detail.h:1002
SYS_FORCE_INLINE GA_Attribute * findPointAttribute(GA_AttributeScope s, const UT_StringRef &name)
Definition: GA_Detail.h:1035
Class used to map H9 geometry files to a form used by GA.
Definition: GA_AIFFileH9.h:317
Manager to keep track of global handle to name mappings.
const GLdouble * m
Definition: glew.h:9124
#define GA_API
Definition: GA_API.h:12
SYS_FORCE_INLINE void forEachOffset(FUNCTOR &&functor) const
Calls functor on every active offset in this index map.
Definition: GA_IndexMap.h:495
GLdouble l
Definition: glew.h:9122
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:34
GA_Range vertexRange() const
Definition: GA_Detail.h:713
Abstract base class for a range membership query object.
const GLdouble * v
Definition: glew.h:1391
GA_PrimitiveGroup * newInternalPrimitiveGroup()
Definition: GA_Detail.h:1262
GA_EdgeGroupTable & edgeGroups()
Definition: GA_Detail.h:1131
IOStatus & operator=(const IOStatus &src)
Definition: GA_Detail.h:1906
SYS_FORCE_INLINE UT_Vector3 getPos3(GA_Offset ptoff) const
The ptoff passed is the point offset.
Definition: GA_Detail.h:174
void setMetaCacheCount(int64 i)
Definition: GA_Detail.h:2372
static const T::GB_MACRO_PRIM_TYPE * GB_MACRO_CAST(const T *, const GA_Primitive *prim)
Definition: GA_Detail.h:2144
GA_PointGroup * newPointGroup(const UT_StringHolder &name)
Definition: GA_Detail.h:1231
SYS_FORCE_INLINE const GA_ElementGroupTableT< OWNER >::GROUP_TYPE * findElementGroup(const UT_StringRef &name) const
Definition: GA_Detail.h:1167
SYS_FORCE_INLINE void forEachPointBreak(const GA_PointGroup *group, FUNCTOR &&functor) const
Definition: GA_Detail.h:1472
SYS_FORCE_INLINE GA_PrimitiveGroup * findPrimitiveGroup(const UT_StringRef &name)
Definition: GA_Detail.h:1206
GA_Offset pointBegin() const
Definition: GA_Detail.h:717
SYS_FORCE_INLINE GA_Attribute * findPrimitiveAttribute(GA_AttributeScope s, const UT_StringRef &name)
Definition: GA_Detail.h:1049
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:233
bool setPos3FromArray(const GA_Range &ptrange, const UT_Array< UT_Vector3T< T > > &positions)
Definition: GA_Detail.h:192
GA_DestroyPointMode
Definition: GA_Detail.h:585
GLuint GLdouble GLdouble GLint GLint order
Definition: glew.h:3446
GA_Size destroyPrimitives(const GA_Range &it, bool and_points=false)
Definition: GA_Detail.h:623
SYS_FORCE_INLINE GA_Offset vertexToPrevVertex(GA_Offset vtx) const
Definition: GA_Detail.h:526
#define GA_INVALID_OFFSET
Definition: GA_Types.h:676
GA_Size countPrimitiveType(const GA_PrimitiveTypeId &type) const
Definition: GA_Detail.h:2224
SYS_FORCE_INLINE GA_Offset findActiveOffset(GA_Offset start, GA_Offset end) const
Definition: GA_IndexMap.h:479
A range of elements in an index-map.
Definition: GA_Range.h:42
GA_PrimitiveGroup * newPrimitiveGroup(const UT_StringHolder &name)
Definition: GA_Detail.h:1239
GLdouble GLdouble z
Definition: glew.h:1559
int GA_GlobalIntrinsic
Definition: GA_Types.h:693
A string map of attributes to ease backward compatibility In the GB/GEO/GU library code would often p...
double fpreal64
Definition: SYS_Types.h:201
SYS_FORCE_INLINE const GA_Attribute * findPointAttribute(const UT_StringRef &name) const
Definition: GA_Detail.h:981
SYS_FORCE_INLINE GA_VertexGroup * findVertexGroup(const UT_StringRef &name)
Definition: GA_Detail.h:1203
GA_Size GA_Offset
Definition: GA_Types.h:639
GA_VertexGroup * newVertexGroup(const UT_StringHolder &name, bool internal)
Definition: GA_Detail.h:1322
GA_PointGroupUPtr createDetachedPointGroup() const
Definition: GA_Detail.h:1294
SYS_FORCE_INLINE void forEachPrimitiveBreak(FUNCTOR &&functor) const
Definition: GA_Detail.h:1530
int GA_LocalIntrinsic
Definition: GA_Types.h:692
GA_EdgeGroup * newInternalEdgeGroup()
Definition: GA_Detail.h:1266
GA_VertexGroupTable & vertexGroups()
Definition: GA_Detail.h:1127
GA_AttributeScope
Definition: GA_Types.h:141
SYS_FORCE_INLINE const GA_Attribute * findAttribute(GA_AttributeOwner owner, const UT_StringRef &name) const
Definition: GA_Detail.h:973
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glew.h:2981
MantraGeometry * mantraGeometry()
Definition: GA_Detail.h:2293
SYS_FORCE_INLINE GA_Index primitiveIndex(GA_Offset offset) const
Given a primitive's data offset, return its index.
Definition: GA_Detail.h:374
void setPos4(GA_Offset ptoff, fpreal x, fpreal y, fpreal z, fpreal w)
Set P given the x, y, z, w components.
Definition: GA_Detail.h:264
UT_Vector4T< float > UT_Vector4
GA_Range getPointRange(const GA_PointGroup *group=0) const
Get a range of all points in the detail.
Definition: GA_Detail.h:1666
const GA_IndexMap & getPointMap() const
Definition: GA_Detail.h:684
GA_Offset primitiveEnd() const
Definition: GA_Detail.h:727
const GA_Topology & getTopology() const
Definition: GA_Detail.h:742
SYS_FORCE_INLINE T & y()
Definition: UT_Vector3.h:513
GA_Range getGlobalRange() const
Get a range representing the global (detail) data.
Definition: GA_Detail.h:1699
const GA_AttributeSet & getAttributes() const
Definition: GA_Detail.h:740
static void forEachOffsetBreak(FUNCTOR &&functor, const GA_IndexMap &index_map, const GA_ElementGroup *group=nullptr, bool complement=false)
Definition: GA_Detail.h:1606
GA_PointGroup * newPointGroup(const UT_StringHolder &name, bool internal)
Definition: GA_Detail.h:1314
GLclampf f
Definition: glew.h:3499
GLint GLint GLint GLint GLint x
Definition: glew.h:1252
GA_Offset pointEnd() const
Definition: GA_Detail.h:723
ElementType< OWNER, true >::Class GROUP_TYPE
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1252
SYS_FORCE_INLINE const GA_Primitive * getPrimitive(GA_Offset prim_off) const
Definition: GA_Detail.h:383
GA_Size GA_ElementGroupOrderIndex
Class used to keep track of inheritance of intrinsic attribute evaluation.
#define SYS_SAFE_BOOL
Definition: SYS_Compiler.h:55
SYS_FORCE_INLINE GA_Offset appendPointBlock(GA_Size npoints)
Append new points, returning the first offset of the contiguous block.
Definition: GA_Detail.h:281
SYS_FORCE_INLINE void forEachPoint(FUNCTOR &&functor) const
Definition: GA_Detail.h:1435
SYS_FORCE_INLINE bool destroyElementGroup(GA_AttributeOwner owner, const UT_StringRef &name)
Definition: GA_Detail.h:1178
GLuint buffer
Definition: glew.h:1680
GA_EdgeGroup * newEdgeGroup(const UT_StringHolder &name)
Definition: GA_Detail.h:1243
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:134
GA_EdgeGroupUPtr createDetachedEdgeGroup() const
Definition: GA_Detail.h:1306
bool registerIO(GA_IO *io) const
Register an IO file format.
Definition: GA_Detail.h:1880
const GLuint GLenum const void * binary
Definition: glew.h:3502
SYS_FORCE_INLINE const GA_PointGroup * findPointGroup(const UT_StringRef &name) const
Definition: GA_Detail.h:1190
SYS_FORCE_INLINE void forEachPrimitive(FUNCTOR &&functor) const
Definition: GA_Detail.h:1495
GA_PrimitiveGroup * newDetachedPrimitiveGroup() const
Definition: GA_Detail.h:1281
SYS_FORCE_INLINE GA_Offset appendVertex()
Append a vertex (for the entire detail)
Definition: GA_Detail.h:448
const GA_EdgeGroupTable & edgeGroups() const
Definition: GA_Detail.h:1133
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
bool success() const
Definition: GA_Detail.h:1915
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1890
GA_Size destroyUnusedPoints(const GA_PointGroup *ptgrp=0)
Destroy unused points. If ptgrp is given, then only within the group.
Definition: GA_Detail.h:632
GLuint GLuint end
Definition: glew.h:1253
SYS_FORCE_INLINE GA_Offset appendPoint()
Append a new point, returning its new data offset.
Definition: GA_Detail.h:277
GA_AttributeSet & getAttributes()
Definition: GA_Detail.h:739
bool getIntrinsicReadOnly(GA_LocalIntrinsic h) const
Definition: GA_Detail.h:1373
GLuint const GLuint * names
Definition: glew.h:2690
SYS_FORCE_INLINE void translatePoint(GA_Offset ptoff, const UT_Vector3 &delta)
Definition: GA_Detail.h:221
GLsizei n
Definition: glew.h:4040
GA_Attribute * createStringAttribute(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringHolder &name, const UT_Options *create_args=nullptr, const GA_AttributeOptions *attribute_options=nullptr)
Definition: GA_Detail.h:926
SYS_FORCE_INLINE GA_Attribute * findPrimitiveAttribute(const UT_StringRef &name)
Definition: GA_Detail.h:1053
SYS_FORCE_INLINE GA_Offset pointVertex(GA_Offset point) const
Definition: GA_Detail.h:502
UT_UniquePtr< GA_PrimitiveGroup > GA_PrimitiveGroupUPtr
SYS_FORCE_INLINE GA_Offset findInactiveOffset(GA_Offset start, GA_Offset end) const
Definition: GA_IndexMap.h:473
void setUniqueId(exint i)
Definition: GA_Detail.h:2371
SYS_FORCE_INLINE GA_Attribute * findPointAttribute(const UT_StringRef &name)
Definition: GA_Detail.h:1039
SYS_FORCE_INLINE GA_ATINumericUPtr createDetachedTupleAttribute(GA_AttributeOwner owner, GA_Storage storage, int tuple_size, const GA_Defaults &defaults=GA_Defaults(0.0f), const GA_AttributeOptions *attribute_options=nullptr) const
Definition: GA_Detail.h:835
IOStatus(const IOStatus &src)
Definition: GA_Detail.h:1901
const GA_PointGroupTable & pointGroups() const
Definition: GA_Detail.h:1121
SYS_FORCE_INLINE GA_Offset getNumPointOffsets() const
Definition: GA_Detail.h:292
long long int64
Definition: SYS_Types.h:116
SYS_FORCE_INLINE GA_Attribute * findAttribute(const UT_StringRef &name, const GA_AttributeOwner search_order[], int search_size)
Definition: GA_Detail.h:1018
GA_EdgeGroup * newDetachedEdgeGroup() const
Definition: GA_Detail.h:1289
SYS_FORCE_INLINE GA_Index vertexIndex(GA_Offset offset) const
Given a vertex's data offset, return its index.
Definition: GA_Detail.h:470
Options during loading.
Definition: GA_LoadMap.h:42
SYS_FORCE_INLINE GA_Offset getNumVertexOffsets() const
Definition: GA_Detail.h:462
SYS_FORCE_INLINE GA_ElementGroupTableT< OWNER >::GROUP_TYPE * findElementGroup(const UT_StringRef &name)
Definition: GA_Detail.h:1159
SYS_FORCE_INLINE GA_Attribute * findAttribute(GA_AttributeScope scope, const UT_StringRef &name, const GA_AttributeOwner search_order[], int search_size)
Definition: GA_Detail.h:1008
const GA_IndexMap & getVertexMap() const
Definition: GA_Detail.h:685
HUSD_API bool eval(VtValue &val, T &ret_val)
SYS_FORCE_INLINE GA_Offset vertexPoint(GA_Offset vertex) const
Given a vertex, return the point it references.
Definition: GA_Detail.h:480
SYS_FORCE_INLINE GA_Attribute * findGlobalAttribute(GA_AttributeScope s, const UT_StringRef &name)
Definition: GA_Detail.h:1056
GA_Range getPointRangeSlice(GA_Index begin_ptnum, GA_Index end_ptnum=GA_INVALID_INDEX) const
Get ordered point range from base_ptnum to end_ptnum, or the end.
Definition: GA_Detail.h:1673
GLfloat GLfloat GLfloat GLfloat h
Definition: glew.h:8011
SYS_FORCE_INLINE GA_PointGroup * findPointGroup(const UT_StringRef &name)
Definition: GA_Detail.h:1200
SYS_FORCE_INLINE const GA_Attribute * findAttribute(GA_AttributeScope scope, const UT_StringRef &name, const GA_AttributeOwner search_order[], int search_size) const
Definition: GA_Detail.h:950
SYS_FORCE_INLINE bool destroyEdgeGroup(const UT_StringRef &name)
Definition: GA_Detail.h:1218
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:633
GA_PrimitiveList & getPrimitiveList()
Definition: GA_Detail.h:737
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
SYS_FORCE_INLINE bool destroyEdgeGroup(GA_EdgeGroup *g)
Definition: GA_Detail.h:1221
SYS_FORCE_INLINE const GA_Attribute * findPrimitiveAttribute(const UT_StringRef &name) const
Definition: GA_Detail.h:995
GA_GlobalIntrinsic findGlobalIntrinsic(GA_LocalIntrinsic h) const
Definition: GA_Detail.h:1365
GLuint start
Definition: glew.h:1253
SYS_FORCE_INLINE GA_Offset vertexToNextVertex(GA_Offset vtx) const
Definition: GA_Detail.h:514
UT_UniquePtr< GA_Attribute > GA_AttributeUPtr
Definition: GA_Attribute.h:913
exint getUniqueId() const
Definition: GA_Detail.h:116
GA_Topology & getTopology()
Definition: GA_Detail.h:741
SYS_FORCE_INLINE void forEachPoint(const GA_PointGroup *group, FUNCTOR &&functor) const
Definition: GA_Detail.h:1447
GA_Offset getElement(GA_ElementGroupOrderIndex i) const
Will return -1 if the i'th entry is a mixed entry.
A list of primitives.
SYS_FORCE_INLINE void forEachPrimitiveBreak(const GA_PrimitiveGroup *group, bool complement, FUNCTOR &&functor) const
Definition: GA_Detail.h:1542
SYS_FORCE_INLINE const GA_Attribute * findPrimitiveAttribute(GA_AttributeScope s, const UT_StringRef &name) const
Definition: GA_Detail.h:991
GA_LocalIntrinsic findIntrinsic(const char *nm) const
Definition: GA_Detail.h:1361
GA_Size destroyPointOffsets(const GA_Range &range, GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES, bool guarantee_no_vertex_references=false)
Definition: GA_Detail.h:639
GA_Attribute * createTupleAttribute(GA_AttributeOwner owner, const UT_StringHolder &name, GA_Storage storage, int tuple_size, const GA_Defaults &defaults=GA_Defaults(0.0f), const UT_Options *create_args=nullptr, const GA_AttributeOptions *attribute_options=nullptr)
Definition: GA_Detail.h:912
SYS_FORCE_INLINE GA_Index pointIndex(GA_Offset offset) const
Given a point's data offset, return its index.
Definition: GA_Detail.h:300
GA_VertexGroupUPtr createDetachedVertexGroup() const
Definition: GA_Detail.h:1302
SYS_FORCE_INLINE GA_ElementGroupTable & getElementGroupTable(GA_AttributeOwner owner)
Definition: GA_Detail.h:1106
GLfloat GLfloat p
Definition: glew.h:16321
SYS_FORCE_INLINE GA_Size getNumVertices() const
Return the number verticies in the entire detail.
Definition: GA_Detail.h:455
GA_Size entries() const
Return the total number of entries, mixed or not.
SYS_FORCE_INLINE GA_Offset vertexPrimitive(GA_Offset vertex) const
Definition: GA_Detail.h:488
static const GROUP_TYPE * castGroup(const GA_ElementGroup *group)
GA_Offset vertexEnd() const
Definition: GA_Detail.h:725
GA_VertexGroup * newDetachedVertexGroup() const
Definition: GA_Detail.h:1285
GA_AttributeOwner
Definition: GA_Types.h:33
A map of string to various well defined value types.
Definition: UT_Options.h:84
Class to return information about a GA_Detail.
Definition: GA_Stat.h:50
GA_LocalIntrinsic findIntrinsic(GA_GlobalIntrinsic h) const
Definition: GA_Detail.h:1363
void clear()
Definition: GA_Detail.h:126
GA_Offset vertexBegin() const
Definition: GA_Detail.h:719
GLuint counter
Definition: glew.h:2740
SYS_FORCE_INLINE GA_AttributeUPtr createDetachedAttribute(GA_AttributeOwner owner, const GA_AttributeType &attribtype, const UT_Options *create_args=nullptr, const GA_AttributeOptions *attribute_options=nullptr) const
Definition: GA_Detail.h:860
SYS_FORCE_INLINE GA_Offset getNumPrimitiveOffsets() const
Definition: GA_Detail.h:366
void copyVertex(GA_Offset destvtxoff, GA_Offset srcvtxoff, bool ref_point_dont_copy, const GA_AttributeFilter *filter=nullptr)
Definition: GA_Detail.h:1805
fpreal64 fpreal
Definition: SYS_Types.h:277
SYS_FORCE_INLINE GA_Offset primitiveOffset(GA_Index index) const
Given a primitive's index (in append order), return its data offset.
Definition: GA_Detail.h:370
SYS_FORCE_INLINE GA_ElementGroupTableT< OWNER >::GROUP_TYPE * createInternalElementGroup(bool ordered=false)
Definition: GA_Detail.h:1150
SYS_FORCE_INLINE bool destroyAttribute(GA_AttributeOwner owner, const UT_StringRef &name)
Definition: GA_Detail.h:881
GA_GroupType
An ordinal enum for the different types of groups in GA.
Definition: GA_Types.h:159
bool containsPrimitiveType(const GA_PrimitiveTypeId &type) const
Definition: GA_Detail.h:2220
SYS_FORCE_INLINE GA_Size getNumPrimitives() const
Return the number of primitives.
Definition: GA_Detail.h:359
SYS_FORCE_INLINE void forEachPoint(const GA_PointGroup *group, bool complement, FUNCTOR &&functor) const
Definition: GA_Detail.h:1456
GLuint GLuint GLsizei count
Definition: glew.h:1253
Class used to map the GA attribute into a form for H9 geometry files.
Definition: GA_AIFFileH9.h:261
Compute an instance transform given a set of attributes.
GA_PrimitiveGroup * newPrimitiveGroup(const UT_StringHolder &name, bool internal)
Definition: GA_Detail.h:1318
int64 getMetaCacheCount() const
Definition: GA_Detail.h:2275
SYS_FORCE_INLINE bool renameAttribute(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringRef &fromName, const UT_StringHolder &toName)
Definition: GA_Detail.h:887
SYS_FORCE_INLINE void forEachPointBreak(FUNCTOR &&functor) const
Definition: GA_Detail.h:1466
const GA_PrimitiveList & getPrimitiveList() const
Definition: GA_Detail.h:735
const GA_Attribute * getPwAttribute() const
Definition: GA_Detail.h:241
Provide options when performing a merge operation.
IOStatus(bool success=false)
Definition: GA_Detail.h:1898
#define GA_INVALID_INDEX
Definition: GA_Types.h:675
SYS_FORCE_INLINE T & x()
Definition: UT_Vector3.h:511
GA_Size destroyPoints(const GA_Range &range, GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES, bool guarantee_no_vertex_references=false)
Definition: GA_Detail.h:646
SYS_FORCE_INLINE GA_Attribute * findAttribute(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringRef &name)
Definition: GA_Detail.h:1026
bool getPos3AsArray(const GA_Range &ptrange, UT_Array< UT_Vector3T< T > > &positions) const
Definition: GA_Detail.h:182
GLuint64EXT * result
Definition: glew.h:14007
void destroyStashed()
Definition: GA_Detail.h:155
SYS_FORCE_INLINE void forEachPrimitive(const GA_PrimitiveGroup *group, bool complement, FUNCTOR &&functor) const
Definition: GA_Detail.h:1520
getOption("OpenEXR.storage") storage
Definition: HDK_Image.dox:276
GA_PrimitiveGroupTable & primitiveGroups()
Definition: GA_Detail.h:1123
Container class for all geometry.
Definition: GA_Detail.h:95
bool isPrimary() const
Definition: GA_Detail.h:2254
GA_Size destroyVertices(const GA_Range &range)
Definition: GA_Detail.h:658
SYS_FORCE_INLINE bool destroyAttribute(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringRef &name)
Definition: GA_Detail.h:873
SYS_FORCE_INLINE void forEachPrimitive(const GA_PrimitiveGroup *group, FUNCTOR &&functor) const
Definition: GA_Detail.h:1511
SYS_FORCE_INLINE GA_Attribute * findVertexAttribute(GA_AttributeScope s, const UT_StringRef &name)
Definition: GA_Detail.h:1042
UT_UniquePtr< GA_PointGroup > GA_PointGroupUPtr
virtual void privateComputeNormal(const GA_RWHandleV3 &normalattrib, const GA_Group *group, const float cuspangledegrees, const int method) const
Definition: GA_Detail.h:2355
const GA_AttributeDict & getAttributeDict(GA_AttributeOwner owner) const
Definition: GA_Detail.h:775
SYS_FORCE_INLINE GA_Offset vertexOffset(GA_Index index) const
Given a vertex's index (in append order), return its data offset.
Definition: GA_Detail.h:466
const GA_PrimitiveGroupTable & primitiveGroups() const
Definition: GA_Detail.h:1125
GA_VertexGroup * newVertexGroup(const UT_StringHolder &name)
Definition: GA_Detail.h:1235
SYS_FORCE_INLINE const GA_Attribute * findAttribute(const UT_StringRef &name, const GA_AttributeOwner search_order[], int search_size) const
Definition: GA_Detail.h:960
SYS_FORCE_INLINE const GA_Attribute * findPointAttribute(GA_AttributeScope s, const UT_StringRef &name) const
Definition: GA_Detail.h:977
GA_Range getPrimitiveRange(const GA_PrimitiveGroup *group=0) const
Get a range of all primitives in the detail.
Definition: GA_Detail.h:1669
SYS_FORCE_INLINE const GA_VertexGroup * findVertexGroup(const UT_StringRef &name) const
Definition: GA_Detail.h:1193
void setPos2(GA_Offset ptoff, const UT_Vector2 &P)
Set P from a UT_Vector2.
Definition: GA_Detail.h:200
Class to specify options for loading geometry.
SYS_FORCE_INLINE bool destroyElementGroup(GA_AttributeOwner owner, const char *name)
Definition: GA_Detail.h:1182
static void forEachOffset(FUNCTOR &&functor, const GA_IndexMap &index_map, const GA_ElementGroup *group=nullptr, bool complement=false)
Definition: GA_Detail.h:1549
SYS_FORCE_INLINE void forEachOffsetBreak(FUNCTOR &&functor) const
Definition: GA_IndexMap.h:528
SYS_FORCE_INLINE GA_Offset pointOffset(GA_Index index) const
Given a point's index (in append order), return its data offset.
Definition: GA_Detail.h:296
GLsizei const GLfloat * value
Definition: glew.h:1849
unsigned int uint
Definition: SYS_Types.h:45
GLint level
Definition: glew.h:1252
bool getPrimitivesOfType(const GA_PrimitiveTypeId &type, UT_Array< const GA_Primitive * > &prims) const
Definition: GA_Detail.h:2229
GLfloat GLfloat GLfloat GLfloat v3
Definition: glew.h:1860
GA_Storage
Definition: GA_Types.h:49
void setPos4(GA_Offset ptoff, const UT_Vector4 &P)
Set P from a UT_Vector4.
Definition: GA_Detail.h:258
UT_UniquePtr< GA_ATINumeric > GA_ATINumericUPtr
const GA_PrimitiveFactory & getPrimitiveFactory() const
Definition: GA_Detail.h:2180
SYS_FORCE_INLINE GA_Attribute * findVertexAttribute(const UT_StringRef &name)
Definition: GA_Detail.h:1046
GA_Attribute * createTupleAttribute(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringHolder &name, GA_Storage storage, int tuple_size, const GA_Defaults &defaults=GA_Defaults(0.0f), const UT_Options *create_args=nullptr, const GA_AttributeOptions *attribute_options=nullptr)
Definition: GA_Detail.h:897
GA_Attribute * getPwAttribute()
Definition: GA_Detail.h:245
UT_UniquePtr< GA_EdgeGroup > GA_EdgeGroupUPtr
Definition: GA_EdgeGroup.h:457
bool containsOnlyPrimitiveTypes(const UT_Array< GA_PrimitiveTypeId > &type) const
Definition: GA_Detail.h:2222
GA_Attribute * createAttribute(GA_AttributeOwner owner, GA_AttributeScope scope, const UT_StringHolder &name, const UT_Options *create_args, const GA_AttributeOptions *attribute_options, const UT_StringRef &attribtype)
Definition: GA_Detail.h:807
const GA_IntrinsicManager & getIntrinsicManager() const
Definition: GA_Detail.h:1354
SYS_FORCE_INLINE GA_Offset offsetSize() const
Definition: GA_IndexMap.h:97
const char * getIntrinsicName(GA_LocalIntrinsic h) const
Definition: GA_Detail.h:1368
SYS_FORCE_INLINE GA_Offset appendVertexBlock(GA_Size nvertices)
Append new vertices, returning the first offset of the contiguous block.
Definition: GA_Detail.h:451
GA_Offset primitiveBegin() const
Definition: GA_Detail.h:721
GLboolean GLuint group
Definition: glew.h:2745
GLboolean GLboolean g
Definition: glew.h:9477
GA_Attribute * createStringAttribute(GA_AttributeOwner owner, const UT_StringHolder &name, const UT_Options *create_args=nullptr, const GA_AttributeOptions *attribute_options=nullptr)
Definition: GA_Detail.h:937
SYS_FORCE_INLINE GA_Size getNumPoints() const
Return the number of points.
Definition: GA_Detail.h:285
GLintptr offset
Definition: glew.h:1682