HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEO_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: Geometry Library (C++)
7  *
8  * COMMENTS:
9  * This defines the detail class (the container for all points/primitives)
10  */
11 
12 #ifndef __GEO_Detail_h__
13 #define __GEO_Detail_h__
14 
15 #include "GEO_API.h"
16 #include "GEO_PrimList.h"
17 #include "GEO_PrimTypeCompat.h"
18 
19 #include <GA/GA_Defaults.h>
20 #include <GA/GA_Detail.h>
21 #include <GA/GA_ElementGroup.h>
22 #include <GA/GA_GBMacros.h> // for convenience of GEO_Detail.h includers
23 #include <GA/GA_Handle.h>
24 #include <GA/GA_IntrinsicManager.h>
25 #include <GA/GA_Range.h>
26 #include <GA/GA_ReuseStrategy.h>
27 #include <GA/GA_Types.h>
28 
29 #include <UT/UT_Array.h>
30 #include <UT/UT_Color.h>
31 #include <UT/UT_Matrix3.h>
32 #include <UT/UT_Matrix4.h>
33 #include <UT/UT_Vector3.h>
34 #include <UT/UT_VectorTypes.h>
35 #include <SYS/SYS_Deprecated.h>
36 #include <SYS/SYS_Inline.h>
37 #include <SYS/SYS_Types.h>
38 
39 #include <iosfwd>
40 
41 template<typename T> class UT_BoundingBoxT;
43 class UT_BoundingSphere;
44 class UT_IStream;
45 class UT_MemoryCounter;
46 class UT_Options;
47 class UT_OptionsHolder;
48 template <typename T> class UT_QuaternionT;
49 class UT_Ramp;
50 class UT_String;
51 class UT_StringArray;
52 class UT_StringHolder;
53 template<typename T> class UT_StringMap;
54 class UT_StringRef;
55 class UT_XformOrder;
58 class GA_AttributeDict;
59 class GA_AttributeFilter;
61 class GA_AttributeRefMap;
62 class GA_Breakpoint;
63 class GA_BreakpointGroup;
64 class GA_EdgeGroup;
65 class GA_ElementGroup;
66 class GA_Group;
67 class GA_IntrinsicEval;
68 class GA_LoadOptions;
69 class GA_PointWrangler;
70 namespace GA_PrimCompat { class TypeMask; }
71 class GA_Primitive;
73 class GA_SaveOptions;
74 class GA_Stat;
75 class GA_VertexWrangler;
76 
78 class GEO_Delta;
79 class GEO_MirrorParms;
81 class GEO_Primitive;
82 class GEO_Rolloff;
83 class GEO_Vertex;
84 
85 template<typename T, bool B> class GA_EdgeT;
87 
88 
89 //
90 // these are the names of standard attributes
91 //
92 
93 #define GEO_STD_ATTRIB_POSITION "P"
94 #define GEO_STD_ATTRIB_NORMAL "N"
95 #define GEO_STD_ATTRIB_TEXTURE "uv"
96 #define GEO_STD_ATTRIB_VELOCITY "v"
97 #define GEO_STD_ATTRIB_ANGULAR_VELOCITY "w"
98 #define GEO_STD_ATTRIB_MATERIAL "shop_materialpath"
99 #define GEO_STD_ATTRIB_OGLSHOP "ogl_shop"
100 #define GEO_STD_ATTRIB_DIFFUSE "Cd"
101 #define GEO_STD_ATTRIB_ALPHA "Alpha"
102 #define GEO_STD_ATTRIB_COM "com"
103 #define GEO_STD_ATTRIB_DISTANCE "dist"
104 #define GEO_STD_ATTRIB_LOD "lod"
105 #define GEO_STD_ATTRIB_REST "rest"
106 #define GEO_STD_ATTRIB_MASS "mass"
107 #define GEO_STD_ATTRIB_DRAG "drag"
108 #define GEO_STD_ATTRIB_TENSION "tension"
109 #define GEO_STD_ATTRIB_SPRINGK "springk"
110 #define GEO_STD_ATTRIB_LIFE "life"
111 #define GEO_STD_ATTRIB_AGE "age"
112 #define GEO_STD_ATTRIB_DIST "dist"
113 #define GEO_STD_ATTRIB_UP "up"
114 #define GEO_STD_ATTRIB_ORIENT "orient"
115 #define GEO_STD_ATTRIB_ID "id"
116 #define GEO_STD_ATTRIB_PSCALE "pscale"
117 #define GEO_STD_ATTRIB_CREASE "creaseweight"
118 #define GEO_STD_ATTRIB_AREA "area"
119 #define GEO_STD_ATTRIB_PERIMETER "perimeter"
120 #define GEO_STD_ATTRIB_WIDTH "width"
121 #define GEO_STD_ATTRIB_LAYERMERGE "layermerge"
122 #define GEO_STD_ATTRIB_SEGS "segs"
123 #define GEO_STD_ATTRIB_DIV "div"
124 #define GEO_STD_ATTRIB_LAGE "lage"
125 #define GEO_STD_ATTRIB_ARC "arc"
126 #define GEO_STD_ATTRIB_GEN "gen"
127 #define GEO_STD_ATTRIB_TUBECAPTURE "tubeCapt"
128 #define GEO_STD_ATTRIB_PNT_CAPTURE_ALPHA "pCaptAlpha"
129 #define GEO_STD_ATTRIB_PNT_CAPTURE_PATH "pCaptPath"
130 #define GEO_STD_ATTRIB_PNT_CAPTURE_DATA "pCaptData"
131 #define GEO_STD_ATTRIB_CAPTUREFRAME "pCaptFrame"
132 #define GEO_STD_ATTRIB_CAPT_SKELROOT "pCaptSkelRoot"
133 #define GEO_STD_ATTRIB_CLOTH_CAPT "clothCapt"
134 #define GEO_STD_ATTRIB_WIRE_CAPT_U "wireCaptU"
135 #define GEO_STD_ATTRIB_WIRE_CAPT_V "wireCaptV"
136 #define GEO_STD_ATTRIB_WIRE_CAPT_PRIMU "wireCaptPrimU"
137 #define GEO_STD_ATTRIB_META_CAPT_FRAME "metaCaptFrame"
138 #define GEO_STD_ATTRIB_META_CAPT_GROUPS "metaCaptGroups"
139 #define GEO_STD_ATTRIB_META_CAPT_ROOT "metaCaptRoot"
140 #define GEO_STD_ATTRIB_META_CAPT_PATHS "metaCaptPaths"
141 #define GEO_STD_ATTRIB_META_CAPT_DATA "metaCaptData"
142 #define GEO_STD_ATTRIB_META_CAPT_GROUP_MAP "metaCaptGroupMap"
143 #define GEO_STD_ATTRIB_META_SLIDE "slideModifier"
144 #define GEO_STD_ATTRIB_INFLATE_MODIFIER "inflatemodifier"
145 #define GEO_STD_ATTRIB_MUSCLE_REST_ANCHOR "restAnchor"
146 #define GEO_STD_ATTRIB_MUSCLE_REST_XFORMS "restTransforms"
147 #define GEO_STD_ATTRIB_MUSCLE_INFLATE_NORM "muscleInflateNormal"
148 #define GEO_STD_ATTRIB_MUSCLE_POSITION_BIAS "positionbiasvalues"
149 #define GEO_STD_ATTRIB_MUSCLE_CAPT_NAMES "muscleCaptNames"
150 #define GEO_STD_ATTRIB_RIXLATE "rixlate"
151 #define GEO_STD_ATTRIB_DEFORM_SKIN_METHOD "deformSkinMethod"
152 #define GEO_STD_ATTRIB_DEFORM_DUAL_QUATERNION_BLEND_ATTRIB "deformDualQuaternionBlendAttrib"
153 #define GEO_STD_ATTRIB_DEFORM_TRANSFORMS_PATH "deformTransformsPath"
154 #define GEO_STD_ATTRIB_DEFORM_TRANSFORM_REGIONS_PATH "deformTransformRegionsPath"
155 #define GEO_STD_ATTRIB_DEFORM_TRANSFORM_TARGETS_PATH "deformTransformTargetsPath"
156 #define GEO_STD_ATTRIB_POSE_SHAPE_EXAMPLE_PATH "poseShapeExamplePath"
157 #define GEO_STD_ATTRIB_SHAPE_DIFF_METHOD "shapeDiffMethod"
158 #define GEO_STD_ATTRIB_SHAPE_DIFF_ORIENT_ATTRIB "shapeDiffOrientAttrib"
159 #define GEO_STD_ATTRIB_SHAPE_DIFF_TRANSFORM_ATTRIB "shapeDiffTransformAttrib"
160 #define GEO_STD_ATTRIB_STASH_POSE_PATH "stashPosePath"
161 
162 /* Update the getStandardAttributes method when adding attribs */
163 /* These become the indices into the "context" detail attribute to
164  * look up when doing a getStandardAttribute */
166 {
202 };
203 
205 {
209 };
210 
212 {
217 };
218 
220 {
225 };
226 
228 {
231 };
232 
234 {
237 };
238 
239 /// An enum for GEO_Detail::copy's method parameter.
245 };
246 
248 {
249 public:
251  bool full_topology=true);
252  ~GEO_Detail() override;
253 
254  /// Compute memory usage (includes all shared memory)
255  int64 getMemoryUsage(bool inclusive) const override;
256 
257  /// Count memory usage using a UT_MemoryCounter in order to count
258  /// shared memory correctly.
259  /// If inclusive is true, the size of this object is counted,
260  /// else only memory owned by this object is counted.
261  /// If this is pointed to by the calling object, inclusive should be true.
262  /// If this is contained in the calling object, inclusive should be false.
263  /// (Its memory was already counted in the size of the calling object.)
264  void countMemory(UT_MemoryCounter &counter, bool inclusive) const override;
265 
266  /// Clear all the points/primitives out of this detail
268  {
269  clearCaches();
272  }
273 
274  /// Merge the whole detail, or only a group of prims, or only some points.
275  ///
276  /// If a @c primGroup is given, only the primitives in that group will be
277  /// merged into this detail. Only points referenced by the primitives will
278  /// be merged. The @c primGroup should exist on the @c src detail.
279  ///
280  /// Primitives will be appended to the primitive list unless @c
281  /// insertPrimsAtHead is set.
282  ///
283  /// If @c mergePrimGroup is set, primitive groups will be copied from the
284  /// source detail. If @c keep_internal_groups is true, @b all groups
285  /// will be copied, not just public primitive groups.
286  ///
287  /// If @c data_id_strategy is GA_DATA_ID_CLONE and it's a full merge into
288  /// an empty detail, any attributes whose source has a valid data id will
289  /// inherit that data id. Otherwise, each merged attribute will get a new
290  /// unique data id if this detail is generating such.
291  ///
292  void merge(const GEO_Detail &src,
293  const GA_PrimitiveGroup *primGrp = nullptr,
294  bool mergePrimGroup = true,
295  bool insertPrimsAtHead= false,
296  bool keep_internal_groups = true,
297  GA_DataIdStrategy data_id_strategy = GA_DATA_ID_BUMP);
298 
299  /// Merge points from the source detail into this detail.
300  ///
301  /// If the @c ptGrp group is specified, only points in the @c src detail's
302  /// group will be merged.
303  ///
304  /// If @c merge_groups is set, point groups will be copied from the source
305  /// detail. If @c keep_internal_groups is set, @b all groups will be
306  /// copied (not just public point groups).
307  void mergePoints(const GEO_Detail &src,
308  const GA_PointGroup *ptGrp = 0,
309  bool merge_groups = true,
310  bool keep_internal_groups = true);
311 
312  /// Merge only a group of points.
313  void mergePoints(const GEO_Detail &src, const GA_Range &points);
314 
315  /// Merge only a group of prims.
316  void mergePrimitives(const GEO_Detail &src, const GA_Range &prims);
317 
318  /// Merge a single primitive into this detail.
319  void merge(const GEO_Primitive &sprim, bool insertPrimAtHead=false);
320 
321  /// Copy the source detail into this detail.
322  ///
323  /// If @c data_id_strategy is GA_DATA_ID_CLONE and method is GEO_COPY_ONCE,
324  /// any attributes whose source has a valid data id will inherit that data
325  /// id. Otherwise, each merged attribute will get a new unique data id if
326  /// this detail is generating such.
327  bool copy(const GEO_Detail &src, GEO_CopyMethod method = GEO_COPY_ONCE,
328  bool this_parameter_is_ignored = true,
329  bool keep_internal_groups = true,
330  GA_DataIdStrategy data_id_strategy = GA_DATA_ID_BUMP);
331 
332  void collapseIndexAttributes();
333 
334  /// Mirrors a portion of the gdp across some plane
335  void mirror(GEO_MirrorParms &parms);
336 
337  /// Transform a range of primitives. Note that this will only transform
338  /// the points used by the primitives.
339  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
340  template<typename FLOAT_T>
341  void transform(const UT_Matrix4T<FLOAT_T> &mat,
342  const GA_Range &primitives,
343  bool just_P,
344  bool keep_vector_lengths = true,
345  bool check_pasting = true,
346  bool neg_determinant_flip_vector = true,
347  bool update_ptnormals = false,
348  GEO_Delta *geodelta = nullptr,
349  bool updateaffectednormals = false,
350  const char *attribpattern = nullptr);
351  /// Transform a range of primitives & points.
352  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
353  template<typename FLOAT_T>
354  void transform(const UT_Matrix4T<FLOAT_T> &mat,
355  const GA_Range &primitives,
356  const GA_Range &points,
357  bool just_P,
358  bool keep_vector_lengths = true,
359  bool check_pasting = true,
360  bool neg_determinant_flip_vector = true,
361  bool update_ptnormals = false,
362  GEO_Delta *geodelta = nullptr,
363  bool updateaffectednormals = false,
364  const char *attribpattern = nullptr);
365 
366 
367  /// Transform/translate all or some of the primitives. The methods will run
368  /// more efficiently if you happen to know the point closure apriori.
369  /// If 'just_P' is true, we only transform P, and not other attributes,
370  /// and don't check for reflection matrix.
371  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
372  template<typename FLOAT_T>
373  void transform(const UT_Matrix4T<FLOAT_T> &mat,
374  const GA_PrimitiveGroup *primGrp = 0,
375  const GA_PointGroup *pointClosure = 0,
376  bool just_P = false,
377  bool keep_vector_lengths = true,
378  bool check_pasting = true,
379  bool neg_determinant_flipvector = true,
380  bool update_ptnormals = false,
381  GEO_Delta *geodelta = 0,
382  bool updateaffectednormals = false,
383  const char *attribpattern = nullptr);
384 
385  // We transform from min_ptnum to max_ptnum *inclusive*.
386  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
387  template<typename FLOAT_T>
388  void transformRange(const UT_Matrix4T<FLOAT_T> &mat,
389  GA_Index min_ptnum, GA_Index max_ptnum,
390  GA_Index min_primnum, GA_Index max_primnum,
391  bool just_P = false,
392  bool keep_vector_lengths = true,
393  bool check_pasting = true,
394  bool neg_determinant_flipvector = true,
395  bool update_ptnormals = false,
396  GEO_Delta *geodelta = 0,
397  bool updateaffectednormals = false,
398  const char *attribpattern = nullptr);
399 
400  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
401  template<typename FLOAT_T>
402  void translate(const UT_Vector3T<FLOAT_T> &delta,
403  const GA_PrimitiveGroup *primGrp = 0,
404  const GA_PointGroup *pointClosure = 0,
405  bool check_pasting = true,
406  bool update_ptnormals = false,
407  GEO_Delta *geodelta = 0,
408  bool updateaffectednormals = false,
409  const char *attribpattern = nullptr);
410 
411  /// Transform all range of the points.
412  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
413  template<typename FLOAT_T>
414  void transformPoints(const UT_Matrix4T<FLOAT_T> &mat,
415  const GA_Range &points,
416  bool just_P = false,
417  bool keep_vector_lengths = true,
418  bool check_pasting = true,
419  bool neg_determinant_flipvector = true,
420  bool update_ptnormals = false,
421  GEO_Delta *geodelta = 0,
422  bool updateaffectednormals = false,
423  const char *attribpattern = nullptr);
424  /// Transform/translate all or some of the points.
425  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
426  template<typename FLOAT_T>
427  void transformPoints(const UT_Matrix4T<FLOAT_T> &mat,
428  const GA_PointGroup *pointGroup = 0,
429  const GA_PrimitiveGroup *primClosure = 0,
430  bool just_P = false,
431  bool keep_vector_lengths = true,
432  bool check_pasting = true,
433  bool neg_determinant_flipvector = true,
434  bool update_ptnormals = false,
435  GEO_Delta *geodelta = 0,
436  bool updateaffectednormals = false,
437  const char *attribpattern = nullptr);
438 
439  /// Transform a range of points by an attrib which stores a matrix4
440  /// for each point.
441  template <typename FLOAT_T, bool INVERT=false>
442  void transformPointsByAttribute(
443  const GA_ROHandleT<UT_Matrix4T<FLOAT_T> > &xformhandle,
444  const GA_Range &points,
445  bool keep_vector_lengths = true,
446  bool updateaffectednormals = true,
447  const char *attribpattern = nullptr);
448 
449  /// Rotates/shears all the attributes by a matrix3 for each point.
450  /// Note: Does not scale/rotate GA_TYPE_POINT/GA_TYPE_HPOINT.
451  template <typename FLOAT_T, bool INVERT=false>
452  void transformPointsByAttribute(
453  const GA_ROHandleT<UT_Matrix3T<FLOAT_T> > &xformhandle,
454  const GA_Range &points,
455  bool keep_vector_lengths = true,
456  bool updateaffectednormals = true,
457  const char *attribpattern = nullptr);
458 
459  /// Rotates all the attributes by a quaternion for each point.
460  /// Note: Does not rotate GA_TYPE_POINT/GA_TYPE_HPOINT.
461  template <typename FLOAT_T, bool INVERT=false>
462  void transformPointsByAttribute(
463  const GA_ROHandleT<UT_QuaternionT<FLOAT_T> > &xformhandle,
464  const GA_Range &points,
465  bool keep_vector_lengths = true,
466  bool updateaffectednormals = true,
467  const char *attribpattern = nullptr);
468 
469  /// Translates all the attributes by a displacement for each point.
470  /// Note: Only affects GA_TYPE_POINT/GA_TYPE_HPOINT.
471  template <typename FLOAT_T, bool INVERT=false>
472  void translatePointsByAttribute(
473  const GA_ROHandleT<UT_Vector3T<FLOAT_T> > &xformhandle,
474  const GA_Range &points,
475  bool keep_vector_lengths = true,
476  bool updateaffectednormals = true,
477  const char *attribpattern = nullptr);
478 
479  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
480  template<typename FLOAT_T>
481  void translatePoints(const UT_Vector3T<FLOAT_T> &delta,
482  const GA_PointGroup *pointGroup = 0,
483  bool check_pasting = true,
484  bool update_ptnormals = false,
485  GEO_Delta *geodelta = 0,
486  bool updateaffectednormals = false,
487  const char *attribpattern = nullptr);
488 
489  /// Transforms edges, calls transformPoints on the point closure of the
490  /// edges.
491  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
492  template<typename FLOAT_T>
493  void transformEdges(const UT_Matrix4T<FLOAT_T> &mat,
494  const GA_EdgeGroup *edgegrp = 0,
495  const GA_PrimitiveGroup *primclosure = 0,
496  bool just_P = false,
497  bool keep_vector_lengths = true,
498  bool check_pasting = true,
499  bool neg_determinant_flipvector = true,
500  bool update_ptnormals = false,
501  GEO_Delta *geodelta = 0,
502  bool updateaffectednormals = false,
503  const char *attribpattern = nullptr);
504 
505  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
506  template<typename FLOAT_T>
507  void translateEdges(const UT_Vector3T<FLOAT_T> &delta,
508  const GA_EdgeGroup *edgegrp = 0,
509  bool check_pasting = true,
510  bool update_ptnormals = false,
511  GEO_Delta *geodelta = 0,
512  bool updateaffectednormals = false,
513  const char *attribpattern = nullptr);
514 
515  /// Transforms breakpoints
516  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
517  template<typename FLOAT_T>
518  void transformBreakpoints(const UT_Matrix4T<FLOAT_T> &mat,
519  const GA_BreakpointGroup *grp = 0,
520  bool just_P = false,
521  bool update_ptnormals = false,
522  GEO_Delta *geodelta = 0,
523  bool updateaffectednormals = false,
524  const char *attribpattern = nullptr);
525 
526  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
527  template<typename FLOAT_T>
528  void translateBreakpoints(const UT_Vector3T<FLOAT_T> &delta,
529  const GA_BreakpointGroup *grp = 0,
530  bool update_ptnormals = false,
531  GEO_Delta *geodelta = 0,
532  bool updateaffectednormals = false,
533  const char *attribpattern = nullptr);
534 
535  /// Convenience function, will call the appropriate transform/translate
536  /// depending on the type of group
537  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
538  template<typename FLOAT_T>
539  void transformGroup(const UT_Matrix4T<FLOAT_T> &mat,
540  const GA_Group &grp,
541  bool just_P = false,
542  bool keep_vector_lengths = true,
543  bool check_pasting = true,
544  bool neg_determinant_flipvector = true,
545  const GA_PointGroup *ptclosure = 0,
546  const GA_PrimitiveGroup *primclosure = 0,
547  bool update_ptnormals = false,
548  GEO_Delta *geodelta = 0,
549  bool updateaffectednormals = false,
550  const char *attribpattern = nullptr);
551 
552  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
553  template<typename FLOAT_T>
554  void translateGroup(const UT_Vector3T<FLOAT_T> &delta,
555  const GA_Group &grp,
556  bool check_pasting = true,
557  const GA_PointGroup *ptclosure = 0,
558  bool update_ptnormals = false,
559  GEO_Delta *geodelta = 0,
560  bool updateaffectednormals = false,
561  const char *attribpattern = nullptr);
562 
563  void visualizeSoftPoints(const GEO_Rolloff &rolloff,
564  const GA_PointGroup *ptgroup,
565  UT_ColorRamp ramp);
566 
567  /// Class for passing symmetry arguments to certain soft transform related
568  /// methods.
570  {
571  public:
572  bool operator==(const SoftSymmetryParms &other) const
573  {
574  return myNormal == other.myNormal
575  && myOrigin == other.myOrigin
576  && myTol == other.myTol;
577  }
578 
579  bool operator!=(const SoftSymmetryParms &other) const
580  {
581  return !(*this == other);
582  }
583 
584  UT_Vector3 myNormal; // assumed to be normalized!
586  float myTol;
587  };
588 
589  // this function is outdated, GUsurfaceDistance should be used
590  /// symmetry - the soft falloff from any points not directly on the plane
591  /// of symmetry will be clamped to that plane of symmetry when
592  /// provided
593  /// affected_group - if provided, all points within the soft falloff
594  /// will be added to this group
595  void computeSoftPointFalloff(
596  const bool connected,
597  const fpreal radius,
598  const GEO_Rolloff *rolloff,
599  const GA_PointGroup *ptgroup,
600  const SoftSymmetryParms *symmetry,
601  const GA_RWHandleF &falloff,
602  const GA_ROHandleV3 &p_attrib,
603  GA_PointGroup* affected_group = nullptr,
604  GA_RWHandleID* source_points = nullptr) const;
605 
606  /// The computeNormal methods compute the normals of primitives, points,
607  /// edges and breakpoints. The primitive one is there for completeness.
608  /// An edge normal is the average of its primitive normals.
609 
610  /// For internal functions:
611  /// If nml_offset > -1, the attribute at that offset will be returned,
612  /// else if the geometry has a normal attribute ("N"), nml_offset
613  /// will be set to the offset of that attribute and that attributes
614  /// value will be returned,
615  /// else if the geometry has an internal normal attribute ("internalN")
616  /// the value of the internal attribute will be returned and
617  /// nml_offset will be set to its offset,
618  /// else the "internalN" attribute is created by a call to normal(1),
619  /// nml_offset is set to it, and the calculated value returned.
620  /// If nml_offset is null, the case of nml_offset == -1 is followed
621  /// except nml_offset is not written to.
622  /// Otherwise:
623  /// Recompute the normal. No side-effects happen, but this is much
624  /// slower.
625 
626  /// A faster version of computeNormal which has the side effect of
627  /// computing the internal normal if it's not there
628  void computeNormalInternal(GA_Offset ptoff, UT_Vector3 &nml);
629 
630  /// This is the same as prim.computeNormal()
631  void computeNormal(const GEO_Primitive &prim, UT_Vector3 &nml) const;
632  void computeNormal(const GA_Edge &edge, UT_Vector3 &nml) const;
633 
634  /// WARNING: This could be very slow! Are you sure you need no side-effects?
635  /// See computeNormalInternal!
636  void computeNormal(const GA_Breakpoint &bkpt, UT_Vector3 &nml) const;
637 
638  /// Compute the normal, and (optionally) tangents, at the specified
639  /// breakpoint. An extension of computeNormal() that also computes
640  /// partial tangents.
641  void computeNormalAndTangents(const GA_Breakpoint &bkpt,
642  UT_Vector3 &nml,
643  UT_Vector3 *u_tangent,
644  UT_Vector3 *v_tangent,
645  bool normalize) const;
646 
647  /// The normalTranslate* methods translate points, prims, edges or
648  /// breakpoints along each of their normals.
649  void normalTranslatePoints(float length = 1.0F,
650  int check_pasting = 1,
651  const GA_PointGroup *grp = 0,
652  int update_ptnormals = 0,
653  GEO_Delta *geodelta = 0,
654  bool updateaffectednormals = false);
655  void normalTranslatePrimitives(float length = 1.0F,
656  int check_pasting = 1,
657  const GA_PrimitiveGroup *grp = 0,
658  int update_ptnormals = 0,
659  GEO_Delta *geodelta = 0,
660  bool updateaffectednormals = false);
661  void normalTranslate(const GA_PointGroup &grp,
662  float length = 1.0F, int check_pasting = 1,
663  int update_ptnormals = 0,
664  GEO_Delta *geodelta = 0,
665  bool updateaffectednormals = false);
666  void normalTranslate(const GA_PrimitiveGroup &grp,
667  float length = 1.0F, int check_pasting = 1,
668  int update_ptnormals = 0,
669  GEO_Delta *geodelta = 0,
670  bool updateaffectednormals = false);
671  void normalTranslate(const GA_EdgeGroup &grp,
672  float length = 1.0F, int check_pasting = 1,
673  int update_ptnormals = 0,
674  GEO_Delta *geodelta = 0,
675  bool updateaffectednormals = false);
676  void normalTranslate(const GA_BreakpointGroup &grp,
677  float length = 1.0F, int check_pasting = 1,
678  int update_ptnormals = 0,
679  GEO_Delta *geodelta = 0,
680  bool updateaffectednormals = false);
681  void normalTranslateGroup(const GA_Group &grp,
682  float length = 1.0F, int check_pasting = 1,
683  int update_ptnormals = 0,
684  GEO_Delta *geodelta = 0,
685  bool updateaffectednormals = false);
686 
687  /// Update the point normals that are affected by a transform
688  /// applied to a given point group. If the transform is the same
689  /// everywhere, only points on the boundary will be recomputed.
690  /// Also recomputes vertex normals.
691  /// See GEOcomputeNormals() as well.
692  void updateAffectedNormals(const GA_Range &ptrange,
693  GEO_Delta *geodelta = 0,
694  bool allsametransform = false);
695 
696  /// Slide edges along adjacent primitive edges. The transform matrix is
697  /// used to compute translation deltas for the edge endpoints.
698  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
699  template<typename FLOAT_T>
700  void slideTransformEdges(const UT_Matrix4T<FLOAT_T> &mat,
701  const GA_EdgeGroup *edgegrp = 0,
702  const GA_PrimitiveGroup *primclosure = 0,
703  bool just_P = false,
704  bool keep_vector_lengths = true,
705  bool check_pasting = true,
706  bool neg_determinant_flipvector = true,
707  bool update_ptnormals = false,
708  GEO_Delta *geodelta = 0,
709  bool updateaffectednormals = false);
710 
711  /// Slide points across the face of adjacent primitives.
712  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
713  template<typename FLOAT_T>
714  void slideTransformPoints(const UT_Matrix4T<FLOAT_T> &mat,
715  const GA_PointGroup *ptgrp = 0,
716  const GA_PrimitiveGroup *primclosure = 0,
717  bool just_P = false,
718  bool keep_vector_lengths = true,
719  bool check_pasting = true,
720  bool neg_determinant_flipvector = true,
721  bool update_ptnormals = false,
722  GEO_Delta *geodelta = 0,
723  bool updateaffectednormals = false,
724  GEO_PointSliderCache *slider_cache = 0);
725 
726  /// Slide primitives (by their points) across the face of adjacent
727  /// primitives.
728  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
729  template<typename FLOAT_T>
730  void slideTransformPrimitives(const UT_Matrix4T<FLOAT_T> &mat,
731  const GA_PrimitiveGroup *primgrp = 0,
732  const GA_PointGroup *ptclosure = 0,
733  bool just_P = false,
734  bool keep_vector_lengths = true,
735  bool check_pasting = true,
736  bool neg_determinant_flipvector = true,
737  bool update_ptnormals = false,
738  GEO_Delta *geodelta = 0,
739  bool updateaffectednormals = false,
740  GEO_PointSliderCache *slider_cache = 0);
741 
742  /// Convenience function, will call the appropriate slide transform
743  /// depending on the type of group
744  /// Don't use update_ptnormals, except for compatibility; use updateaffectednormals.
745  /// The GEO_PointSliderCache argument is unused for edge groups.
746  template<typename FLOAT_T>
747  void slideTransformGroup(const UT_Matrix4T<FLOAT_T> &mat,
748  const GA_Group &grp,
749  bool just_P = false,
750  bool keep_vector_lengths = true,
751  bool check_pasting = true,
752  bool neg_determinant_flipvector = true,
753  const GA_PointGroup *ptclosure = 0,
754  const GA_PrimitiveGroup *primclosure = 0,
755  bool update_ptnormals = false,
756  GEO_Delta *geodelta = 0,
757  bool updateaffectednormals = false,
758  GEO_PointSliderCache *slider_cache = 0);
759 
760 
761  /// Class for passing local context arguments to certain softTransform*()
762  /// methods.
763  template <typename FLOAT_T>
765  {
766  public:
767  // Enum for flagging how the coordinate frame is specified.
768  enum class Type
769  { LOOKAT, ORIENT };
770 
771  // Enum for flagging whether the pivot transform is specified in
772  // global or local space.
773  enum class PivotSpace
774  { GLOBAL, LOCAL };
775 
776  /// Coordinate frame defined by lookat(zero, forward, up).
778  const UT_Vector3T<FLOAT_T> &up,
779  PivotSpace pivot_space)
780  : myFwdVector(forward), myUpVector(up), myType(Type::LOOKAT),
781  myPivotSpace(pivot_space) {}
782 
783  /// Coordinate frame defined by an orient (rotate) matrix and origin.
784  /// The orient matrix should transform row vector coordinates in the
785  /// local basis to the standard world basis.
787  const UT_Vector3T<FLOAT_T> &origin,
788  PivotSpace pivot_space)
789  : myOrient(orient), myOrigin(origin), myType(Type::ORIENT),
790  myPivotSpace(pivot_space) {}
791 
792  // These two members are only set when myType == Type::LOOKAT.
795 
796  // These two members are only set when myType == Type::ORIENT.
799 
802  };
806 
807  /// Perform the transformation given by t*, s*, p*, s_*, in the
808  /// coordinate frame described by local_frame.
809  template<typename FLT>
810  static
811  UT_Matrix4T<FLT> localSpaceXformMatrix(const UT_XformOrder &order,
813  &local_frame,
814  FLT tx, FLT ty, FLT tz,
815  FLT rx, FLT ry, FLT rz,
816  FLT sx, FLT sy, FLT sz,
817  FLT s_xy, FLT s_xz, FLT s_yz,
818  FLT px, FLT py, FLT pz,
819  FLT prx, FLT pry, FLT prz);
820 
821  /// Transform points using soft-selections (proportional xform):
822  /// symmetry - the soft falloff from any points not directly on the plane
823  /// of symmetry will be clamped to that plane of symmetry when
824  /// provided
825  /// falloff_output - any non-zero falloffs used during this call will be
826  /// written to this attribute when provided
827  /// falloff_written - will be set to true when provided if falloff_output
828  /// is provided, and this call did not skip processing
829  /// any non-zero falloffs. If not set, you must call
830  /// computeSoftPointFalloff() to obtain the falloffs.
831  void softTransformPoints(
832  const UT_XformOrder &order,
833  float tx, float ty, float tz,
834  float rx, float ry, float rz,
835  float sx, float sy, float sz,
836  float s_xy, float s_xz, float s_yz,
837  float px, float py, float pz,
838  float prx, float pry, float prz,
839  const GEO_Rolloff &rolloff,
840  const GA_PointGroup *ptgroup = 0,
841  const SoftSymmetryParms *symmetry = 0,
842  int just_P = 0,
843  int keep_vector_lengths = 1,
844  int check_pasting = 1,
845  int neg_determinant_flipvector = 1,
846  int update_ptnormals = 0,
847  GEO_Delta *geodelta = 0,
848  bool updateaffectednormals = false,
849  const char *attribpattern = nullptr,
850  const GA_RWHandleF *falloff_output = nullptr,
851  bool *falloff_written = nullptr);
852  void softTransformEdges(
853  const UT_XformOrder &order,
854  float tx, float ty, float tz,
855  float rx, float ry, float rz,
856  float sx, float sy, float sz,
857  float s_xy, float s_xz, float s_yz,
858  float px, float py, float pz,
859  float prx, float pry, float prz,
860  const GEO_Rolloff &rolloff,
861  const GA_EdgeGroup *edgegrp = 0,
862  const SoftSymmetryParms *symmetry = 0,
863  int just_P = 0,
864  int keep_vector_lengths = 1,
865  int check_pasting = 1,
866  int neg_determinant_flipvector = 1,
867  int update_ptnormals = 0,
868  GEO_Delta *geodelta = 0,
869  bool updateaffectednormals = false,
870  const char *attribpattern = nullptr,
871  const GA_RWHandleF *falloff_output = nullptr,
872  bool *falloff_written = nullptr);
873 
874  void softTransformPoints(
875  const LocalXformContextF *local,
876  const UT_XformOrder &order,
877  float tx, float ty, float tz,
878  float rx, float ry, float rz,
879  float sx, float sy, float sz,
880  float s_xy, float s_xz, float s_yz,
881  float px, float py, float pz,
882  float prx, float pry, float prz,
883  const GEO_Rolloff &rolloff,
884  const GA_PointGroup *ptgroup = 0,
885  const SoftSymmetryParms *symmetry = 0,
886  int just_P = 0,
887  int keep_vector_lengths = 1,
888  int check_pasting = 1,
889  int neg_determinant_flipvector = 1,
890  int update_ptnormals = 0,
891  GEO_Delta *geodelta = 0,
892  bool updateaffectednormals = false,
893  const char *attribpattern = nullptr,
894  const GA_RWHandleF *falloff_output = nullptr,
895  bool *falloff_written = nullptr);
896  void softTransformEdges(
897  const LocalXformContextF *local,
898  const UT_XformOrder &order,
899  float tx, float ty, float tz,
900  float rx, float ry, float rz,
901  float sx, float sy, float sz,
902  float s_xy, float s_xz, float s_yz,
903  float px, float py, float pz,
904  float prx, float pry, float prz,
905  const GEO_Rolloff &rolloff,
906  const GA_EdgeGroup *edgegrp = 0,
907  const SoftSymmetryParms *symmetry = 0,
908  int just_P = 0,
909  int keep_vector_lengths = 1,
910  int check_pasting = 1,
911  int neg_determinant_flipvector = 1,
912  int update_ptnormals = 0,
913  GEO_Delta *geodelta = 0,
914  bool updateaffectednormals = false,
915  const char *attribpattern = nullptr,
916  const GA_RWHandleF *falloff_output = nullptr,
917  bool *falloff_written = nullptr);
918 
919  /// Translate points using soft-selections (proportional xlate):
920  /// symmetry - the soft falloff from any points not directly on the plane
921  /// of symmetry will be clamped to that plane of symmetry when
922  /// provided
923  /// falloff_output - any non-zero falloffs used during this call will be
924  /// written to this attribute when provided
925  /// falloff_written - will be set to true when provided if falloff_output
926  /// is provided, and this call did not skip processing
927  /// any non-zero falloffs. If not set, you must call
928  /// computeSoftPointFalloff() to obtain the falloffs.
929  void softTranslatePoints(
930  const UT_Vector3 &delta,
931  const GEO_Rolloff &rolloff,
932  const GA_PointGroup *ptgroup = 0,
933  const SoftSymmetryParms *symmetry = 0,
934  int check_pasting = 1,
935  int update_ptnormals = 0,
936  GEO_Delta *geodelta = 0,
937  bool updateaffectednormals = false,
938  const char *attribpattern = nullptr,
939  const GA_RWHandleF *falloff_output = nullptr,
940  bool *falloff_written = nullptr);
941  void softTranslateEdges(
942  const UT_Vector3 &delta,
943  const GEO_Rolloff &rolloff,
944  const GA_EdgeGroup *edgegrp = 0,
945  const SoftSymmetryParms *symmetry = 0,
946  int check_pasting = 1,
947  int update_ptnormals = 0,
948  GEO_Delta *geodelta = 0,
949  bool updateaffectednormals = false,
950  const char *attribpattern = nullptr,
951  const GA_RWHandleF *falloff_output = nullptr,
952  bool *falloff_written = nullptr);
953 
954  /// Translate points along their normals using soft-selections
955  /// symmetry - the soft falloff from any points not directly on the plane
956  /// of symmetry will be clamped to the plane of symmetry when
957  /// provided
958  /// falloff_output - any non-zero falloffs used during this call will be
959  /// written to this attribute when provided
960  /// falloff_written - will be set to true when provided if falloff_output
961  /// is provided, and this call did not skip processing
962  /// any non-zero falloffs. If not set, you must call
963  /// computeSoftPointFalloff() to obtain the falloffs.
964  void softNormalTranslatePoints(
965  float distance,
966  const GEO_Rolloff &rolloff,
967  const GA_PointGroup *ptgroup = nullptr,
968  const SoftSymmetryParms *symmetry = nullptr,
969  int along_lead_normal = 1,
970  int check_pasting = 1,
971  int update_ptnormals = 0,
972  GEO_Delta *geodelta = nullptr,
973  bool updateaffectednormals = false,
974  const GA_RWHandleF *falloff_output = nullptr,
975  bool *falloff_written = nullptr);
976 
977  /// Add and compute normal attributes. Returns the normal attribute.
978  /// If given a primgroup, only points within the selection are used
979  /// in the calculation, all others are zeroed.
980  GA_Attribute *normal(bool internal = false,
981  const GA_PrimitiveGroup *primgroup = nullptr);
982 
983  /// Return normals computed from the geometry, ignoring the "N" attribute.
984  void normal(UT_Vector3Array &output, bool use_internaln = true) const;
985  void normal(UT_Vector3DArray &output, bool use_internaln = true) const;
986 
987  /// Compute normals into the existing attribute given. The attribute
988  /// can be detached, and the detail won't ever be modified.
989  void normal(const GA_RWHandleV3 &attrib,
990  const GA_PrimitiveGroup *primgroup = nullptr) const;
991 
992  /// Add and compute vertex normal attributes. Returns the normals.
993  void getVertexNormals(UT_Vector3Array &output) const;
994 
995  /// Methods for manipulating capture weights (GEO_CaptureWeight.C)
997  {
998  CAPTURE_BONE = 0,
1002  CAPTURE_MUSCLE
1003  };
1004 
1005  /// Get the name of the point attribute which contains (region, weight)
1006  /// pairs of capture data.
1007  static const UT_StringHolder
1008  &getPointCaptureAttribName(CaptureType type);
1009 
1010  /// Get the name of the property which contains an index of
1011  /// region names (like capture regions and metaball groups). Returns nullptr
1012  /// if no such region mapping exists for a type.
1013  static const char *getPointCaptureIndexPropertyName(CaptureType type);
1014 
1015  /// Get the name of the detail attribute for capture frame. Returns nullptr
1016  /// if a capture type doesn't use capture frame.
1017  static const UT_StringHolder
1018  &getPointCaptureFrameAttribName(CaptureType type);
1019 
1020  /// Get the name of the detail attribute for capture root. Returns nullptr
1021  /// if a capture type doesn't use capture frame.
1022  static const UT_StringHolder
1023  &getPointCaptureRootAttribName(CaptureType type);
1024 
1025  /// Get the name of the property for capture data (usually,
1026  /// a linear array of transformation matrices + possibly other data).
1027  /// Returns nullptr if a capture type doesn't use a capture data attribute.
1028  static const char *getPointCaptureDataPropertyName(CaptureType type);
1029 
1030  // Get the cregion root path. Returns true if successful with the value
1031  // in root_path.
1032  bool getCaptureRegionRootPath(UT_String &root_path,
1033  CaptureType t = CAPTURE_BONE) const;
1034  bool setCaptureRegionRootPath(const UT_String &root_path,
1035  CaptureType t = CAPTURE_BONE);
1036 
1037  /// Given a string representing a capture region for type t, return that
1038  /// region's index. -1 is returned if no index exists.
1039  int getCaptureRegionIndex(const UT_String &cregion_name,
1040  CaptureType t = CAPTURE_BONE);
1041 
1042  /// Add a new bone capture region. Sets the detail's capture transforms
1043  /// for the new region. Returns the index for this new region or -1 for
1044  /// failure.
1045  int addCaptureRegion(const UT_String &cregion_name,
1046  const UT_Matrix4 &parent_xform,
1047  const GEO_Detail *tube_gdp);
1048  int addCaptureRegion(const UT_String &cregion_name,
1049  const UT_Matrix4 &xform, float tcap, float bcap,
1050  float taperx, float taperz);
1051 
1052  /// Add a non-bone capture capture region of type type to this detail.
1053  /// Returns the index for this new region, or -1 for failure.
1054  int addCaptureRegion(const UT_String &cregion_name,
1055  CaptureType type);
1056 
1057  /// Delete a capture region (detail and point attributes) data.
1058  /// Return index of deleted attribute, -1 if cannot delete capture region
1059  int removeCaptureRegion(const UT_String &cregion_name,
1060  CaptureType t = CAPTURE_BONE);
1061 
1062  /// Set the capture weight on a group of points
1063  void setCaptureWeight(int cregion_index, float weight,
1064  const GA_PointGroup *ptgroup = nullptr,
1065  GEO_Delta *geodelta = nullptr,
1066  bool add_weight = false,
1067  bool clamp_negative = false,
1068  bool normalizeweight = false,
1069  CaptureType t = CAPTURE_BONE);
1070 
1071  /// Set the capture weight on a point
1072  void setCaptureWeight(int cregion_index, float weight,
1073  GA_Offset ptoff,
1074  GEO_Delta *geodelta = nullptr,
1075  bool add_weight = false,
1076  bool clamp_negative = false,
1077  bool normalizeweight = false,
1078  CaptureType t = CAPTURE_BONE);
1079 
1080  /// Get the capture weight of a point
1081  float getCaptureWeight(int cregion_index, GA_Offset ptoff,
1082  CaptureType t = CAPTURE_BONE) const;
1083 
1084  /// Get the average capture weight of a set of points
1085  bool addAverageCaptureWeight(const GA_PointGroup *ptgroup,
1086  const UT_String &root_path,
1087  UT_StringMap<float *> &averages ) const;
1088 
1089  void getCaptureWeights(GA_Offset ptoff, UT_IntArray &regions,
1090  UT_FloatArray &weights,
1091  CaptureType t = CAPTURE_BONE) const;
1092  void clearCaptureWeights(GA_Offset ptoff,
1093  CaptureType t = CAPTURE_BONE);
1094 
1096  {
1098  VISTYPE_MULTIPLE
1099  };
1100 
1101  /// Color points according to their capture (normalized) weight
1102  void colorPointsByCaptureWeight(
1103  const UT_Array<const UT_Vector3 *> &colors,
1104  const UT_Vector3 &zero_weight_color,
1105  CaptureType t = CAPTURE_BONE,
1106  VisualizationType vistype = VISTYPE_MULTIPLE,
1107  UT_ColorRamp singlevismode = UT_COLORRAMP_FALSE);
1108 
1109  /// Color points according to their capture weight, with option to
1110  /// normalize the weights for visualization.
1111  void colorPointsByCaptureWeight(
1112  const UT_Array<const UT_Vector3 *> &colors,
1113  const UT_Vector3 &zero_weight_color,
1114  CaptureType t,
1115  VisualizationType vistype,
1116  UT_ColorRamp singlevismode,
1117  bool normalize);
1118 
1119  void normalizeCaptureWeights(const GA_PointGroup *ptgroup = nullptr,
1120  CaptureType t = CAPTURE_BONE,
1121  fpreal tolerance = SYS_FTOLERANCE_R);
1122 
1123  /// clamp the capture weights to the given low/hi values, if the
1124  /// corresponding flag is true and the capture weight is below/above
1125  /// the corresponding threshold. If low/hi flag is false, the capture
1126  /// weight will be unaffected for respecive clamping.
1127  void clampCaptureWeights(const GA_PointGroup *ptgroup = nullptr,
1128  bool clamp_low_flag = true,
1129  float low_threshold = 0.0f, float low_val = 0.0f,
1130  bool clamp_hi_flag = false,
1131  float hi_threshold = 1.0f, float hi_val = 1.0f,
1132  CaptureType t = GEO_Detail::CAPTURE_BONE);
1133 
1134  /// This specifies a capture index that is exempt from normalization.
1135  void normalizeRelativeCaptureWeights(int idx, GA_Offset ptoff,
1136  GEO_Delta *delta=nullptr);
1137 
1138  ///
1139  /// Methods for adding to the point list.
1140  ///
1141  GA_Offset insertPointOffset(GA_Index beforeWhich = GA_INVALID_INDEX);
1144  /// Insert a point, copying data from the source point. If the @c
1145  /// beforeWhich index isn't specified, the point will be added at the
1146  /// end of the point list.
1147  GA_Offset insertPointCopy(GA_Offset src,
1148  GA_PointWrangler &wrangler,
1149  GA_Index beforeWhich = GA_INVALID_INDEX);
1150  /// Insert a point, copying data from the source point. If the @c
1151  /// beforeWhich index isn't specified, the point will be added at the
1152  /// end of the point list.
1153  /// @note It is more efficient to use the GA_PointWrangler version.
1154  GA_Offset insertPointCopy(GA_Offset src,
1155  GA_Index beforeWhich = GA_INVALID_INDEX);
1156 
1157  /// Append a point, copying data from the source point.
1159  { return insertPointCopy(src, wrangler); }
1160  /// Append a point, copying data from the source point.
1161  /// @note It is more efficient to use the GA_PointWrangler version.
1163  { return insertPointCopy(src); }
1164 
1165  /// Provide a few additional overloads of deletePoints() in addition
1166  /// to those available in GA_Detail.
1168  GA_Size deletePoints(const GA_PointGroup &point_group,
1169  GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES)
1170  {
1171  return destroyPoints(GA_Range(point_group), mode);
1172  }
1173 
1174  /// Get a GEO_Primitive pointer by primitive offset
1175  /// @{
1178  {
1179  if (!GAisValid(primoff))
1180  return nullptr;
1181  // reinterpret_cast to avoid including header
1182  return reinterpret_cast<GEO_Primitive*>(
1183  getPrimitive(primoff));
1184  }
1187  {
1188  if (!GAisValid(off))
1189  return nullptr;
1190  return reinterpret_cast<const GEO_Primitive*>(
1191  getPrimitive(off));
1192  }
1193  /// @}
1194 
1195  /// Get a GEO_Primitive pointer by primitive index
1196  /// @{
1198  {
1199  if (!GAisValid(idx))
1200  return nullptr;
1201  return reinterpret_cast<GEO_Primitive*>(
1202  getPrimitiveByIndex(idx));
1203  }
1205  {
1206  if (!GAisValid(idx))
1207  return nullptr;
1208  return reinterpret_cast<const GEO_Primitive*>(
1209  getPrimitiveByIndex(idx));
1210  }
1211  /// @}
1212 
1213  /// @{
1214  /// GA uses "destroy" instead of "delete" as the verb. However, the old
1215  /// GEO/GB code made extensive use of "delete". These methods are to save
1216  /// the sanity of people trying to port code.
1218  GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES)
1219  { return destroyPoints(range, mode); }
1220  GA_Size deletePrimitives(const GA_Range &range, bool and_points=false)
1221  { return destroyPrimitives(range, and_points); }
1222  bool deletePrimitive(GA_Primitive &prim, bool and_points=false)
1223  { return destroyPrimitive(prim, and_points); }
1224  /// @}
1225 
1226  /// Inserting and appending a new primitive
1227  /// Insertion works the same way as insertion of points. However, the
1228  /// primitive is not allocated beforehand, leaving this to the allocator.
1229  /// If the source primitive is from another detail, our primitive attribute
1230  /// dictionary must be an extension of that detail's (see
1231  /// sortAllAttributes()). Note that this last condition is the reverse of
1232  /// that for inserting or appending a copy of a point.
1233  GEO_Primitive *insertPrimitive(const GA_PrimitiveTypeId &type,
1234  const GEO_Primitive *beforeWhich = nullptr);
1237  {
1238  // NOTE: This is not a static_cast to avoid needing the definition
1239  // of GEO_Primitive.
1240  return (GEO_Primitive *) GA_Detail::appendPrimitive(type);
1241  }
1242 
1243  /// Provide a few additional overloads of deletePrimitives() in addition
1244  /// to those available in GA_Detail.
1245  GA_Size deletePrimitives(const GA_PrimitiveGroup &primGrp,
1246  bool and_points = false);
1247  GA_Size deletePrimitives(
1248  const UT_Array<GEO_Primitive*> &prims_in,
1249  bool and_points = false);
1250 
1251  /// Delete a whole group of breakpoints.
1252  /// @note The group is cleared when done (non-const operation)
1253  virtual void deleteBreakpoints(const GA_BreakpointGroup &bkptgrp);
1254 
1255  // Find the bounding box (optionally of a group of primitives)
1256  // instantiation. Returns false if the box is empty and true otherwise.
1257  bool getBBox(UT_BoundingBox *bbox,
1258  const GA_PrimitiveGroup *g = nullptr) const;
1259 
1260  /// Find the bounding box (optionally of a group of primitives) of
1261  /// transformed instantiation. Returns false if the box is empty and true
1262  /// otherwise.
1263  bool getBBox(UT_BoundingBox &bbox,
1264  const UT_Matrix4R &transform,
1265  const GA_PrimitiveGroup *g = nullptr) const;
1266 
1267  /// Find bounding box of visible primitives.
1268  /// Returns false if the box is empty and true otherwise.
1269  bool getVisibleBBox(
1270  UT_BoundingBox *bbox,
1271  const UT_Matrix4R *transform = nullptr,
1272  const GA_PrimitiveGroup *g = nullptr) const;
1273 
1274  bool getBSphere(UT_BoundingSphere *bsphere,
1275  const GA_PrimitiveGroup *g = nullptr,
1276  bool accurate_bounds = false) const;
1277 
1278  /// Find the bounding box (optionally of a group of points)
1279  /// instantiation. Returns false if the box is empty and true otherwise.
1280  bool getPointBBox(
1281  UT_BoundingBox *bbox,
1282  const GA_PointGroup *g = nullptr) const;
1283  bool getPointBBox(
1284  UT_BoundingBox& bbox,
1285  const UT_Matrix4R &transform,
1286  const GA_PointGroup *g = nullptr) const;
1287  bool getPointBSphere(
1288  UT_BoundingSphere *bsphere,
1289  const GA_PointGroup *g = nullptr,
1290  bool accurate_bounds = false) const;
1291  bool getVertexBBox(
1292  UT_BoundingBox *bbox,
1293  const GA_VertexGroup *g = nullptr) const;
1294  bool getVertexBBox(
1295  UT_BoundingBox& bbox,
1296  const UT_Matrix4R &transform,
1297  const GA_VertexGroup *g = nullptr) const;
1298  bool getEdgeBBox(
1299  UT_BoundingBox &bbox,
1300  const GA_EdgeGroup &grp) const;
1301  bool getEdgeBBox(
1302  UT_BoundingBox &bbox,
1303  const UT_Matrix4R &transform,
1304  const GA_EdgeGroup &grp) const;
1305  bool getEdgeBSphere(
1306  UT_BoundingSphere &bsphere,
1307  const GA_EdgeGroup &grp,
1308  bool accurate_bounds = false) const;
1309  bool getBreakpointBBox(
1310  UT_BoundingBox &bbox,
1311  const GA_BreakpointGroup &grp) const;
1312  bool getBreakpointBBox(
1313  UT_BoundingBox &bbox,
1314  const UT_Matrix4R &transform,
1315  const GA_BreakpointGroup &grp) const;
1316  bool getBreakpointBSphere(
1317  UT_BoundingSphere &bsphere,
1318  const GA_BreakpointGroup &grp,
1319  bool accurate_bounds = false) const;
1320  bool getGroupBBox(
1321  UT_BoundingBox *bbox,
1322  const GA_Group *grp) const;
1323  bool getGroupBBox(
1324  UT_BoundingBox& bbox,
1325  const UT_Matrix4R &transform,
1326  const GA_Group *grp) const;
1327  bool getGroupBSphere(
1328  UT_BoundingSphere *bsphere,
1329  const GA_Group *grp,
1330  bool accurate_bounds) const;
1331 
1332  /// The following method computes either a 2D or 3D bounding box
1333  /// for the specified float attribute.
1334  bool getPointAttribBBox(
1335  const UT_StringRef &name,
1336  UT_BoundingBox *bbox,
1337  const GA_PointGroup *g = nullptr) const;
1338  bool getPointAttribBBox(
1339  const UT_StringRef &name,
1340  UT_BoundingBox *bbox,
1341  const GA_PrimitiveGroup &g) const;
1342  bool getPointAttribBBox(
1343  const UT_StringRef &name,
1344  UT_BoundingBox *bbox,
1345  const GA_EdgeGroup &g) const;
1346  bool getPointAttribBBox(
1347  const UT_StringRef &name,
1348  UT_BoundingBox *bbox,
1349  const GA_VertexGroup &g) const;
1350 
1351  /// Compute the 3D centroid with the given attribute and group.
1352  /// typename T can either be single or double precision.
1353  /// Returns false if there are no points. Behaviour is undefined if the
1354  /// attribute has less than 3 components.
1355  template <typename T>
1356  bool getPointAttribCentroid(
1357  UT_Vector3T<T> &centroid,
1358  const GA_Attribute &attrib,
1359  const GA_PointGroup *grp = nullptr) const;
1360 
1361  bool getPointAttribGroupBBox(
1362  const UT_StringRef &name,
1363  UT_BoundingBox *bbox,
1364  const GA_Group *grp) const;
1365 
1366  bool getVertexAttribBBox(
1367  const UT_StringRef &name,
1368  UT_BoundingBox *bbox,
1369  const GA_PointGroup *g = nullptr) const;
1370  bool getVertexAttribBBox(
1371  const UT_StringRef &name,
1372  UT_BoundingBox *bbox,
1373  const GA_PrimitiveGroup &g) const;
1374  bool getVertexAttribBBox(
1375  const UT_StringRef &name,
1376  UT_BoundingBox *bbox,
1377  const GA_EdgeGroup &g) const;
1378  bool getVertexAttribBBox(
1379  const UT_StringRef &name,
1380  UT_BoundingBox *bbox,
1381  const GA_VertexGroup &g) const;
1382  bool getVertexAttribGroupBBox(
1383  const UT_StringRef &name,
1384  UT_BoundingBox *bbox,
1385  const GA_Group *grp) const;
1386 
1387  /// Copy vertex attributes from source to destination
1388  SYS_DEPRECATED_HDK(13.0)
1389  void copyVertexAttributes(GEO_Vertex dest,
1390  const GEO_Vertex &src) const;
1391  void copyVertexAttributes(GA_Offset dest, GA_Offset src,
1392  GA_VertexWrangler &wrangler) const;
1393  /// Copy vertex AND point attributes
1394  SYS_DEPRECATED_HDK(13.0)
1395  void copyPointVertexAttributes(GEO_Vertex dest,
1396  const GEO_Vertex &src,
1397  bool copy_point_P = true) const;
1398  void copyPointVertexAttributes(
1399  GA_Offset dest_vtx, GA_Offset src_vtx,
1400  const GA_AttributeRefMap &vertex_attribs,
1401  const GA_AttributeRefMap &point_attribs);
1402  void copyPointVertexAttributes(
1403  GA_Offset dest_vtx, GA_Offset src_vtx,
1404  GA_VertexWrangler &vertex_wrangler,
1405  GA_PointWrangler &point_wrangler,
1406  bool copy_point_P)
1407  {
1408  copyVertex(dest_vtx, src_vtx, vertex_wrangler,
1409  point_wrangler, copy_point_P);
1410  }
1411  /// Copy vertex attributes AND change the point reference of the vertex
1412  SYS_DEPRECATED_HDK(13.0)
1413  void copyFullVertex(GEO_Vertex dest,
1414  const GEO_Vertex &src) const;
1415  /// Copy vertex attributes AND change the point reference of the vertex
1416  void copyFullVertex(GA_Offset dest_vtx,
1417  GA_Offset src_vtx,
1418  GA_VertexWrangler &vertex_wrangler)
1419  {
1420  copyVertex(dest_vtx, src_vtx, vertex_wrangler,
1421  nullptr);
1422  }
1423  /// Copy primitive attributes
1424  void copyPrimitiveAttributes(GEO_Primitive &dest,
1425  const GEO_Primitive &src);
1426 
1427  void copyPrimitiveGroups(GEO_Primitive &dest,
1428  const GEO_Primitive &src) const;
1429 
1430  /// Create a copy of the source vertex. Regardless of the "shallow" parm,
1431  /// this method will copy the vertex attribute data. If not shallow, it
1432  /// will also copy the point attribute data and will assign the source
1433  /// point position to the destination point. If shallow, it will assign the
1434  /// source point offset to the destination.
1435  SYS_DEPRECATED_HDK(13.0)
1436  void copyVertex(GEO_Vertex dest, const GEO_Vertex &src,
1437  int shallow = 0) const;
1438 
1439  /// Inherit the simple version of copyVertex from GA_Detail.
1440  using GA_Detail::copyVertex;
1441 
1442  /// Create a copy of the source vertex, copying only the vertex attributes
1443  /// specified by "vertex_attribs" and only the point attributes specified
1444  /// by the optional "point_attribs". If "point_attribs" is nullptr, then a
1445  /// shallow point copy is performed wiring the source's point (if any) to
1446  /// dest.
1447  void copyVertex(GA_Offset dest, GA_Offset src,
1448  GA_AttributeRefMap &vertex_attribs,
1449  GA_AttributeRefMap *point_attribs);
1450 
1451  /// Create a copy of the source vertex using the supplied wranglers to
1452  /// copy attributes. If "point_wrangler" is nullptr, then a shallow point
1453  /// copy is performed, wiring the source's point (if any) to dest.
1454  void copyVertex(GA_Offset dest, GA_Offset src,
1455  GA_VertexWrangler &vertex_wrangler,
1456  GA_PointWrangler *point_wrangler);
1457 
1458  /// Create a copy of the source vertex using the supplied wranglers to
1459  /// copy attributes. Unlike the previous method which takes an optional
1460  /// "point_wrangler", this overload always performs a non-shallow point
1461  /// copy and specifies whether or not "P" should be copied, regardless of
1462  /// the setting of the point wrangler.
1463  void copyVertex(GA_Offset dest, GA_Offset src,
1464  GA_VertexWrangler &vertex_wrangler,
1465  GA_PointWrangler &point_wrangler,
1466  bool copy_point_p);
1467 
1468  /// The following method will fix all rational curve/patch weights by
1469  /// flagging the curve/patch appropriately. It is quite expensive since
1470  /// it traverses the entire primitive list. Only call it as a last resort.
1471  void fixSplineWeights();
1472 
1473  /// Some useful alias functions, they simplify your life a lot
1474  /// Attribute handling
1475  ///
1476  /// These alias methods return the offset of the (new) attribute, or -1 if
1477  /// they failed for some reason.
1478 
1479  GA_Attribute *addNormalAttribute(GA_AttributeOwner who,
1481  GA_Attribute *addTextureAttribute(GA_AttributeOwner who,
1482  GA_Storage s = GA_STORE_INVALID);
1483  GA_Attribute *addVelocityAttribute(GA_AttributeOwner who,
1484  GA_Storage s = GA_STORE_INVALID);
1485  GA_Attribute *addAngularVelocityAttribute(GA_AttributeOwner who,
1486  GA_Storage s = GA_STORE_INVALID);
1487  GA_Attribute *addOrientAttribute(GA_AttributeOwner who,
1488  GA_Storage s = GA_STORE_INVALID);
1489  GA_Attribute *addAlphaAttribute(GA_AttributeOwner who,
1490  GA_Storage s = GA_STORE_INVALID);
1491  GA_Attribute *addComAttribute(GA_AttributeOwner who,
1492  GA_Storage s = GA_STORE_INVALID);
1493  GA_Attribute *addDiffuseAttribute(GA_AttributeOwner who,
1494  GA_Storage s = GA_STORE_INVALID);
1495  GA_Attribute *addDistanceAttribute(GA_AttributeOwner who,
1496  GA_Storage s = GA_STORE_INVALID);
1497  GA_Attribute *addLODAttribute(GA_AttributeOwner who,
1498  GA_Storage s = GA_STORE_INVALID);
1499  GA_Attribute *addRestAttribute(GA_AttributeOwner who,
1500  GA_Storage s = GA_STORE_INVALID,
1501  const UT_StringHolder &name
1502  = UT_StringHolder::theEmptyString);
1503  GA_Attribute *addTubeCaptureAttribute(
1504  GA_Storage s = GA_STORE_INVALID);
1505 
1506  /// Add the detail's capture frame attribute for capture type t.
1507  GA_Attribute *addCaptureFrameAttribute(CaptureType t = CAPTURE_BONE,
1508  GA_Storage s = GA_STORE_INVALID);
1509 
1510  /// Add the bone capture skeleton root detail attribute.
1511  GA_Attribute *addCaptureSkelRootAttribute(CaptureType t
1512  = CAPTURE_BONE);
1513 
1514  /// Add a new custom (index, weight) point attribute.
1515  /// TODO: geo_NPairs is temporary to force examination of old signature
1516  /// uses, which took size in bytes instead of the # of pairs.
1518  {
1519  public:
1520  explicit geo_NPairs(int v) : myValue(v) {}
1521 
1522  int getValue() const { return myValue; }
1523  private:
1524  int myValue;
1525  };
1526  GA_Attribute *addPtIndexPairAttribute(const UT_StringHolder &name,
1527  geo_NPairs n_pairs,
1529  GA_Attribute *addIndexPairAttribute(GA_AttributeOwner owner,
1530  const UT_StringHolder &name,
1531  int n_pairs,
1533 
1534  /// Add the (index, weight) point attribute for capture type t.
1535  GA_Attribute *addPointCaptureAttribute(geo_NPairs n_pairs,
1536  CaptureType t = CAPTURE_BONE,
1537  GA_Storage s =
1539 
1540  /// Add the bone capture alpha point attribute.
1541  GA_Attribute *addPointCaptureAlphaAttribute(float dflt,
1543 
1544  const GA_Attribute *findNormalAttribute(GA_AttributeOwner who) const;
1545  GA_Attribute *findNormalAttribute(GA_AttributeOwner who);
1546  const GA_Attribute *findTextureAttribute(GA_AttributeOwner who) const;
1547  GA_Attribute *findTextureAttribute(GA_AttributeOwner who);
1548  const GA_Attribute *findVelocityAttribute(GA_AttributeOwner who) const;
1549  GA_Attribute *findVelocityAttribute(GA_AttributeOwner who);
1550  const GA_Attribute *findAlphaAttribute(GA_AttributeOwner who) const;
1551  GA_Attribute *findAlphaAttribute(GA_AttributeOwner who);
1552  const GA_Attribute *findComAttribute(GA_AttributeOwner who) const;
1553  GA_Attribute *findComAttribute(GA_AttributeOwner who);
1554  const GA_Attribute *findDiffuseAttribute(GA_AttributeOwner who) const;
1555  GA_Attribute *findDiffuseAttribute(GA_AttributeOwner who);
1556  const GA_Attribute *findDistanceAttribute(GA_AttributeOwner who) const;
1557  GA_Attribute *findDistanceAttribute(GA_AttributeOwner who);
1558  const GA_Attribute *findLODAttribute(GA_AttributeOwner who) const;
1559  GA_Attribute *findLODAttribute(GA_AttributeOwner who);
1560  const GA_Attribute *findRestAttribute(GA_AttributeOwner who) const;
1561  GA_Attribute *findRestAttribute(GA_AttributeOwner who);
1562  const GA_Attribute *findTubeCaptureAttribute() const;
1563  GA_Attribute *findTubeCaptureAttribute();
1564 
1565  /// Find the material attribute if it exists. This checks for the
1566  /// GEO_STD_ATTRIB_MATERIAL name.
1567  GA_ROHandleS findMaterialAttribute(GA_AttributeOwner who) const;
1568 
1569  /// The internal normal attribute is always a point attribute
1570  /// @todo Remove internalN code path with the H11 viewport?
1571  const GA_Attribute *findInternalNormalAttribute() const;
1572  GA_Attribute *findInternalNormalAttribute();
1573 
1574  /// Find the offset for the detail's capture frame attribute for capture
1575  /// type t.
1576  const GA_Attribute *findCaptureFrameAttribute(
1577  CaptureType t = CAPTURE_BONE) const;
1578  GA_Attribute *findCaptureFrameAttribute(
1579  CaptureType t = CAPTURE_BONE);
1580 
1581  /// Find the offset for the bone capture skeleton root detail attribute.
1582  const GA_Attribute *findCaptureSkelRootAttribute(CaptureType t
1583  = CAPTURE_BONE) const;
1584  GA_Attribute *findCaptureSkelRootAttribute(CaptureType t
1585  = CAPTURE_BONE);
1586 
1587  /// Find the offset for the (region, weight) point capture *point*
1588  /// attribute for capture type t.
1589  const GA_Attribute *findPointCaptureAttribute(
1590  CaptureType t = CAPTURE_BONE) const;
1591  GA_Attribute *findPointCaptureAttribute(
1592  CaptureType t = CAPTURE_BONE);
1593  /// Find the offset for the bone capture alpha point attribute.
1594  const GA_Attribute *findPointCaptureAlphaAttribute() const;
1595  GA_Attribute *findPointCaptureAlphaAttribute();
1596 
1597  /// Find the offset for a custom (index, weight) point attribute.
1598  const GA_Attribute *findPtIndexPairAttribute(const UT_StringRef &name) const;
1599  GA_Attribute *findPtIndexPairAttribute(const UT_StringRef &name);
1600 
1601  void destroyNormalAttribute(GA_AttributeOwner who);
1602  void destroyInternalNormalAttribute();
1603  void destroyTextureAttribute(GA_AttributeOwner who);
1604  void destroyVelocityAttribute(GA_AttributeOwner who);
1605  void destroyAlphaAttribute(GA_AttributeOwner who);
1606  void destroyComAttribute(GA_AttributeOwner who);
1607  void destroyDiffuseAttribute(GA_AttributeOwner who);
1608  void destroyDistanceAttribute(GA_AttributeOwner who);
1609  void destroyLODAttribute(GA_AttributeOwner who);
1610  void destroyRestAttribute(GA_AttributeOwner who);
1611  void destroyTubeCaptureAttribute();
1612 
1613  /// Destroy the detail's capture frame attribute for capture type t.
1614  void destroyCaptureFrameAttribute(CaptureType t
1615  = CAPTURE_BONE);
1616 
1617  /// Destroy the bone capture skeleton root detail attribute.
1618  void destroyCaptureSkelRootAttribute(CaptureType t
1619  = CAPTURE_BONE);
1620 
1621  /// Destroy the (region, weight) point capture *point* attribute for
1622  /// capture type t.
1623  void destroyPointCaptureAttribute(CaptureType t =
1624  CAPTURE_BONE);
1625 
1626  /// Destroy the bone capture alpha point attribute.
1627  void destroyPointCaptureAlphaAttribute();
1628 
1629  /// Destroy a custom (index, weight) point attribute.
1630  void destroyPtIndexPairAttribute(const UT_StringRef &name);
1631 
1632  /// Retrieve the restAnchor string attribute from this gdp, if
1633  /// it exists - return true if successful
1634  bool getMetaRestAnchorPath(UT_String &anchorPath) const;
1635 
1636  /// You should never assume that "uv" is textures!
1637  /// Note that Point capture is still special cased.
1638  /// If the supplied layer is <= 0, then the current layer is used.
1639  /// To extract all the layers names, one should do:
1640  /// for (layer = 1; layer <= getNumLayers(); layer++)
1641  /// layername[layer] = getStdAttributeName(..., layer);
1642  ///
1643  /// WARNING: The returned UT_StringHolder may own the string it references,
1644  /// so you *must* either assign it to a UT_StringHolder or UT_String,
1645  /// or pass it to a function that takes a UT_StringHolder, UT_StringRef,
1646  /// const UT_StringHolder&, or const UT_StringRef&.
1647  /// *DO* *NOT* assign it to a const char* variable! The UT_StringHolder
1648  /// will be destructed immediately after the assignment, deleting the
1649  /// string that the const char* points to!
1650  UT_StringHolder getStdAttributeName(GEO_Standard_Attributes name,
1651  int layer = -1) const;
1652  int getAttributeLayer(const char* attr_name) const;
1653 
1654  static GA_TypeInfo getStdAttributeTypeInfo(const char *name, int floattuplesize);
1655 
1656  /// These handle layers:
1657  int getCurrentLayer() const;
1658  void setCurrentLayer(int layer);
1659  void setNumLayers(int numlayer);
1660  int getNumLayers() const;
1661  /// These get and set the CURRENT layer's merge mode:
1662  void setLayerMerge(int preclear, int mask, int srcblend,
1663  int dstblend);
1664  void getLayerMerge(int &preclear, int &mask, int &srcblend,
1665  int &dstblend) const;
1666 
1667  void addVariableName(const char *attr, const char *varname);
1668  void removeVariableName(const char *varname)
1669  { addVariableName(0, varname); }
1670  /// This gets a raw list of the variable maps suitable for caching
1671  /// to see if they changed.
1672  void getVariableNameMap(UT_String &result) const;
1673 
1674  /// Traverses the variable name mappings currently present:
1675  void traverseVariableNames(int (*function)(const char *attr,
1676  const char *varname, void *data),
1677  void *data) const;
1678 
1679  /// increase the memory size of the attribute
1680  GA_Attribute *growPointCaptureAttribute(geo_NPairs num_added_pairs,
1681  CaptureType t = CAPTURE_BONE);
1682 
1685  {
1686  return getAttributes().cloneAttribute(
1688  src->getName(), *src, true);
1689  }
1692  const UT_StringHolder &n,
1693  const UT_Options *creation_args,
1694  const GA_AttributeOptions *attribute_options,
1695  const UT_StringRef &attribtype)
1696  {
1697  return createAttribute(GA_ATTRIB_POINT, scope, n,
1698  creation_args, attribute_options,attribtype);
1699  }
1702  const UT_Options *creation_args,
1703  const GA_AttributeOptions *attribute_options,
1704  const UT_StringRef &attribtype)
1705  {
1706  return createAttribute(GA_ATTRIB_POINT, n,
1707  creation_args, attribute_options,attribtype);
1708  }
1709 
1710  /// Replace old findPointAttribute(const char *name...) with
1711  /// findIntTuple(GA_ATTRIB_POINT, ...), findFloatTuple(),
1712  /// findStringTuple(), etc.
1715  { return findPointAttribute(src.getScope(),
1716  src.getName()); }
1719  { return findPointAttribute(src.getScope(),
1720  src.getName()); }
1721 
1722  /// Looks for a 3-float point attribute
1725  const UT_StringRef &n) const
1726  { return findFloatTuple(GA_ATTRIB_POINT, s, n, 3, 3); }
1729  { return findFloatTuple(GA_ATTRIB_POINT, n, 3, 3); }
1732  const UT_StringRef &n)
1733  { return findFloatTuple(GA_ATTRIB_POINT, s, n, 3, 3); }
1736  { return findFloatTuple(GA_ATTRIB_POINT, n, 3, 3); }
1737 
1740  const UT_StringRef &n,
1741  const GA_AttributeFilter *filter=nullptr)
1742  { destroyAttribute(GA_ATTRIB_POINT,scope, n, filter); }
1745  const GA_AttributeFilter *filter=nullptr)
1746  { destroyAttribute(GA_ATTRIB_POINT, n, filter); }
1747 
1748  bool promotePointAttrib(GA_AttributeScope scope,
1749  const UT_StringRef &name);
1752  { return promotePointAttrib(GA_SCOPE_PUBLIC, name); }
1753 
1756  {
1757  return getAttributes().cloneAttribute(
1759  src->getName(), *src, true);
1760  }
1763  const UT_Options *creation_args,
1764  const GA_AttributeOptions *attribute_options,
1765  const UT_StringRef &attribtype)
1766  {
1767  return createAttribute(GA_ATTRIB_VERTEX, scope, n,
1768  creation_args, attribute_options,attribtype);
1769  }
1772  const UT_Options *creation_args,
1773  const GA_AttributeOptions *attribute_options,
1774  const UT_StringRef &attribtype)
1775  {
1776  return createAttribute(GA_ATTRIB_VERTEX, n,
1777  creation_args, attribute_options,attribtype);
1778  }
1779 
1780  /// Replace old findVertexAttribute(const char *name...) with
1781  /// findIntTuple(GA_ATTRIB_VERTEX, ...), findFloatTuple(),
1782  /// findStringTuple(), etc.
1785  { return findVertexAttribute(src.getScope(),
1786  src.getName()); }
1789  { return findVertexAttribute(src.getScope(),
1790  src.getName()); }
1791 
1792  /// Looks for a 3-float vertex attribute
1795  const UT_StringRef &n) const
1796  { return findFloatTuple(GA_ATTRIB_VERTEX,s, n, 3, 3); }
1799  { return findFloatTuple(GA_ATTRIB_VERTEX, n, 3, 3); }
1802  const UT_StringRef &n)
1803  { return findFloatTuple(GA_ATTRIB_VERTEX,s, n, 3, 3); }
1806  { return findFloatTuple(GA_ATTRIB_VERTEX, n, 3, 3); }
1807 
1810  const UT_StringRef &n,
1811  const GA_AttributeFilter *filter=nullptr)
1812  { destroyAttribute(GA_ATTRIB_VERTEX,scope, n,filter); }
1815  const GA_AttributeFilter *filter=nullptr)
1816  { destroyAttribute(GA_ATTRIB_VERTEX, n, filter); }
1817 
1818  bool demoteVertexAttrib(GA_AttributeScope scope,
1819  const UT_StringRef &name);
1822  { return demoteVertexAttrib(GA_SCOPE_PUBLIC, name); }
1823 
1826  {
1827  return getAttributes().cloneAttribute(
1829  src->getName(), *src,true);
1830  }
1833  const UT_Options *creation_args,
1834  const GA_AttributeOptions *attribute_options,
1835  const UT_StringRef &attribtype)
1836  {
1837  return createAttribute(GA_ATTRIB_PRIMITIVE, scope,
1838  n, creation_args, attribute_options,attribtype);
1839  }
1842  const UT_Options *creation_args,
1843  const GA_AttributeOptions *attribute_options,
1844  const UT_StringRef &attribtype)
1845  {
1846  return createAttribute(GA_ATTRIB_PRIMITIVE, n,
1847  creation_args, attribute_options,attribtype);
1848  }
1849 
1850  /// Replace old findPrimAttribute(const char *name...) with
1851  /// findIntTuple(GA_ATTRIB_PRIMITIVE, ...), findFloatTuple(),
1852  /// findStringTuple(), etc.
1855  { return findPrimitiveAttribute(src.getScope(),
1856  src.getName()); }
1859  { return findPrimitiveAttribute(src.getScope(),
1860  src.getName()); }
1861 
1864  const UT_StringRef &n,
1865  const GA_AttributeFilter *filter=nullptr)
1866  {
1867  destroyAttribute(GA_ATTRIB_PRIMITIVE, scope, n,
1868  filter);
1869  }
1872  const GA_AttributeFilter *filter=nullptr)
1873  {
1874  destroyAttribute(GA_ATTRIB_PRIMITIVE, n, filter);
1875  }
1876 
1877  /// Note: if attrib already exists, will return pointer to existing
1878  /// attrib.
1881  {
1882  return getAttributes().cloneAttribute(
1884  src->getName(), *src, true);
1885  }
1888  const UT_StringHolder &n,
1889  const UT_Options *creation_args,
1890  const GA_AttributeOptions *attribute_options,
1891  const UT_StringRef &attribtype)
1892  {
1893  return createAttribute(GA_ATTRIB_DETAIL, scope, n,
1894  creation_args, attribute_options,attribtype);
1895  }
1898  const UT_Options *creation_args,
1899  const GA_AttributeOptions *attribute_options,
1900  const UT_StringRef &attribtype)
1901  {
1902  return createAttribute(GA_ATTRIB_DETAIL, n,
1903  creation_args, attribute_options,attribtype);
1904  }
1905 
1908  { return findGlobalAttribute(src.getScope(),
1909  src.getName()); }
1912  { return findGlobalAttribute(src.getScope(),
1913  src.getName()); }
1916  const UT_StringRef &n,
1917  const GA_AttributeFilter *filter=nullptr)
1918  { destroyAttribute(GA_ATTRIB_DETAIL,scope, n,filter); }
1921  const GA_AttributeFilter *filter=nullptr)
1922  { destroyAttribute(GA_ATTRIB_DETAIL, n, filter); }
1923 
1925  /// Query the internal structures:
1926  SYS_DEPRECATED_HDK(13.0)
1927  GEO_PrimList primitives()
1928  {
1929  return GEO_PrimList(getPrimitiveMap());
1930  }
1931  SYS_DEPRECATED_HDK(13.0)
1932  const GEO_PrimList primitives() const
1933  {
1934  return GEO_PrimList(getPrimitiveMap());
1935  }
1937 
1939  const GA_AttributeDict &pointAttribs() const
1940  { return getAttributes().getDict(
1941  GA_ATTRIB_POINT); }
1944  { return getAttributes().getDict(
1948  { return getAttributes().getDict(
1949  GA_ATTRIB_VERTEX); }
1951  const GA_AttributeDict &attribs() const
1952  { return getAttributes().getDict(
1953  GA_ATTRIB_DETAIL); }
1954 
1955  // Typedef for the GA_Detail::GB_MACRO_CAST static methods.
1957 
1958  bool hasMetaPrimitives() const;
1959  bool hasPastedPrimitives() const;
1960  bool hasQuadricPrimitives() const;
1961  bool hasParticlePrimitives() const;
1962  bool hasVolumePrimitives() const;
1963  bool hasChannelPrimitives() const;
1964  bool hasTransformingPrimitives() const;
1965 
1966  /// Check to see whether the detail has any custom primitive types (i.e.
1967  /// non-factory primitives)
1968  bool hasCustomPrimitives() const;
1969 
1970  GA_Size getMetaCount() const;
1971  GA_Size getPastedCount() const;
1972  GA_Size getQuadricCount() const;
1973  GA_Size getParticleCount() const;
1974  GA_Size getVolumeCount() const;
1975 
1976  // This function will find the GEO_Standard_Attributes enum that
1977  // matches the provided string s.
1978  // true is returned on if a match is found; false if no match.
1979  bool getStandardAttributes(const char *s, GEO_Standard_Attributes &a);
1980 
1981  bool mergeCaptureProperties(
1982  GA_Attribute *my_atr,
1983  const GA_Attribute *src_atr,
1984  UT_IntArray &new_indices);
1985 
1986  /// Methods for dealing with attribute handles. It is important to note
1987  /// that the const methods return READ-ONLY handles which will fail when
1988  /// any write methods are called.
1989  SYS_DEPRECATED_HDK(13.0)
1990  GEO_AttributeHandle getPointAttribute (const char *attrib_name) const;
1991  SYS_DEPRECATED_HDK(13.0)
1992  GEO_AttributeHandle getPointAttribute (const char *attrib_name);
1993  SYS_DEPRECATED_HDK(13.0)
1994  GEO_AttributeHandle getPrimAttribute (const char *attrib_name) const;
1995  SYS_DEPRECATED_HDK(13.0)
1996  GEO_AttributeHandle getPrimAttribute (const char *attrib_name);
1997  SYS_DEPRECATED_HDK(13.0)
1998  GEO_AttributeHandle getVertexAttribute(const char *attrib_name) const;
1999  SYS_DEPRECATED_HDK(13.0)
2000  GEO_AttributeHandle getVertexAttribute(const char *attrib_name);
2001  SYS_DEPRECATED_HDK(13.0)
2002  GEO_AttributeHandle getDetailAttribute(const char *attrib_name) const;
2003  SYS_DEPRECATED_HDK(13.0)
2004  GEO_AttributeHandle getDetailAttribute(const char *attrib_name);
2005  SYS_DEPRECATED_HDK(13.0)
2006  GEO_AttributeHandle getAttribute(GA_AttributeOwner dict,
2007  const char *attrib_name) const;
2008  SYS_DEPRECATED_HDK(13.0)
2009  GEO_AttributeHandle getAttribute(GA_AttributeOwner dict,
2010  const char *attrib_name);
2011 
2012  /// Change the storage type from one type to another. For example, cast an
2013  /// integer attribute into a floating point attribute, or vice versa.
2014  /// Only some casting methods have been implemented, so it's quite likely
2015  /// that this method may fail.
2016  bool changeAttributeStorage(GA_AttributeOwner dict,
2017  const UT_StringRef &name,
2018  GA_Storage new_storage);
2019  bool changePointAttributeStorage(const UT_StringRef &nm, GA_Storage s);
2020  bool changeVertexAttributeStorage(const UT_StringRef &nm, GA_Storage s);
2021  bool changePrimAttributeStorage(const UT_StringRef &nm, GA_Storage s);
2022  bool changeDetailAttributeStorage(const UT_StringRef &nm, GA_Storage s);
2023 
2024  /// @{
2025  /// Convenience functions to set a detail attribute to a specific
2026  /// value, and also create the attribute if it doesn't exist.
2027  /// Values will only be assigned to the first N tuple components. For
2028  /// example, for strings, only the first string value will be set, while
2029  /// for a vector2, only the first 2 components will be set.
2030  /// @note Storing a ramp will call the save() method on the UT_Ramp and
2031  /// assign that string to the attribute.
2032  /// @note If the attribute already exists but is the wrong type, or the
2033  /// attribute has too small a tuple size, this method will fail.
2034  bool setDetailAttributeS(const UT_StringHolder &aname, const char *value);
2035  bool setDetailAttributeS(const UT_StringHolder &aname, const UT_StringArray &s);
2036  bool setDetailAttributeR(const UT_StringHolder &aname, const UT_Ramp &ramp);
2037  bool setDetailAttributeF(const UT_StringHolder &aname, float v);
2038  bool setDetailAttributeF(const UT_StringHolder &aname, float v1, float v2);
2039  bool setDetailAttributeF(const UT_StringHolder &aname, const UT_Vector2 &v);
2040  bool setDetailAttributeF(const UT_StringHolder &aname, const UT_Vector3 &v);
2041  bool setDetailAttributeF(const UT_StringHolder &aname, const UT_Vector4 &v);
2042  bool setDetailAttributeF(const UT_StringHolder &aname, const UT_Matrix3 &v);
2043  bool setDetailAttributeF(const UT_StringHolder &aname, const UT_Matrix4 &v);
2044  bool setDetailAttributeI(const UT_StringHolder &aname, int v);
2045  /// @}
2046 
2047  /// @{
2048  /// Convenience routines to retrieve a group of points referenced
2049  /// by a range/group of primitives. These routines assume that the point
2050  /// group pointer is not nullptr and return the size of the resulting point
2051  /// group.
2052  GA_Size getPointGroupAdjacentToPrimitiveGroup(
2053  const GA_PrimitiveGroup *in_prim_grp,
2054  GA_PointGroup *adj_pt_grp);
2055  GA_Size getPointGroupAdjacentToPrimitiveRange(
2056  const GA_Range &in_prim_rng,
2057  GA_PointGroup *adj_pt_rng);
2058  GA_Size getVertexGroupAdjacentToPrimitiveGroup(
2059  const GA_PrimitiveGroup *in_prim_grp,
2060  GA_VertexGroup *adj_vtx_grp);
2061  GA_Size getVertexGroupAdjacentToPrimitiveRange(
2062  const GA_Range &in_prim_rng,
2063  GA_VertexGroup *adj_vtx_rng);
2064  /// @}
2065 
2066 private:
2067  struct AdjacentPolygonData
2068  {
2069  GA_Offset myAdjacentPolygon;
2070 
2071  bool operator==(const AdjacentPolygonData &pad) const
2072  { return myAdjacentPolygon == pad.myAdjacentPolygon; }
2073  bool operator<(const AdjacentPolygonData &pad) const
2074  { return myAdjacentPolygon < pad.myAdjacentPolygon; }
2075  };
2076 
2077 public:
2078 
2079  struct PointAdjacencyData : public AdjacentPolygonData
2080  {
2082  };
2083 
2084  struct EdgeAdjacencyData : public AdjacentPolygonData
2085  {
2089  };
2090 
2093 
2094  // Get an array of PointAdjacencyData structs representing the polygons
2095  // adjacent to a polygon (poly_off) through a point. Notice that
2096  // PointAdjacencyData contains a point shared by the two polygons
2097  GA_Size getPointAdjacentPolygons(GEO_PointAdjArray &adjacencies,
2098  GA_Offset poly_off) const;
2099 
2100  // Get an array of polygon Offsets adjacent to a polygon (poly_off)
2101  // through a point
2102  GA_Size getPointAdjacentPolygons(GA_OffsetArray &polygons,
2103  GA_Offset poly_off) const;
2104 
2105 
2106  // Get an array of EdgeAdjacencyData structs representing the polygons
2107  // adjacent to a polygon (poly_off) through an edge. Notice that
2108  // EdgeAdjacencyData contains additional information about the type of
2109  // adjacency
2110  GA_Size getEdgeAdjacentPolygons(GEO_EdgeAdjArray &adjacencies,
2111  GA_Offset poly_off) const;
2112 
2113  // Get an array of polygon Offsets adjacent to a polygon (poly_off)
2114  // through an edge
2115  GA_Size getEdgeAdjacentPolygons(GA_OffsetArray &polygons,
2116  GA_Offset poly_off) const;
2117 
2118  /// Searches primitive list for a primitive whose name attribute
2119  /// matches the given name.
2120  /// UT_String::multiMatch is used for comparison so searching
2121  /// for Cd.* will return as expected.
2122  /// Returns the matchnumberth matching primitive.
2123  const GEO_Primitive *findPrimitiveByName(const char *nametomatch,
2126  const char *nameattrib="name",
2127  int matchnumber = 0) const;
2128  GEO_Primitive *findPrimitiveByName(const char *nametomatch,
2131  const char *nameattrib="name",
2132  int matchnumber = 0);
2133 
2134  /// Like findPrimitiveByName, but adds all matching primitives to the list
2135  void findAllPrimitivesByName(
2137  const char *nametomatch,
2140  const char *nameattrib="name") const;
2141  void findAllPrimitivesByName(
2142  UT_Array<GEO_Primitive*> &primlist,
2143  const char *nametomatch,
2146  const char *nameattrib="name");
2147 
2148  /// Merges attributes from 'src' into this detail. Capture attributes for
2149  /// newly merged points are also updated. Newly merged points are
2150  /// identified by point numbers beginning from 'num_pts_prev'.
2151  void mergeDetailAttributes( const GEO_Detail &src,
2152  int num_pts_prev );
2153 
2155  { destroyElementGroup(g); }
2157  { destroyElementGroup(g); }
2159  { destroyElementGroup(g); }
2160  bool destroyPointGroup(const char *name)
2161  { return
2162  destroyElementGroup(GA_ATTRIB_POINT, name); }
2163  bool destroyPrimitiveGroup(const char *name)
2164  { return
2165  destroyElementGroup(GA_ATTRIB_PRIMITIVE, name); }
2166  bool destroyVertexGroup(const char *name)
2167  { return
2168  destroyElementGroup(GA_ATTRIB_VERTEX, name); }
2169 
2170  /// Attempt to copy groups from the source detail. If override is true,
2171  /// existing groups with the same names as src groups are cleared, else
2172  /// existing groups are not affected. The status (ordered/unordered,
2173  /// internal/persistent) of the source group is also copied.
2174  ///
2175  /// Membership is matched by element index for point and primitive groups,
2176  /// by primitive and local vertex index for vertex groups, and by element
2177  /// index validated by adjacency for edge groups.
2178  void mergeGroups(const GEO_Detail &src, bool override,
2179  unsigned mask = GA_GMASK_FULL_MASK);
2180  GA_PointGroup *mergeGroup(const GEO_Detail &src,
2181  const GA_PointGroup &group,
2182  bool override = true);
2183  GA_PrimitiveGroup *mergeGroup(const GEO_Detail &src,
2184  const GA_PrimitiveGroup &group,
2185  bool override = true);
2186  GA_VertexGroup *mergeGroup(const GEO_Detail &src,
2187  const GA_VertexGroup &group,
2188  GA_OffsetArray &map_cache,
2189  bool override = true);
2190  GA_EdgeGroup *mergeGroup(const GEO_Detail &src,
2191  const GA_EdgeGroup &group,
2192  bool override = true);
2193 
2194 protected:
2196  registerIntrinsics(GA_PrimitiveFactory &factory);
2197 
2198  GA_Size localIntrinsicTupleSize(
2199  GA_IntrinsicEval &eval) const override;
2200  GA_Size localGetIntrinsicS(GA_IntrinsicEval &eval,
2201  UT_String &value) const override;
2202  GA_Size localGetIntrinsicSA(GA_IntrinsicEval &eval,
2203  UT_StringArray &value) const override;
2204  GA_Size localGetIntrinsicD(GA_IntrinsicEval &eval,
2205  UT_OptionsHolder &value) const override;
2206  GA_Size localGetIntrinsicDA(GA_IntrinsicEval &eval,
2208  ) const override;
2209  GA_Size localGetIntrinsicI(GA_IntrinsicEval &eval,
2210  int64 *value, GA_Size size) const override;
2211  GA_Size localGetIntrinsicF(GA_IntrinsicEval &eval,
2212  fpreal64 *value, GA_Size size) const override;
2213  GA_Size localSetIntrinsicS(GA_IntrinsicEval &eval,
2214  const char *value) override;
2215  GA_Size localSetIntrinsicSA(GA_IntrinsicEval &eval,
2216  const UT_StringArray &value) override;
2217  GA_Size localSetIntrinsicSS(GA_IntrinsicEval &eval,
2218  const char **value, GA_Size size) override;
2219  GA_Size localSetIntrinsicDA(GA_IntrinsicEval &eval,
2221  ) override;
2222  GA_Size localSetIntrinsicDS(GA_IntrinsicEval &eval,
2223  const UT_OptionsHolder *value,
2224  GA_Size size) override;
2225  GA_Size localSetIntrinsicI(GA_IntrinsicEval &eval,
2226  const int64 *value, GA_Size size) override;
2227  GA_Size localSetIntrinsicF(GA_IntrinsicEval &eval,
2228  const fpreal64 *value, GA_Size size) override;
2229 
2230  GA_Detail::IOStatus saveH9Stream(std::ostream& os, bool binary,
2231  const GA_SaveOptions *options) const;
2232  GA_Detail::IOStatus loadH9(UT_IStream &is, const GA_LoadOptions *options);
2233 
2234  /// Simple stat of an H9 file. This only fills out the point/prim counts
2235  /// This assumes the magic number (32-bits) has already been read from the
2236  /// file.
2237  static GA_Detail::IOStatus statH9Basic(UT_IStream &is, GA_Stat &sbuf,
2238  bool binstream);
2239 
2240  bool convertIndexPairDataFromH9();
2241  bool convertIndexPairDataToH9();
2242 
2243  template<typename FLOAT_T>
2244  void transformInternal(const UT_Matrix4T<FLOAT_T> &mat,
2245  const GA_Range &prim_range,
2246  const GA_Range &pt_range,
2247  bool just_P,
2248  bool keep_vector_lengths,
2249  bool check_pasting,
2250  bool neg_determinant_flipvector,
2251  bool update_ptnormals,
2252  GEO_Delta *geodelta,
2253  bool updateaffectednormals,
2254  const char *attribpattern);
2255 
2256 private:
2257  GA_ElementGroup *mergeElementGroup(const GEO_Detail &src,
2258  const GA_ElementGroup &group,
2259  bool override = true);
2260 
2261 public:
2262  /// Some common methods for the standard guys
2263  GA_Attribute *addAttribute(const UT_StringHolder &name,
2264  const UT_Options *creation_args,
2265  const GA_AttributeOptions *attribute_options,
2266  const UT_StringRef &attribtype,
2267  GA_AttributeOwner who,
2269  GA_Attribute *growTuple(GA_AttributeOwner owner,
2270  GA_AttributeScope scope,
2271  const UT_StringRef &name,
2272  int added_size);
2275  const UT_StringRef &name,
2276  int added_size)
2277  {
2278  return growTuple(owner, GA_SCOPE_PUBLIC, name, added_size);
2279  }
2280  void destroyAttribute(GA_AttributeOwner owner,
2281  GA_AttributeScope scope,
2282  const UT_StringRef &name,
2283  const GA_AttributeFilter *filter = 0);
2286  const UT_StringRef &name,
2287  const GA_AttributeFilter *filter = 0)
2288  {
2289  destroyAttribute(owner, GA_SCOPE_PUBLIC, name,
2290  filter);
2291  }
2292 
2293  /// Convenience method to find floating point, int, or string tuples of a
2294  /// specified size range. If max_size or min_size are <= 0, then we won't
2295  /// perform the corresponding size check.
2296  /// @{
2297  const GA_Attribute *findFloatTuple(GA_AttributeOwner owner,
2298  GA_AttributeScope scope,
2299  const UT_StringRef &name,
2300  int min_size=1, int max_size=-1) const;
2303  const UT_StringRef &name,
2304  int min_size=1, int max_size=-1) const
2305  {
2306  return findFloatTuple(owner, GA_SCOPE_PUBLIC, name,
2307  min_size, max_size);
2308  }
2309  GA_Attribute *findFloatTuple(GA_AttributeOwner owner,
2310  GA_AttributeScope scope,
2311  const UT_StringRef &name,
2312  int min_size=1, int max_size=-1);
2315  const UT_StringRef &name,
2316  int min_size=1, int max_size=-1)
2317  {
2318  return findFloatTuple(owner, GA_SCOPE_PUBLIC, name,
2319  min_size, max_size);
2320  }
2321  const GA_Attribute *findIntTuple(GA_AttributeOwner owner,
2322  GA_AttributeScope scope,
2323  const UT_StringRef &name,
2324  int min_size=1, int max_size=-1) const;
2327  const UT_StringRef &name,
2328  int min_size=1, int max_size=-1) const
2329  {
2330  return findIntTuple(owner, GA_SCOPE_PUBLIC, name,
2331  min_size, max_size);
2332  }
2333  GA_Attribute *findIntTuple(GA_AttributeOwner owner,
2334  GA_AttributeScope scope,
2335  const UT_StringRef &name,
2336  int min_size=1, int max_size=-1);
2339  const UT_StringRef &name,
2340  int min_size=1, int max_size=-1)
2341  {
2342  return findIntTuple(owner, GA_SCOPE_PUBLIC, name,
2343  min_size, max_size);
2344  }
2345  /// findNumericTuple will find either float or int.
2346  const GA_Attribute *findNumericTuple(GA_AttributeOwner owner,
2347  GA_AttributeScope scope,
2348  const UT_StringRef &name,
2349  int min_size=1, int max_size=-1) const;
2352  const UT_StringRef &name,
2353  int min_size=1, int max_size=-1) const
2354  {
2355  return findNumericTuple(owner, GA_SCOPE_PUBLIC,
2356  name, min_size, max_size);
2357  }
2358  /// findNumericTuple will find either float or int.
2359  GA_Attribute *findNumericTuple(GA_AttributeOwner owner,
2360  GA_AttributeScope scope,
2361  const UT_StringRef &name,
2362  int min_size=1, int max_size=-1);
2365  const UT_StringRef &name,
2366  int min_size=1, int max_size=-1)
2367  {
2368  return findNumericTuple(owner, GA_SCOPE_PUBLIC,
2369  name, min_size, max_size);
2370  }
2371  const GA_Attribute *findStringTuple(GA_AttributeOwner owner,
2372  GA_AttributeScope scope,
2373  const UT_StringRef &name,
2374  int min_size=1, int max_size=-1) const;
2377  const UT_StringRef &name,
2378  int min_size=1, int max_size=-1) const
2379  {
2380  return findStringTuple(owner, GA_SCOPE_PUBLIC,
2381  name, min_size, max_size);
2382  }
2383  GA_Attribute *findStringTuple(GA_AttributeOwner owner,
2384  GA_AttributeScope scope,
2385  const UT_StringRef &name,
2386  int min_size=1, int max_size=-1);
2389  const UT_StringRef &name,
2390  int min_size=1, int max_size=-1)
2391  {
2392  return findStringTuple(owner, GA_SCOPE_PUBLIC,
2393  name, min_size, max_size);
2394  }
2395 
2396  const GA_Attribute *findDictTuple(GA_AttributeOwner owner,
2397  GA_AttributeScope scope,
2398  const UT_StringRef &name,
2399  int min_size=1, int max_size=-1) const;
2402  const UT_StringRef &name,
2403  int min_size=1, int max_size=-1) const
2404  {
2405  return findDictTuple(owner, GA_SCOPE_PUBLIC,
2406  name, min_size, max_size);
2407  }
2408  GA_Attribute *findDictTuple(GA_AttributeOwner owner,
2409  GA_AttributeScope scope,
2410  const UT_StringRef &name,
2411  int min_size=1, int max_size=-1);
2414  const UT_StringRef &name,
2415  int min_size=1, int max_size=-1)
2416  {
2417  return findDictTuple(owner, GA_SCOPE_PUBLIC,
2418  name, min_size, max_size);
2419  }
2420 
2421  const GA_Attribute *findIndexPair(GA_AttributeOwner owner,
2422  GA_AttributeScope scope,
2423  const UT_StringRef &name) const;
2426  const UT_StringRef &name) const
2427  {
2428  return findIndexPair(owner, GA_SCOPE_PUBLIC, name);
2429  }
2430  GA_Attribute *findIndexPair(GA_AttributeOwner owner,
2431  GA_AttributeScope scope,
2432  const UT_StringRef &name);
2435  const UT_StringRef &name)
2436  {
2437  return findIndexPair(owner, GA_SCOPE_PUBLIC, name);
2438  }
2439  const GA_Attribute *findFloatArray(GA_AttributeOwner owner,
2440  GA_AttributeScope scope,
2441  const UT_StringRef &name,
2442  int min_size=1, int max_size=-1) const;
2445  const UT_StringRef &name,
2446  int min_size=1, int max_size=-1) const
2447  {
2448  return findFloatArray(owner, GA_SCOPE_PUBLIC, name,
2449  min_size, max_size);
2450  }
2451  GA_Attribute *findFloatArray(GA_AttributeOwner owner,
2452  GA_AttributeScope scope,
2453  const UT_StringRef &name,
2454  int min_size=1, int max_size=-1);
2457  const UT_StringRef &name,
2458  int min_size=1, int max_size=-1)
2459  {
2460  return findFloatArray(owner, GA_SCOPE_PUBLIC, name,
2461  min_size, max_size);
2462  }
2463  const GA_Attribute *findIntArray(GA_AttributeOwner owner,
2464  GA_AttributeScope scope,
2465  const UT_StringRef &name,
2466  int min_size=1, int max_size=-1) const;
2469  const UT_StringRef &name,
2470  int min_size=1, int max_size=-1) const
2471  {
2472  return findIntArray(owner, GA_SCOPE_PUBLIC, name,
2473  min_size, max_size);
2474  }
2475  GA_Attribute *findIntArray(GA_AttributeOwner owner,
2476  GA_AttributeScope scope,
2477  const UT_StringRef &name,
2478  int min_size=1, int max_size=-1);
2481  const UT_StringRef &name,
2482  int min_size=1, int max_size=-1)
2483  {
2484  return findIntArray(owner, GA_SCOPE_PUBLIC, name,
2485  min_size, max_size);
2486  }
2487  const GA_Attribute *findNumericArray(GA_AttributeOwner owner,
2488  GA_AttributeScope scope,
2489  const UT_StringRef &name,
2490  int min_size=1, int max_size=-1) const;
2493  const UT_StringRef &name,
2494  int min_size=1, int max_size=-1) const
2495  {
2496  return findNumericArray(owner, GA_SCOPE_PUBLIC, name,
2497  min_size, max_size);
2498  }
2499  GA_Attribute *findNumericArray(GA_AttributeOwner owner,
2500  GA_AttributeScope scope,
2501  const UT_StringRef &name,
2502  int min_size=1, int max_size=-1);
2505  const UT_StringRef &name,
2506  int min_size=1, int max_size=-1)
2507  {
2508  return findNumericArray(owner, GA_SCOPE_PUBLIC, name,
2509  min_size, max_size);
2510  }
2511  const GA_Attribute *findStringArray(GA_AttributeOwner owner,
2512  GA_AttributeScope scope,
2513  const UT_StringRef &name,
2514  int min_size=1, int max_size=-1) const;
2517  const UT_StringRef &name,
2518  int min_size=1, int max_size=-1) const
2519  {
2520  return findStringArray(owner, GA_SCOPE_PUBLIC, name,
2521  min_size, max_size);
2522  }
2523  GA_Attribute *findStringArray(GA_AttributeOwner owner,
2524  GA_AttributeScope scope,
2525  const UT_StringRef &name,
2526  int min_size=1, int max_size=-1);
2529  const UT_StringRef &name,
2530  int min_size=1, int max_size=-1)
2531  {
2532  return findStringArray(owner, GA_SCOPE_PUBLIC, name,
2533  min_size, max_size);
2534  }
2535  const GA_Attribute *findDictArray(GA_AttributeOwner owner,
2536  GA_AttributeScope scope,
2537  const UT_StringRef &name,
2538  int min_size=1, int max_size=-1) const;
2541  const UT_StringRef &name,
2542  int min_size=1, int max_size=-1) const
2543  {
2544  return findDictArray(owner, GA_SCOPE_PUBLIC, name,
2545  min_size, max_size);
2546  }
2547  GA_Attribute *findDictArray(GA_AttributeOwner owner,
2548  GA_AttributeScope scope,
2549  const UT_StringRef &name,
2550  int min_size=1, int max_size=-1);
2553  const UT_StringRef &name,
2554  int min_size=1, int max_size=-1)
2555  {
2556  return findDictArray(owner, GA_SCOPE_PUBLIC, name,
2557  min_size, max_size);
2558  }
2559  /// @}
2560 
2561  /// @{
2562  /// Convenience method for adding a float, integer or string tuple
2563  /// attribute.
2564  ///
2565  /// If there's an existing attribute of the same name, the
2566  /// GA_ReuseStrategy will be used. By default, this will return
2567  /// the existing attribute if it is the same type. If not, it will
2568  /// try to replace it with a new one and copy the old data over.
2569  ///
2570  /// The attribute storage will be determined by the @c storage parameter.
2571  /// For example, if it's GA_STORE_REAL32 or GA_STORE_REAL16, a floating
2572  /// point tuple will be added. An integer tuple would be created for
2573  /// GA_STORE_INT64 and a string tuple for GA_STORE_STRING.
2574  ///
2575  /// The defaults will be ignored for string attributes.
2576  /// @note If you have a GA_StorageClass, you can call
2577  /// @c GAgetDefaultStorage(storageclass);
2578  GA_Attribute *addTuple(GA_Storage storage,
2579  GA_AttributeOwner owner,
2580  GA_AttributeScope scope,
2581  const UT_StringHolder &name,
2582  int tuple_size,
2583  const GA_Defaults &defaults = GA_Defaults(0.0),
2584  const UT_Options *creation_args = 0,
2585  const GA_AttributeOptions *attribute_options = 0,
2586  const GA_ReuseStrategy &reuse =
2587  GA_ReuseStrategy());
2590  GA_AttributeOwner owner,
2591  const UT_StringHolder &name,
2592  int tuple_size,
2593  const GA_Defaults &defaults = GA_Defaults(0.0),
2594  const UT_Options *creation_args = 0,
2595  const GA_AttributeOptions *attribute_options = 0,
2596  const GA_ReuseStrategy &reuse =
2597  GA_ReuseStrategy())
2598  {
2599  return addTuple(storage,
2600  owner,
2602  name,
2603  tuple_size,
2604  defaults,
2605  creation_args,
2606  attribute_options,
2607  reuse);
2608  }
2609  /// @}
2610 
2611  /// @{
2612  /// Convenience method to add a new floating point, int or string tuple
2613  /// attribute.
2614  ///
2615  /// If there's an existing attribute of the same name, the
2616  /// GA_ReuseStrategy will be used. By default, this will return
2617  /// the existing attribute if it is the same type. If not, it will
2618  /// try to replace it with a new one and copy the old data over.
2619  GA_Attribute *addFloatTuple(GA_AttributeOwner owner,
2620  GA_AttributeScope scope,
2621  const UT_StringHolder &name,
2622  int tuple_size,
2623  const GA_Defaults &defaults = GA_Defaults(0.0),
2624  const UT_Options *creation_args=0,
2625  const GA_AttributeOptions *attribute_options=0,
2626  GA_Storage storage = GA_STORE_REAL32,
2627  const GA_ReuseStrategy &reuse
2628  = GA_ReuseStrategy());
2631  const UT_StringHolder &name,
2632  int tuple_size,
2633  const GA_Defaults &defaults = GA_Defaults(0.0),
2634  const UT_Options *creation_args=0,
2635  const GA_AttributeOptions *attribute_options=0,
2636  GA_Storage storage = GA_STORE_REAL32,
2637  const GA_ReuseStrategy &reuse
2638  = GA_ReuseStrategy())
2639  {
2640  return addFloatTuple(owner, GA_SCOPE_PUBLIC, name,
2641  tuple_size, defaults,
2642  creation_args,
2643  attribute_options,
2644  storage, reuse);
2645  }
2646  GA_Attribute *addIntTuple(GA_AttributeOwner owner,
2647  GA_AttributeScope scope,
2648  const UT_StringHolder &name,
2649  int tuple_size,
2650  const GA_Defaults &defaults = GA_Defaults(0),
2651  const UT_Options *creation_args=0,
2652  const GA_AttributeOptions *attribute_options=0,
2653  GA_Storage storage = GA_STORE_INT32,
2654  const GA_ReuseStrategy &reuse
2655  = GA_ReuseStrategy());
2658  const UT_StringHolder &name,
2659  int tuple_size,
2660  const GA_Defaults &defaults = GA_Defaults(0),
2661  const UT_Options *creation_args=0,
2662  const GA_AttributeOptions *attribute_options=0,
2663  GA_Storage storage = GA_STORE_INT32,
2664  const GA_ReuseStrategy &reuse
2665  = GA_ReuseStrategy())
2666  {
2667  return addIntTuple(owner, GA_SCOPE_PUBLIC, name,
2668  tuple_size, defaults,
2669  creation_args,
2670  attribute_options,
2671  storage, reuse);
2672  }
2673 
2674  GA_Attribute *addStringTuple(GA_AttributeOwner owner,
2675  GA_AttributeScope scope,
2676  const UT_StringHolder &name,
2677  int tuple_size,
2678  const UT_Options *creation_args=0,
2679  const GA_AttributeOptions *attribute_options=0,
2680  const GA_ReuseStrategy &reuse
2681  = GA_ReuseStrategy());
2684  const UT_StringHolder &name,
2685  int tuple_size,
2686  const UT_Options *creation_args=0,
2687  const GA_AttributeOptions *attribute_options=0,
2688  const GA_ReuseStrategy &reuse
2689  = GA_ReuseStrategy())
2690  {
2691  return addStringTuple(owner, GA_SCOPE_PUBLIC,
2692  name, tuple_size, creation_args,
2693  attribute_options, reuse);
2694  }
2695 
2696  GA_Attribute *addDictTuple(GA_AttributeOwner owner,
2697  GA_AttributeScope scope,
2698  const UT_StringHolder &name,
2699  int tuple_size,
2700  const UT_Options *creation_args=0,
2701  const GA_AttributeOptions *attribute_options=0,
2702  const GA_ReuseStrategy &reuse
2703  = GA_ReuseStrategy());
2706  const UT_StringHolder &name,
2707  int tuple_size,
2708  const UT_Options *creation_args=0,
2709  const GA_AttributeOptions *attribute_options=0,
2710  const GA_ReuseStrategy &reuse
2711  = GA_ReuseStrategy())
2712  {
2713  return addDictTuple(owner, GA_SCOPE_PUBLIC,
2714  name, tuple_size, creation_args,
2715  attribute_options, reuse);
2716  }
2717  /// @}
2718 
2719  /// @{
2720  /// Convenience method to add a new floating point, or int array
2721  /// attribute.
2722  ///
2723  /// If there's an existing attribute of the same name, the
2724  /// GA_ReuseStrategy will be used. By default, this will return
2725  /// the existing attribute if it is the same type. If not, it will
2726  /// try to replace it with a new one and copy the old data over.
2727  GA_Attribute *addFloatArray(GA_AttributeOwner owner,
2728  GA_AttributeScope scope,
2729  const UT_StringHolder &name,
2730  int tuple_size = 1,
2731  const UT_Options *creation_args=0,
2732  const GA_AttributeOptions *attribute_options=0,
2733  GA_Storage storage = GA_STORE_REAL32,
2734  const GA_ReuseStrategy &reuse
2735  = GA_ReuseStrategy());
2738  const UT_StringHolder &name,
2739  int tuple_size = 1,
2740  const UT_Options *creation_args=0,
2741  const GA_AttributeOptions *attribute_options=0,
2742  GA_Storage storage = GA_STORE_REAL32,
2743  const GA_ReuseStrategy &reuse
2744  = GA_ReuseStrategy())
2745  {
2746  return addFloatArray(owner, GA_SCOPE_PUBLIC, name,
2747  tuple_size,
2748  creation_args,
2749  attribute_options,
2750  storage, reuse);
2751  }
2752  GA_Attribute *addIntArray(GA_AttributeOwner owner,
2753  GA_AttributeScope scope,
2754  const UT_StringHolder &name,
2755  int tuple_size = 1,
2756  const UT_Options *creation_args=0,
2757  const GA_AttributeOptions *attribute_options=0,
2758  GA_Storage storage = GA_STORE_INT32,
2759  const GA_ReuseStrategy &reuse
2760  = GA_ReuseStrategy());
2763  const UT_StringHolder &name,
2764  int tuple_size = 1,
2765  const UT_Options *creation_args=0,
2766  const GA_AttributeOptions *attribute_options=0,
2767  GA_Storage storage = GA_STORE_INT32,
2768  const GA_ReuseStrategy &reuse
2769  = GA_ReuseStrategy())
2770  {
2771  return addIntArray(owner, GA_SCOPE_PUBLIC, name,
2772  tuple_size,
2773  creation_args,
2774  attribute_options,
2775  storage, reuse);
2776  }
2777  GA_Attribute *addStringArray(GA_AttributeOwner owner,
2778  GA_AttributeScope scope,
2779  const UT_StringHolder &name, int tuple_size=1,
2780  const UT_Options *creation_args=0,
2781  const GA_AttributeOptions *attribute_options=0,
2782  GA_Storage storage = GA_STORE_STRING,
2783  const GA_ReuseStrategy &reuse
2784  = GA_ReuseStrategy());
2787  const UT_StringHolder &name, int tuple_size=1,
2788  const UT_Options *creation_args=0,
2789  const GA_AttributeOptions *attribute_options=0,
2790  GA_Storage storage = GA_STORE_STRING,
2791  const GA_ReuseStrategy &reuse
2792  = GA_ReuseStrategy())
2793  {
2794  return addStringArray(owner, GA_SCOPE_PUBLIC, name,
2795  tuple_size,
2796  creation_args,
2797  attribute_options,
2798  storage, reuse);
2799  }
2800  GA_Attribute *addDictArray(GA_AttributeOwner owner,
2801  GA_AttributeScope scope,
2802  const UT_StringHolder &name, int tuple_size=1,
2803  const UT_Options *creation_args=0,
2804  const GA_AttributeOptions *attribute_options=0,
2805  GA_Storage storage = GA_STORE_STRING,
2806  const GA_ReuseStrategy &reuse
2807  = GA_ReuseStrategy());
2810  const UT_StringHolder &name, int tuple_size=1,
2811  const UT_Options *creation_args=0,
2812  const GA_AttributeOptions *attribute_options=0,
2813  GA_Storage storage = GA_STORE_STRING,
2814  const GA_ReuseStrategy &reuse
2815  = GA_ReuseStrategy())
2816  {
2817  return addDictArray(owner, GA_SCOPE_PUBLIC, name,
2818  tuple_size,
2819  creation_args,
2820  attribute_options,
2821  storage, reuse);
2822  }
2823  /// @}
2824 
2825  /// Magic number for ASCII geometry files
2826  static inline int asciiMagicH9()
2827  {
2828  return (('P'<<24) + ('G'<<16) + ('E'<<8) + 'O');
2829  }
2830  /// Magic number for binary geometry files
2831  static inline int binaryMagicH9()
2832  {
2833  return (('B'<<24) + ('g'<<16) + ('e'<<8) + 'o');
2834  }
2835 
2836 private:
2837  bool loadPointsH9(UT_IStream &is, int count,
2839  bool savePointsH9(std::ostream &os, bool binary,
2840  const UT_Array<GA_AttribSaveDataH9> &) const;
2841  bool savePointH9(std::ostream &os, bool binary, GA_Offset offset,
2842  const UT_Array<GA_AttribSaveDataH9> &) const;
2843  bool saveExtraH9(std::ostream &os, bool binary,
2844  const UT_Array<const GA_Primitive*> &) const;
2845  bool loadExtraH9(UT_IStream &is);
2846  bool loadVersionH9(UT_IStream &is, int binary);
2847 
2848 //
2849 // Friends
2850  friend std::ostream &operator<<(std::ostream &os, const GEO_Detail &d)
2851  {
2852  d.saveClassic(
2853  os, /*binary*/ false, /*options*/ nullptr);
2854  return os;
2855  }
2856 
2857  friend class GEO_IOTable; // For loadH9/saveH9
2858  friend class GU_IOClassic; // For loadH9/saveH9
2859 
2860 protected:
2861 
2862  /// This is here just so that GA_AttributeSet::jsonSave() can call
2863  /// GEOcomputeNormals()
2864  void privateComputeNormal(
2865  const GA_RWHandleV3 &normalattrib,
2866  const GA_Group *group,
2867  const float cuspangledegrees,
2868  const int method) const override;
2869 
2870 // The compiler reports some deprecated overrides here
2872 };
2874 
2875 #endif
void destroyPrimitiveGroup(GA_PrimitiveGroup *g)
Definition: GEO_Detail.h:2156
virtual void clearCaches()
Definition: GA_Detail.h:1931
SYS_FORCE_INLINE GA_Attribute * addIntArray(GA_AttributeOwner owner, const UT_StringHolder &name, int tuple_size=1, const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, GA_Storage storage=GA_STORE_INT32, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())
Definition: GEO_Detail.h:2762
SYS_FORCE_INLINE const GA_Attribute * findStringTuple(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1) const
Definition: GEO_Detail.h:2376
Definition of a geometry attribute.
Definition: GA_Attribute.h:198
SYS_FORCE_INLINE GA_Attribute * addPointAttrib(const GA_Attribute *src)
Definition: GEO_Detail.h:1684
SYS_FORCE_INLINE const GA_Attribute * findNumericArray(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1) const
Definition: GEO_Detail.h:2492
void incrementMetaCacheCount()
Definition: GA_Detail.h:2377
Specify when and how to reuse an existing attribute.
GLenum GLint * range
Definition: glcorearb.h:1925
SYS_FORCE_INLINE const GA_Attribute * findPointVectorAttrib(GA_AttributeScope s, const UT_StringRef &n) const
Looks for a 3-float point attribute.
Definition: GEO_Detail.h:1724
SYS_FORCE_INLINE GA_Attribute * findNumericTuple(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1)
Definition: GEO_Detail.h:2364
GLdouble GLdouble GLint GLint const GLdouble * points
Definition: glad.h:2676
SYS_FORCE_INLINE void destroyGlobalAttrib(GA_AttributeScope scope, const UT_StringRef &n, const GA_AttributeFilter *filter=nullptr)
Definition: GEO_Detail.h:1915
Axis-aligned bounding box (AABB).
Definition: GEO_Detail.h:41
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
Definition: thread.h:623
SYS_FORCE_INLINE void destroyPointAttrib(GA_AttributeScope scope, const UT_StringRef &n, const GA_AttributeFilter *filter=nullptr)
Definition: GEO_Detail.h:1739
SYS_FORCE_INLINE GA_Attribute * findIntTuple(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1)
Definition: GEO_Detail.h:2338
GEO_Capture_Bone_Property
Definition: GEO_Detail.h:204
Class which stores the default values for a GA_Attribute.
Definition: GA_Defaults.h:35
void
Definition: png.h:1083
GEO_Capture_Cloth_Property
Definition: GEO_Detail.h:233
getFileOption("OpenEXR:storage") storage
Definition: HDK_Image.dox:276
SYS_FORCE_INLINE const GA_Attribute * findDictTuple(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1) const
Definition: GEO_Detail.h:2401
SYS_FORCE_INLINE GA_Attribute * addDictArray(GA_AttributeOwner owner, const UT_StringHolder &name, int tuple_size=1, const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, GA_Storage storage=GA_STORE_STRING, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())
Definition: GEO_Detail.h:2809
GA_DataIdStrategy
Definition: GA_Types.h:211
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
const GLdouble * v
Definition: glcorearb.h:837
#define SYS_DEPRECATED_PUSH_DISABLE()
#define SYS_DEPRECATED_POP_DISABLE()
Transformation order of scales, rotates, and translates.
Definition: UT_XformOrder.h:23
SYS_FORCE_INLINE GA_Attribute * addPrimAttrib(const UT_StringHolder &n, const UT_Options *creation_args, const GA_AttributeOptions *attribute_options, const UT_StringRef &attribtype)
Definition: GEO_Detail.h:1841
void clearAndDestroy()
Clear all the points/primitives out of this detail.
Definition: GEO_Detail.h:267
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
SYS_FORCE_INLINE GA_Attribute * addTuple(GA_Storage storage, GA_AttributeOwner owner, const UT_StringHolder &name, int tuple_size, const GA_Defaults &defaults=GA_Defaults(0.0), const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())
Definition: GEO_Detail.h:2589
SYS_FORCE_INLINE GA_Attribute * addVertexAttrib(GA_AttributeScope scope, const UT_StringHolder &n, const UT_Options *creation_args, const GA_AttributeOptions *attribute_options, const UT_StringRef &attribtype)
Definition: GEO_Detail.h:1762
SYS_FORCE_INLINE void destroyVertexAttrib(GA_AttributeScope scope, const UT_StringRef &n, const GA_AttributeFilter *filter=nullptr)
Definition: GEO_Detail.h:1809
GLboolean GLboolean g
Definition: glcorearb.h:1222
bool deletePrimitive(GA_Primitive &prim, bool and_points=false)
Definition: GEO_Detail.h:1222
SYS_FORCE_INLINE GA_Attribute * findGlobalAttrib(const GA_Attribute &src)
Definition: GEO_Detail.h:1911
SYS_FORCE_INLINE GA_Attribute * findIndexPair(GA_AttributeOwner owner, const UT_StringRef &name)
Definition: GEO_Detail.h:2434
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
GLdouble s
Definition: glad.h:3009
SYS_FORCE_INLINE GA_AttributeScope getScope() const
Definition: GA_Attribute.h:212
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
SYS_FORCE_INLINE GA_Attribute * findStringTuple(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1)
Definition: GEO_Detail.h:2388
Class used to map H9 geometry files to a form used by GA.
Definition: GA_AIFFileH9.h:318
void destroyVertexGroup(GA_VertexGroup *g)
Definition: GEO_Detail.h:2158
IOStatus saveClassic(const char *, const GA_SaveOptions *) const
**But if you need a result
Definition: thread.h:613
SYS_FORCE_INLINE const GA_Attribute * findFloatTuple(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1) const
Definition: GEO_Detail.h:2302
Standard user attribute level.
Definition: GA_Types.h:149
GA_Size deletePoints(const GA_Range &range, GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES)
Definition: GEO_Detail.h:1217
static int binaryMagicH9()
Magic number for binary geometry files.
Definition: GEO_Detail.h:2831
UT_Vector3T< FLOAT_T > myUpVector
Definition: GEO_Detail.h:794
GLfloat GLfloat GLfloat v2
Definition: glcorearb.h:818
SYS_FORCE_INLINE bool GAisValid(GA_Size v)
Definition: GA_Types.h:655
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:236
GA_Size deletePrimitives(const GA_Range &range, bool and_points=false)
Definition: GEO_Detail.h:1220
virtual int64 getMemoryUsage(bool inclusive) const
Compute memory usage (includes all shared memory)
GEO_Capture_Wire_Property
Definition: GEO_Detail.h:227
GA_Offset appendPointCopy(GA_Offset src)
Definition: GEO_Detail.h:1162
GA_DestroyPointMode
Definition: GA_Detail.h:642
void pad(T &out, int n)
Definition: ImfXdr.h:407
void removeVariableName(const char *varname)
Definition: GEO_Detail.h:1668
A range of elements in an index-map.
Definition: GA_Range.h:42
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
SYS_FORCE_INLINE const GA_Attribute * findVertexAttrib(const GA_Attribute &src) const
Definition: GEO_Detail.h:1784
SYS_FORCE_INLINE GA_Attribute * findDictArray(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1)
Definition: GEO_Detail.h:2552
SYS_FORCE_INLINE const UT_StringHolder & getName() const
Definition: GA_Attribute.h:283
A string map of attributes to ease backward compatibility In the GB/GEO/GU library code would often p...
SYS_FORCE_INLINE GEO_Primitive * getGEOPrimitive(GA_Offset primoff)
Definition: GEO_Detail.h:1177
SYS_FORCE_INLINE GA_Attribute * addPrimAttrib(GA_AttributeScope scope, const UT_StringHolder &n, const UT_Options *creation_args, const GA_AttributeOptions *attribute_options, const UT_StringRef &attribtype)
Definition: GEO_Detail.h:1832
double fpreal64
Definition: SYS_Types.h:201
SYS_FORCE_INLINE GA_Attribute * findPrimAttrib(const GA_Attribute &src)
Definition: GEO_Detail.h:1858
SYS_FORCE_INLINE void destroyPrimAttrib(const UT_StringRef &n, const GA_AttributeFilter *filter=nullptr)
Definition: GEO_Detail.h:1871
GA_Size GA_Offset
Definition: GA_Types.h:646
SYS_FORCE_INLINE GA_Attribute * addVertexAttrib(const UT_StringHolder &n, const UT_Options *creation_args, const GA_AttributeOptions *attribute_options, const UT_StringRef &attribtype)
Definition: GEO_Detail.h:1771
SYS_FORCE_INLINE const GEO_Primitive * getGEOPrimitive(GA_Offset off) const
Definition: GEO_Detail.h:1186
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
UT_Array< EdgeAdjacencyData > GEO_EdgeAdjArray
Definition: GEO_Detail.h:2092
GA_AttributeScope
Definition: GA_Types.h:143
GLdouble n
Definition: glcorearb.h:2008
SYS_FORCE_INLINE const GA_Attribute * findPointAttrib(const GA_Attribute &src) const
Definition: GEO_Detail.h:1714
GLfloat f
Definition: glcorearb.h:1926
bool operator!=(const SoftSymmetryParms &other) const
Definition: GEO_Detail.h:579
UT_Matrix3T< FLOAT_T > myOrient
Definition: GEO_Detail.h:797
SYS_FORCE_INLINE GA_Attribute * addPrimAttrib(const GA_Attribute *src)
Definition: GEO_Detail.h:1825
CaptureType
Methods for manipulating capture weights (GEO_CaptureWeight.C)
Definition: GEO_Detail.h:996
GLintptr offset
Definition: glcorearb.h:665
SYS_FORCE_INLINE GA_Attribute * findVertexAttrib(const GA_Attribute &src)
Definition: GEO_Detail.h:1788
SYS_FORCE_INLINE const GA_Attribute * findGlobalAttrib(const GA_Attribute &src) const
Definition: GEO_Detail.h:1907
UT_Array< PointAdjacencyData > GEO_PointAdjArray
Definition: GEO_Detail.h:2091
Class used to keep track of inheritance of intrinsic attribute evaluation.
SYS_FORCE_INLINE GA_Attribute * addIntTuple(GA_AttributeOwner owner, const UT_StringHolder &name, int tuple_size, const GA_Defaults &defaults=GA_Defaults(0), const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, GA_Storage storage=GA_STORE_INT32, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())
Definition: GEO_Detail.h:2657
friend std::ostream & operator<<(std::ostream &os, const GEO_Detail &d)
Definition: GEO_Detail.h:2850
SYS_FORCE_INLINE bool promotePointAttrib(const UT_StringRef &name)
Definition: GEO_Detail.h:1751
SYS_FORCE_INLINE GA_Attribute * addFloatArray(GA_AttributeOwner owner, const UT_StringHolder &name, int tuple_size=1, const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, GA_Storage storage=GA_STORE_REAL32, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())
Definition: GEO_Detail.h:2737
SYS_FORCE_INLINE GA_Attribute * addGlobalAttrib(GA_AttributeScope scope, const UT_StringHolder &n, const UT_Options *creation_args, const GA_AttributeOptions *attribute_options, const UT_StringRef &attribtype)
Definition: GEO_Detail.h:1887
UT_BoundingBoxT< float > UT_BoundingBox
Definition: GEO_Detail.h:41
SYS_FORCE_INLINE void destroyAttribute(GA_AttributeOwner owner, const UT_StringRef &name, const GA_AttributeFilter *filter=0)
Definition: GEO_Detail.h:2285
SYS_FORCE_INLINE const GA_Attribute * findNumericTuple(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1) const
Definition: GEO_Detail.h:2351
UT_ColorRamp
Definition: UT_Color.h:32
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
SYS_FORCE_INLINE GA_Offset appendPoint()
Append a new point, returning its new data offset.
Definition: GA_Detail.h:326
GLint GLuint mask
Definition: glcorearb.h:124
SYS_FORCE_INLINE const GA_Attribute * findDictArray(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1) const
Definition: GEO_Detail.h:2540
#define GEO_API
Definition: GEO_API.h:14
SYS_FORCE_INLINE void destroyVertexAttrib(const UT_StringRef &n, const GA_AttributeFilter *filter=nullptr)
Definition: GEO_Detail.h:1814
Create macros which emulate the macros in the obsolete GB library.
SYS_FORCE_INLINE const GA_Attribute * findFloatArray(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1) const
Definition: GEO_Detail.h:2444
bool operator<(const GU_TetrahedronFacet &a, const GU_TetrahedronFacet &b)
GLdouble GLdouble GLint GLint order
Definition: glad.h:2676
long long int64
Definition: SYS_Types.h:116
A handle to simplify manipulation of multiple attributes.
SYS_FORCE_INLINE GA_Attribute * findFloatTuple(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1)
Definition: GEO_Detail.h:2314
SYS_FORCE_INLINE const GA_Attribute * findVertexVectorAttrib(GA_AttributeScope s, const UT_StringRef &n) const
Looks for a 3-float vertex attribute.
Definition: GEO_Detail.h:1794
HUSD_API bool eval(VtValue &val, T &ret_val)
const GEO_Primitive * getGEOPrimitiveByIndex(GA_Index idx) const
Definition: GEO_Detail.h:1204
GLuint const GLchar * name
Definition: glcorearb.h:786
#define SYS_DEPRECATED_HDK(__V__)
SYS_FORCE_INLINE GA_Attribute * addPointAttrib(const UT_StringHolder &n, const UT_Options *creation_args, const GA_AttributeOptions *attribute_options, const UT_StringRef &attribtype)
Definition: GEO_Detail.h:1701
GEO_Primitive GB_MACRO_PRIM_TYPE
Definition: GEO_Detail.h:1956
SYS_FORCE_INLINE void destroyPointAttrib(const UT_StringRef &n, const GA_AttributeFilter *filter=nullptr)
Definition: GEO_Detail.h:1744
SYS_FORCE_INLINE const GA_Attribute * findIndexPair(GA_AttributeOwner owner, const UT_StringRef &name) const
Definition: GEO_Detail.h:2425
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:640
GA_API const UT_StringHolder transform
UT_Vector3T< FLOAT_T > myFwdVector
Definition: GEO_Detail.h:793
GA_API const UT_StringHolder orient
SYS_FORCE_INLINE GA_Attribute * growTuple(GA_AttributeOwner owner, const UT_StringRef &name, int added_size)
Definition: GEO_Detail.h:2274
GA_TypeInfo
Definition: GA_Types.h:101
SYS_FORCE_INLINE GA_Attribute * findPointAttrib(const GA_Attribute &src)
Definition: GEO_Detail.h:1718
GLdouble t
Definition: glad.h:2397
SYS_FORCE_INLINE const GA_AttributeDict & attribs() const
Definition: GEO_Detail.h:1951
GLenum mode
Definition: glcorearb.h:99
bool destroyPointGroup(const char *name)
Definition: GEO_Detail.h:2160
LocalXformContextT(const UT_Matrix3T< FLOAT_T > &orient, const UT_Vector3T< FLOAT_T > &origin, PivotSpace pivot_space)
Definition: GEO_Detail.h:786
SYS_FORCE_INLINE GA_Attribute * findFloatArray(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1)
Definition: GEO_Detail.h:2456
GEO_Primitive * getGEOPrimitiveByIndex(GA_Index idx)
Definition: GEO_Detail.h:1197
IFDmantra py
Definition: HDK_Image.dox:266
Contains transitional objects to provide some backward compatibility for code that references old GEO...
GEO_API const TypeMask GEOPRIMALL
GLsizeiptr size
Definition: glcorearb.h:664
SYS_FORCE_INLINE GA_Offset appendPointOffset()
Definition: GEO_Detail.h:1143
GA_AttributeOwner
Definition: GA_Types.h:35
A map of string to various well defined value types.
Definition: UT_Options.h:84
Quaternion class.
Definition: GEO_Detail.h:48
Class to return information about a GA_Detail.
Definition: GA_Stat.h:50
SYS_FORCE_INLINE const GA_Attribute * findPrimAttrib(const GA_Attribute &src) const
Definition: GEO_Detail.h:1854
void clear()
Definition: GA_Detail.h:127
SYS_FORCE_INLINE GA_Attribute * findStringArray(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1)
Definition: GEO_Detail.h:2528
SYS_FORCE_INLINE GA_Attribute * findPointVectorAttrib(GA_AttributeScope s, const UT_StringRef &n)
Definition: GEO_Detail.h:1731
SYS_FORCE_INLINE GA_Attribute * addGlobalAttrib(const UT_StringHolder &n, const UT_Options *creation_args, const GA_AttributeOptions *attribute_options, const UT_StringRef &attribtype)
Definition: GEO_Detail.h:1897
SYS_FORCE_INLINE GA_Attribute * addDictTuple(GA_AttributeOwner owner, const UT_StringHolder &name, int tuple_size, const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())
Definition: GEO_Detail.h:2705
SYS_FORCE_INLINE bool demoteVertexAttrib(const UT_StringRef &name)
Definition: GEO_Detail.h:1821
SYS_FORCE_INLINE const GA_Attribute * findPointVectorAttrib(const UT_StringRef &n) const
Definition: GEO_Detail.h:1728
GA_Primitive * appendPrimitive(const GA_PrimitiveTypeId &type)
Append a primitive by GA_PrimitiveTypeId.
int getValue() const
Definition: GEO_Detail.h:1522
virtual void countMemory(UT_MemoryCounter &counter, bool inclusive) const
SYS_FORCE_INLINE GA_Attribute * findIntArray(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1)
Definition: GEO_Detail.h:2480
GA_API const UT_StringHolder up
fpreal64 fpreal
Definition: SYS_Types.h:277
static int asciiMagicH9()
Magic number for ASCII geometry files.
Definition: GEO_Detail.h:2826
SYS_FORCE_INLINE const GA_Attribute * findIntArray(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1) const
Definition: GEO_Detail.h:2468
#define SYS_FTOLERANCE_R
Definition: SYS_Types.h:283
SYS_FORCE_INLINE GEO_Primitive * appendPrimitive(const GA_PrimitiveTypeId &type)
Definition: GEO_Detail.h:1236
SYS_FORCE_INLINE GA_Attribute * addGlobalAttrib(const GA_Attribute *src)
Definition: GEO_Detail.h:1880
SYS_FORCE_INLINE const GA_AttributeDict & primitiveAttribs() const
Definition: GEO_Detail.h:1943
Utility class for containing a color ramp.
Definition: UT_Ramp.h:92
void destroyPointGroup(GA_PointGroup *g)
Definition: GEO_Detail.h:2154
GEO_Capture_Muscle_Property
Definition: GEO_Detail.h:211
Class used to map the GA attribute into a form for H9 geometry files.
Definition: GA_AIFFileH9.h:262
GLfloat GLfloat v1
Definition: glcorearb.h:817
SYS_FORCE_INLINE GA_Attribute * findNumericArray(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1)
Definition: GEO_Detail.h:2504
SYS_FORCE_INLINE GA_Size deletePoints(const GA_PointGroup &point_group, GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES)
Definition: GEO_Detail.h:1168
SYS_FORCE_INLINE GA_Attribute * addFloatTuple(GA_AttributeOwner owner, const UT_StringHolder &name, int tuple_size, const GA_Defaults &defaults=GA_Defaults(0.0), const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, GA_Storage storage=GA_STORE_REAL32, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())
Definition: GEO_Detail.h:2630
bool destroyPrimitiveGroup(const char *name)
Definition: GEO_Detail.h:2163
SYS_FORCE_INLINE GA_Attribute * addStringArray(GA_AttributeOwner owner, const UT_StringHolder &name, int tuple_size=1, const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, GA_Storage storage=GA_STORE_STRING, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())
Definition: GEO_Detail.h:2786
#define GA_INVALID_INDEX
Definition: GA_Types.h:686
SYS_FORCE_INLINE GA_Attribute * addPointAttrib(GA_AttributeScope scope, const UT_StringHolder &n, const UT_Options *creation_args, const GA_AttributeOptions *attribute_options, const UT_StringRef &attribtype)
Definition: GEO_Detail.h:1691
SYS_FORCE_INLINE GA_Attribute * findVertexVectorAttrib(const UT_StringRef &n)
Definition: GEO_Detail.h:1805
SYS_FORCE_INLINE GA_Attribute * findPointVectorAttrib(const UT_StringRef &n)
Definition: GEO_Detail.h:1735
Container class for all geometry.
Definition: GA_Detail.h:96
SYS_FORCE_INLINE const GA_Attribute * findIntTuple(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1) const
Definition: GEO_Detail.h:2326
UT_Vector3T< FLOAT_T > myOrigin
Definition: GEO_Detail.h:798
SYS_FORCE_INLINE void destroyGlobalAttrib(const UT_StringRef &n, const GA_AttributeFilter *filter=nullptr)
Definition: GEO_Detail.h:1920
Definition: core.h:1131
GA_Offset appendPointCopy(GA_Offset src, GA_PointWrangler &wrangler)
Append a point, copying data from the source point.
Definition: GEO_Detail.h:1158
PUGI__FN char_t * translate(char_t *buffer, const char_t *from, const char_t *to, size_t to_length)
Definition: pugixml.cpp:8352
SYS_FORCE_INLINE void destroyPrimAttrib(GA_AttributeScope scope, const UT_StringRef &n, const GA_AttributeFilter *filter=nullptr)
Definition: GEO_Detail.h:1863
SIM_API const UT_StringHolder distance
SYS_FORCE_INLINE GA_Attribute * addVertexAttrib(const GA_Attribute *src)
Definition: GEO_Detail.h:1755
GEO_Capture_Meta_Property
Definition: GEO_Detail.h:219
SYS_FORCE_INLINE GA_Attribute * addStringTuple(GA_AttributeOwner owner, const UT_StringHolder &name, int tuple_size, const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())
Definition: GEO_Detail.h:2683
SYS_FORCE_INLINE const GA_Attribute * findStringArray(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1) const
Definition: GEO_Detail.h:2516
bool operator==(const SoftSymmetryParms &other) const
Definition: GEO_Detail.h:572
type
Definition: core.h:1059
SYS_FORCE_INLINE GA_Attribute * findDictTuple(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1)
Definition: GEO_Detail.h:2413
Class to specify options for loading geometry.
GEO_Standard_Attributes
Definition: GEO_Detail.h:165
SYS_FORCE_INLINE GA_Attribute * findVertexVectorAttrib(GA_AttributeScope s, const UT_StringRef &n)
Definition: GEO_Detail.h:1801
GA_Storage
Definition: GA_Types.h:51
LocalXformContextT(const UT_Vector3T< FLOAT_T > &forward, const UT_Vector3T< FLOAT_T > &up, PivotSpace pivot_space)
Coordinate frame defined by lookat(zero, forward, up).
Definition: GEO_Detail.h:777
GEO_CopyMethod
An enum for GEO_Detail::copy's method parameter.
Definition: GEO_Detail.h:240
GLint GLsizei count
Definition: glcorearb.h:405
Definition: format.h:895
constexpr T normalize(UT_FixedVector< T, D > &a) noexcept
bool destroyVertexGroup(const char *name)
Definition: GEO_Detail.h:2166
SYS_FORCE_INLINE const GA_Attribute * findVertexVectorAttrib(const UT_StringRef &n) const
Definition: GEO_Detail.h:1798
SYS_FORCE_INLINE const GA_AttributeDict & vertexAttribs() const
Definition: GEO_Detail.h:1947
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glcorearb.h:1297
GLenum src
Definition: glcorearb.h:1793