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