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