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  GA_Attribute *addTubeCaptureAttribute(
1465  GA_Storage s = GA_STORE_INVALID);
1466 
1467  /// Add the detail's capture frame attribute for capture type t.
1468  GA_Attribute *addCaptureFrameAttribute(CaptureType t = CAPTURE_BONE,
1469  GA_Storage s = GA_STORE_INVALID);
1470 
1471  /// Add the bone capture skeleton root detail attribute.
1472  GA_Attribute *addCaptureSkelRootAttribute(CaptureType t
1473  = CAPTURE_BONE);
1474 
1475  /// Add a new custom (index, weight) point attribute.
1476  /// TODO: geo_NPairs is temporary to force examination of old signature
1477  /// uses, which took size in bytes instead of the # of pairs.
1479  {
1480  public:
1481  explicit geo_NPairs(int v) : myValue(v) {}
1482 
1483  int getValue() const { return myValue; }
1484  private:
1485  int myValue;
1486  };
1487  GA_Attribute *addPtIndexPairAttribute(const UT_StringHolder &name,
1488  geo_NPairs n_pairs,
1490 
1491  /// Add the (index, weight) point attribute for capture type t.
1492  GA_Attribute *addPointCaptureAttribute(geo_NPairs n_pairs,
1493  CaptureType t = CAPTURE_BONE,
1494  GA_Storage s =
1496 
1497  /// Add the bone capture alpha point attribute.
1498  GA_Attribute *addPointCaptureAlphaAttribute(float dflt,
1500 
1501  const GA_Attribute *findNormalAttribute(GA_AttributeOwner who) const;
1502  GA_Attribute *findNormalAttribute(GA_AttributeOwner who);
1503  const GA_Attribute *findTextureAttribute(GA_AttributeOwner who) const;
1504  GA_Attribute *findTextureAttribute(GA_AttributeOwner who);
1505  const GA_Attribute *findVelocityAttribute(GA_AttributeOwner who) const;
1506  GA_Attribute *findVelocityAttribute(GA_AttributeOwner who);
1507  const GA_Attribute *findAlphaAttribute(GA_AttributeOwner who) const;
1508  GA_Attribute *findAlphaAttribute(GA_AttributeOwner who);
1509  const GA_Attribute *findComAttribute(GA_AttributeOwner who) const;
1510  GA_Attribute *findComAttribute(GA_AttributeOwner who);
1511  const GA_Attribute *findDiffuseAttribute(GA_AttributeOwner who) const;
1512  GA_Attribute *findDiffuseAttribute(GA_AttributeOwner who);
1513  const GA_Attribute *findDistanceAttribute(GA_AttributeOwner who) const;
1514  GA_Attribute *findDistanceAttribute(GA_AttributeOwner who);
1515  const GA_Attribute *findLODAttribute(GA_AttributeOwner who) const;
1516  GA_Attribute *findLODAttribute(GA_AttributeOwner who);
1517  const GA_Attribute *findRestAttribute(GA_AttributeOwner who) const;
1518  GA_Attribute *findRestAttribute(GA_AttributeOwner who);
1519  const GA_Attribute *findTubeCaptureAttribute() const;
1520  GA_Attribute *findTubeCaptureAttribute();
1521 
1522  /// Find the material attribute if it exists. This checks for the
1523  /// GEO_STD_ATTRIB_MATERIAL name.
1524  GA_ROHandleS findMaterialAttribute(GA_AttributeOwner who) const;
1525 
1526  /// The internal normal attribute is always a point attribute
1527  /// @todo Remove internalN code path with the H11 viewport?
1528  const GA_Attribute *findInternalNormalAttribute() const;
1529  GA_Attribute *findInternalNormalAttribute();
1530 
1531  /// Find the offset for the detail's capture frame attribute for capture
1532  /// type t.
1533  const GA_Attribute *findCaptureFrameAttribute(
1534  CaptureType t = CAPTURE_BONE) const;
1535  GA_Attribute *findCaptureFrameAttribute(
1536  CaptureType t = CAPTURE_BONE);
1537 
1538  /// Find the offset for the bone capture skeleton root detail attribute.
1539  const GA_Attribute *findCaptureSkelRootAttribute(CaptureType t
1540  = CAPTURE_BONE) const;
1541  GA_Attribute *findCaptureSkelRootAttribute(CaptureType t
1542  = CAPTURE_BONE);
1543 
1544  /// Find the offset for the (region, weight) point capture *point*
1545  /// attribute for capture type t.
1546  const GA_Attribute *findPointCaptureAttribute(
1547  CaptureType t = CAPTURE_BONE) const;
1548  GA_Attribute *findPointCaptureAttribute(
1549  CaptureType t = CAPTURE_BONE);
1550  /// Find the offset for the bone capture alpha point attribute.
1551  const GA_Attribute *findPointCaptureAlphaAttribute() const;
1552  GA_Attribute *findPointCaptureAlphaAttribute();
1553 
1554  /// Find the offset for a custom (index, weight) point attribute.
1555  const GA_Attribute *findPtIndexPairAttribute(const UT_StringRef &name) const;
1556  GA_Attribute *findPtIndexPairAttribute(const UT_StringRef &name);
1557 
1558  void destroyNormalAttribute(GA_AttributeOwner who);
1559  void destroyInternalNormalAttribute();
1560  void destroyTextureAttribute(GA_AttributeOwner who);
1561  void destroyVelocityAttribute(GA_AttributeOwner who);
1562  void destroyAlphaAttribute(GA_AttributeOwner who);
1563  void destroyComAttribute(GA_AttributeOwner who);
1564  void destroyDiffuseAttribute(GA_AttributeOwner who);
1565  void destroyDistanceAttribute(GA_AttributeOwner who);
1566  void destroyLODAttribute(GA_AttributeOwner who);
1567  void destroyRestAttribute(GA_AttributeOwner who);
1568  void destroyTubeCaptureAttribute();
1569 
1570  /// Destroy the detail's capture frame attribute for capture type t.
1571  void destroyCaptureFrameAttribute(CaptureType t
1572  = CAPTURE_BONE);
1573 
1574  /// Destroy the bone capture skeleton root detail attribute.
1575  void destroyCaptureSkelRootAttribute(CaptureType t
1576  = CAPTURE_BONE);
1577 
1578  /// Destroy the (region, weight) point capture *point* attribute for
1579  /// capture type t.
1580  void destroyPointCaptureAttribute(CaptureType t =
1581  CAPTURE_BONE);
1582 
1583  /// Destroy the bone capture alpha point attribute.
1584  void destroyPointCaptureAlphaAttribute();
1585 
1586  /// Destroy a custom (index, weight) point attribute.
1587  void destroyPtIndexPairAttribute(const UT_StringRef &name);
1588 
1589  /// Retrieve the restAnchor string attribute from this gdp, if
1590  /// it exists - return true if successful
1591  bool getMetaRestAnchorPath(UT_String &anchorPath) const;
1592 
1593  /// You should never assume that "uv" is textures!
1594  /// Note that Point capture is still special cased.
1595  /// If the supplied layer is <= 0, then the current layer is used.
1596  /// To extract all the layers names, one should do:
1597  /// for (layer = 1; layer <= getNumLayers(); layer++)
1598  /// layername[layer] = getStdAttributeName(..., layer);
1599  ///
1600  /// WARNING: The returned UT_StringHolder may own the string it references,
1601  /// so you *must* either assign it to a UT_StringHolder or UT_String,
1602  /// or pass it to a function that takes a UT_StringHolder, UT_StringRef,
1603  /// const UT_StringHolder&, or const UT_StringRef&.
1604  /// *DO* *NOT* assign it to a const char* variable! The UT_StringHolder
1605  /// will be destructed immediately after the assignment, deleting the
1606  /// string that the const char* points to!
1607  UT_StringHolder getStdAttributeName(GEO_Standard_Attributes name,
1608  int layer = -1) const;
1609  int getAttributeLayer(const char* attr_name) const;
1610 
1611  static GA_TypeInfo getStdAttributeTypeInfo(const char *name, int floattuplesize);
1612 
1613  /// These handle layers:
1614  int getCurrentLayer() const;
1615  void setCurrentLayer(int layer);
1616  void setNumLayers(int numlayer);
1617  int getNumLayers() const;
1618  /// These get and set the CURRENT layer's merge mode:
1619  void setLayerMerge(int preclear, int mask, int srcblend,
1620  int dstblend);
1621  void getLayerMerge(int &preclear, int &mask, int &srcblend,
1622  int &dstblend) const;
1623 
1624  void addVariableName(const char *attr, const char *varname);
1625  void removeVariableName(const char *varname)
1626  { addVariableName(0, varname); }
1627  /// This gets a raw list of the variable maps suitable for caching
1628  /// to see if they changed.
1629  void getVariableNameMap(UT_String &result) const;
1630 
1631  /// Traverses the variable name mappings currently present:
1632  void traverseVariableNames(int (*function)(const char *attr,
1633  const char *varname, void *data),
1634  void *data) const;
1635 
1636  /// increase the memory size of the attribute
1637  GA_Attribute *growPointCaptureAttribute(geo_NPairs num_added_pairs,
1638  CaptureType t = CAPTURE_BONE);
1639 
1642  {
1643  return getAttributes().cloneAttribute(
1645  src->getName(), *src, true);
1646  }
1649  const UT_StringHolder &n,
1650  const UT_Options *creation_args,
1651  const GA_AttributeOptions *attribute_options,
1652  const UT_StringRef &attribtype)
1653  {
1654  return createAttribute(GA_ATTRIB_POINT, scope, n,
1655  creation_args, attribute_options,attribtype);
1656  }
1659  const UT_Options *creation_args,
1660  const GA_AttributeOptions *attribute_options,
1661  const UT_StringRef &attribtype)
1662  {
1663  return createAttribute(GA_ATTRIB_POINT, n,
1664  creation_args, attribute_options,attribtype);
1665  }
1666 
1667  /// Replace old findPointAttribute(const char *name...) with
1668  /// findIntTuple(GA_ATTRIB_POINT, ...), findFloatTuple(),
1669  /// findStringTuple(), etc.
1672  { return findPointAttribute(src.getScope(),
1673  src.getName()); }
1676  { return findPointAttribute(src.getScope(),
1677  src.getName()); }
1678 
1679  /// Looks for a 3-float point attribute
1682  const UT_StringRef &n) const
1683  { return findFloatTuple(GA_ATTRIB_POINT, s, n, 3, 3); }
1686  { return findFloatTuple(GA_ATTRIB_POINT, n, 3, 3); }
1689  const UT_StringRef &n)
1690  { return findFloatTuple(GA_ATTRIB_POINT, s, n, 3, 3); }
1693  { return findFloatTuple(GA_ATTRIB_POINT, n, 3, 3); }
1694 
1697  const UT_StringRef &n,
1698  const GA_AttributeFilter *filter=NULL)
1699  { destroyAttribute(GA_ATTRIB_POINT,scope, n, filter); }
1702  const GA_AttributeFilter *filter=NULL)
1703  { destroyAttribute(GA_ATTRIB_POINT, n, filter); }
1704 
1705  bool promotePointAttrib(GA_AttributeScope scope,
1706  const UT_StringRef &name);
1709  { return promotePointAttrib(GA_SCOPE_PUBLIC, name); }
1710 
1713  {
1714  return getAttributes().cloneAttribute(
1716  src->getName(), *src, true);
1717  }
1720  const UT_Options *creation_args,
1721  const GA_AttributeOptions *attribute_options,
1722  const UT_StringRef &attribtype)
1723  {
1724  return createAttribute(GA_ATTRIB_VERTEX, scope, n,
1725  creation_args, attribute_options,attribtype);
1726  }
1729  const UT_Options *creation_args,
1730  const GA_AttributeOptions *attribute_options,
1731  const UT_StringRef &attribtype)
1732  {
1733  return createAttribute(GA_ATTRIB_VERTEX, n,
1734  creation_args, attribute_options,attribtype);
1735  }
1736 
1737  /// Replace old findVertexAttribute(const char *name...) with
1738  /// findIntTuple(GA_ATTRIB_VERTEX, ...), findFloatTuple(),
1739  /// findStringTuple(), etc.
1742  { return findVertexAttribute(src.getScope(),
1743  src.getName()); }
1746  { return findVertexAttribute(src.getScope(),
1747  src.getName()); }
1748 
1749  /// Looks for a 3-float vertex attribute
1752  const UT_StringRef &n) const
1753  { return findFloatTuple(GA_ATTRIB_VERTEX,s, n, 3, 3); }
1756  { return findFloatTuple(GA_ATTRIB_VERTEX, n, 3, 3); }
1759  const UT_StringRef &n)
1760  { return findFloatTuple(GA_ATTRIB_VERTEX,s, n, 3, 3); }
1763  { return findFloatTuple(GA_ATTRIB_VERTEX, n, 3, 3); }
1764 
1767  const UT_StringRef &n,
1768  const GA_AttributeFilter *filter=NULL)
1769  { destroyAttribute(GA_ATTRIB_VERTEX,scope, n,filter); }
1772  const GA_AttributeFilter *filter=NULL)
1773  { destroyAttribute(GA_ATTRIB_VERTEX, n, filter); }
1774 
1775  bool demoteVertexAttrib(GA_AttributeScope scope,
1776  const UT_StringRef &name);
1779  { return demoteVertexAttrib(GA_SCOPE_PUBLIC, name); }
1780 
1783  {
1784  return getAttributes().cloneAttribute(
1786  src->getName(), *src,true);
1787  }
1790  const UT_Options *creation_args,
1791  const GA_AttributeOptions *attribute_options,
1792  const UT_StringRef &attribtype)
1793  {
1794  return createAttribute(GA_ATTRIB_PRIMITIVE, scope,
1795  n, creation_args, attribute_options,attribtype);
1796  }
1799  const UT_Options *creation_args,
1800  const GA_AttributeOptions *attribute_options,
1801  const UT_StringRef &attribtype)
1802  {
1803  return createAttribute(GA_ATTRIB_PRIMITIVE, n,
1804  creation_args, attribute_options,attribtype);
1805  }
1806 
1807  /// Replace old findPrimAttribute(const char *name...) with
1808  /// findIntTuple(GA_ATTRIB_PRIMITIVE, ...), findFloatTuple(),
1809  /// findStringTuple(), etc.
1812  { return findPrimitiveAttribute(src.getScope(),
1813  src.getName()); }
1816  { return findPrimitiveAttribute(src.getScope(),
1817  src.getName()); }
1818 
1821  const UT_StringRef &n,
1822  const GA_AttributeFilter *filter=NULL)
1823  {
1824  destroyAttribute(GA_ATTRIB_PRIMITIVE, scope, n,
1825  filter);
1826  }
1829  const GA_AttributeFilter *filter=NULL)
1830  {
1831  destroyAttribute(GA_ATTRIB_PRIMITIVE, n, filter);
1832  }
1833 
1834  /// Note: if attrib already exists, will return pointer to existing
1835  /// attrib.
1838  {
1839  return getAttributes().cloneAttribute(
1841  src->getName(), *src, true);
1842  }
1845  const UT_StringHolder &n,
1846  const UT_Options *creation_args,
1847  const GA_AttributeOptions *attribute_options,
1848  const UT_StringRef &attribtype)
1849  {
1850  return createAttribute(GA_ATTRIB_DETAIL, scope, n,
1851  creation_args, attribute_options,attribtype);
1852  }
1855  const UT_Options *creation_args,
1856  const GA_AttributeOptions *attribute_options,
1857  const UT_StringRef &attribtype)
1858  {
1859  return createAttribute(GA_ATTRIB_DETAIL, n,
1860  creation_args, attribute_options,attribtype);
1861  }
1862 
1865  { return findGlobalAttribute(src.getScope(),
1866  src.getName()); }
1869  { return findGlobalAttribute(src.getScope(),
1870  src.getName()); }
1873  const UT_StringRef &n,
1874  const GA_AttributeFilter *filter=NULL)
1875  { destroyAttribute(GA_ATTRIB_DETAIL,scope, n,filter); }
1878  const GA_AttributeFilter *filter=NULL)
1879  { destroyAttribute(GA_ATTRIB_DETAIL, n, filter); }
1880 
1882  /// Query the internal structures:
1883  SYS_DEPRECATED_HDK(13.0)
1884  GEO_PrimList primitives()
1885  {
1886  return GEO_PrimList(getPrimitiveMap());
1887  }
1888  SYS_DEPRECATED_HDK(13.0)
1889  const GEO_PrimList primitives() const
1890  {
1891  return GEO_PrimList(getPrimitiveMap());
1892  }
1894 
1896  const GA_AttributeDict &pointAttribs() const
1897  { return getAttributes().getDict(
1898  GA_ATTRIB_POINT); }
1901  { return getAttributes().getDict(
1905  { return getAttributes().getDict(
1906  GA_ATTRIB_VERTEX); }
1908  const GA_AttributeDict &attribs() const
1909  { return getAttributes().getDict(
1910  GA_ATTRIB_DETAIL); }
1911 
1912  // Typedef for the GA_Detail::GB_MACRO_CAST static methods.
1914 
1915  bool hasMetaPrimitives() const;
1916  bool hasPastedPrimitives() const;
1917  bool hasQuadricPrimitives() const;
1918  bool hasParticlePrimitives() const;
1919  bool hasVolumePrimitives() const;
1920  bool hasTransformingPrimitives() const;
1921 
1922  /// Check to see whether the detail has any custom primitive types (i.e.
1923  /// non-factory primitives)
1924  bool hasCustomPrimitives() const;
1925 
1926  GA_Size getMetaCount() const;
1927  GA_Size getPastedCount() const;
1928  GA_Size getQuadricCount() const;
1929  GA_Size getParticleCount() const;
1930  GA_Size getVolumeCount() const;
1931 
1932  // This function will find the GEO_Standard_Attributes enum that
1933  // matches the provided string s.
1934  // true is returned on if a match is found; false if no match.
1935  bool getStandardAttributes(const char *s, GEO_Standard_Attributes &a);
1936 
1937  bool mergeCaptureProperties(
1938  GA_Attribute *my_atr,
1939  const GA_Attribute *src_atr,
1940  UT_IntArray &new_indices);
1941 
1942  /// Methods for dealing with attribute handles. It is important to note
1943  /// that the const methods return READ-ONLY handles which will fail when
1944  /// any write methods are called.
1945  SYS_DEPRECATED_HDK(13.0)
1946  GEO_AttributeHandle getPointAttribute (const char *attrib_name) const;
1947  SYS_DEPRECATED_HDK(13.0)
1948  GEO_AttributeHandle getPointAttribute (const char *attrib_name);
1949  SYS_DEPRECATED_HDK(13.0)
1950  GEO_AttributeHandle getPrimAttribute (const char *attrib_name) const;
1951  SYS_DEPRECATED_HDK(13.0)
1952  GEO_AttributeHandle getPrimAttribute (const char *attrib_name);
1953  SYS_DEPRECATED_HDK(13.0)
1954  GEO_AttributeHandle getVertexAttribute(const char *attrib_name) const;
1955  SYS_DEPRECATED_HDK(13.0)
1956  GEO_AttributeHandle getVertexAttribute(const char *attrib_name);
1957  SYS_DEPRECATED_HDK(13.0)
1958  GEO_AttributeHandle getDetailAttribute(const char *attrib_name) const;
1959  SYS_DEPRECATED_HDK(13.0)
1960  GEO_AttributeHandle getDetailAttribute(const char *attrib_name);
1961  SYS_DEPRECATED_HDK(13.0)
1962  GEO_AttributeHandle getAttribute(GA_AttributeOwner dict,
1963  const char *attrib_name) const;
1964  SYS_DEPRECATED_HDK(13.0)
1965  GEO_AttributeHandle getAttribute(GA_AttributeOwner dict,
1966  const char *attrib_name);
1967 
1968  /// Change the storage type from one type to another. For example, cast an
1969  /// integer attribute into a floating point attribute, or vice versa.
1970  /// Only some casting methods have been implemented, so it's quite likely
1971  /// that this method may fail.
1972  bool changeAttributeStorage(GA_AttributeOwner dict,
1973  const UT_StringRef &name,
1974  GA_Storage new_storage);
1975  bool changePointAttributeStorage(const UT_StringRef &nm, GA_Storage s);
1976  bool changeVertexAttributeStorage(const UT_StringRef &nm, GA_Storage s);
1977  bool changePrimAttributeStorage(const UT_StringRef &nm, GA_Storage s);
1978  bool changeDetailAttributeStorage(const UT_StringRef &nm, GA_Storage s);
1979 
1980  /// @{
1981  /// Convenience functions to set a detail attribute to a specific
1982  /// value, and also create the attribute if it doesn't exist.
1983  /// Values will only be assigned to the first N tuple components. For
1984  /// example, for strings, only the first string value will be set, while
1985  /// for a vector2, only the first 2 components will be set.
1986  /// @note Storing a ramp will call the save() method on the UT_Ramp and
1987  /// assign that string to the attribute.
1988  /// @note If the attribute already exists but is the wrong type, or the
1989  /// attribute has too small a tuple size, this method will fail.
1990  bool setDetailAttributeS(const UT_StringHolder &aname, const char *value);
1991  bool setDetailAttributeS(const UT_StringHolder &aname, const UT_StringArray &s);
1992  bool setDetailAttributeR(const UT_StringHolder &aname, const UT_Ramp &ramp);
1993  bool setDetailAttributeF(const UT_StringHolder &aname, float v);
1994  bool setDetailAttributeF(const UT_StringHolder &aname, float v1, float v2);
1995  bool setDetailAttributeF(const UT_StringHolder &aname, const UT_Vector2 &v);
1996  bool setDetailAttributeF(const UT_StringHolder &aname, const UT_Vector3 &v);
1997  bool setDetailAttributeF(const UT_StringHolder &aname, const UT_Vector4 &v);
1998  bool setDetailAttributeF(const UT_StringHolder &aname, const UT_Matrix3 &v);
1999  bool setDetailAttributeF(const UT_StringHolder &aname, const UT_Matrix4 &v);
2000  bool setDetailAttributeI(const UT_StringHolder &aname, int v);
2001  /// @}
2002 
2003  /// @{
2004  /// Convenience routines to retrieve a group of points referenced
2005  /// by a range/group of primitives. These routines assume that the point
2006  /// group pointer is not NULL and return the size of the resulting point
2007  /// group.
2008  GA_Size getPointGroupAdjacentToPrimitiveGroup(
2009  const GA_PrimitiveGroup *in_prim_grp,
2010  GA_PointGroup *adj_pt_grp);
2011  GA_Size getPointGroupAdjacentToPrimitiveRange(
2012  const GA_Range &in_prim_rng,
2013  GA_PointGroup *adj_pt_rng);
2014  GA_Size getVertexGroupAdjacentToPrimitiveGroup(
2015  const GA_PrimitiveGroup *in_prim_grp,
2016  GA_VertexGroup *adj_vtx_grp);
2017  GA_Size getVertexGroupAdjacentToPrimitiveRange(
2018  const GA_Range &in_prim_rng,
2019  GA_VertexGroup *adj_vtx_rng);
2020  /// @}
2021 
2022 private:
2023  struct AdjacentPolygonData
2024  {
2025  GA_Offset myAdjacentPolygon;
2026 
2027  bool operator==(const AdjacentPolygonData &pad) const
2028  { return myAdjacentPolygon == pad.myAdjacentPolygon; }
2029  bool operator<(const AdjacentPolygonData &pad) const
2030  { return myAdjacentPolygon < pad.myAdjacentPolygon; }
2031  };
2032 
2033 public:
2034 
2035  struct PointAdjacencyData : public AdjacentPolygonData
2036  {
2038  };
2039 
2040  struct EdgeAdjacencyData : public AdjacentPolygonData
2041  {
2045  };
2046 
2049 
2050  // Get an array of PointAdjacencyData structs representing the polygons
2051  // adjacent to a polygon (poly_off) through a point. Notice that
2052  // PointAdjacencyData contains a point shared by the two polygons
2053  GA_Size getPointAdjacentPolygons(GEO_PointAdjArray &adjacencies,
2054  GA_Offset poly_off) const;
2055 
2056  // Get an array of polygon Offsets adjacent to a polygon (poly_off)
2057  // through a point
2058  GA_Size getPointAdjacentPolygons(GA_OffsetArray &polygons,
2059  GA_Offset poly_off) const;
2060 
2061 
2062  // Get an array of EdgeAdjacencyData structs representing the polygons
2063  // adjacent to a polygon (poly_off) through an edge. Notice that
2064  // EdgeAdjacencyData contains additional information about the type of
2065  // adjacency
2066  GA_Size getEdgeAdjacentPolygons(GEO_EdgeAdjArray &adjacencies,
2067  GA_Offset poly_off) const;
2068 
2069  // Get an array of polygon Offsets adjacent to a polygon (poly_off)
2070  // through an edge
2071  GA_Size getEdgeAdjacentPolygons(GA_OffsetArray &polygons,
2072  GA_Offset poly_off) const;
2073 
2074  /// Searches primitive list for a primitive whose name attribute
2075  /// matches the given name.
2076  /// UT_String::multiMatch is used for comparison so searching
2077  /// for Cd.* will return as expected.
2078  /// Returns the matchnumberth matching primitive.
2079  const GEO_Primitive *findPrimitiveByName(const char *nametomatch,
2082  const char *nameattrib="name",
2083  int matchnumber = 0) const;
2084  GEO_Primitive *findPrimitiveByName(const char *nametomatch,
2087  const char *nameattrib="name",
2088  int matchnumber = 0);
2089 
2090  /// Like findPrimitiveByName, but adds all matching primitives to the list
2091  void findAllPrimitivesByName(
2093  const char *nametomatch,
2096  const char *nameattrib="name") const;
2097  void findAllPrimitivesByName(
2098  UT_Array<GEO_Primitive*> &primlist,
2099  const char *nametomatch,
2102  const char *nameattrib="name");
2103 
2104  /// Merges attributes from 'src' into this detail. Capture attributes for
2105  /// newly merged points are also updated. Newly merged points are
2106  /// identified by point numbers beginning from 'num_pts_prev'.
2107  void mergeDetailAttributes( const GEO_Detail &src,
2108  int num_pts_prev );
2109 
2111  { destroyElementGroup(g); }
2113  { destroyElementGroup(g); }
2115  { destroyElementGroup(g); }
2116  bool destroyPointGroup(const char *name)
2117  { return
2118  destroyElementGroup(GA_ATTRIB_POINT, name); }
2119  bool destroyPrimitiveGroup(const char *name)
2120  { return
2121  destroyElementGroup(GA_ATTRIB_PRIMITIVE, name); }
2122  bool destroyVertexGroup(const char *name)
2123  { return
2124  destroyElementGroup(GA_ATTRIB_VERTEX, name); }
2125 
2126  /// Attempt to copy groups from the source detail. If override is true,
2127  /// existing groups with the same names as src groups are cleared, else
2128  /// existing groups are not affected. The status (ordered/unordered,
2129  /// internal/persistent) of the source group is also copied.
2130  ///
2131  /// Membership is matched by element index for point and primitive groups,
2132  /// by primitive and local vertex index for vertex groups, and by element
2133  /// index validated by adjacency for edge groups.
2134  void mergeGroups(const GEO_Detail &src, bool override,
2135  unsigned mask = GA_GMASK_FULL_MASK);
2136  GA_PointGroup *mergeGroup(const GEO_Detail &src,
2137  const GA_PointGroup &group,
2138  bool override = true);
2139  GA_PrimitiveGroup *mergeGroup(const GEO_Detail &src,
2140  const GA_PrimitiveGroup &group,
2141  bool override = true);
2142  GA_VertexGroup *mergeGroup(const GEO_Detail &src,
2143  const GA_VertexGroup &group,
2144  GA_OffsetArray &map_cache,
2145  bool override = true);
2146  GA_EdgeGroup *mergeGroup(const GEO_Detail &src,
2147  const GA_EdgeGroup &group,
2148  bool override = true);
2149 
2150 protected:
2152  registerIntrinsics(GA_PrimitiveFactory &factory);
2153 
2154  GA_Size localIntrinsicTupleSize(
2155  GA_IntrinsicEval &eval) const override;
2156  GA_Size localGetIntrinsicS(GA_IntrinsicEval &eval,
2157  UT_String &value) const override;
2158  GA_Size localGetIntrinsicSA(GA_IntrinsicEval &eval,
2159  UT_StringArray &value) const override;
2160  GA_Size localGetIntrinsicD(GA_IntrinsicEval &eval,
2161  UT_OptionsHolder &value) const override;
2162  GA_Size localGetIntrinsicDA(GA_IntrinsicEval &eval,
2164  ) const override;
2165  GA_Size localGetIntrinsicI(GA_IntrinsicEval &eval,
2166  int64 *value, GA_Size size) const override;
2167  GA_Size localGetIntrinsicF(GA_IntrinsicEval &eval,
2168  fpreal64 *value, GA_Size size) const override;
2169  GA_Size localSetIntrinsicS(GA_IntrinsicEval &eval,
2170  const char *value) override;
2171  GA_Size localSetIntrinsicSA(GA_IntrinsicEval &eval,
2172  const UT_StringArray &value) override;
2173  GA_Size localSetIntrinsicSS(GA_IntrinsicEval &eval,
2174  const char **value, GA_Size size) override;
2175  GA_Size localSetIntrinsicDA(GA_IntrinsicEval &eval,
2177  ) override;
2178  GA_Size localSetIntrinsicDS(GA_IntrinsicEval &eval,
2179  const UT_OptionsHolder *value,
2180  GA_Size size) override;
2181  GA_Size localSetIntrinsicI(GA_IntrinsicEval &eval,
2182  const int64 *value, GA_Size size) override;
2183  GA_Size localSetIntrinsicF(GA_IntrinsicEval &eval,
2184  const fpreal64 *value, GA_Size size) override;
2185 
2186  GA_Detail::IOStatus saveH9Stream(std::ostream& os, bool binary,
2187  const GA_SaveOptions *options) const;
2188  GA_Detail::IOStatus loadH9(UT_IStream &is, const GA_LoadOptions *options);
2189 
2190  /// Simple stat of an H9 file. This only fills out the point/prim counts
2191  /// This assumes the magic number (32-bits) has already been read from the
2192  /// file.
2193  static GA_Detail::IOStatus statH9Basic(UT_IStream &is, GA_Stat &sbuf,
2194  bool binstream);
2195 
2196  bool convertIndexPairDataFromH9();
2197  bool convertIndexPairDataToH9();
2198 
2199  template<typename FLOAT_T>
2200  void transformInternal(const UT_Matrix4T<FLOAT_T> &mat,
2201  const GA_Range &prim_range,
2202  const GA_Range &pt_range,
2203  bool just_P,
2204  bool keep_vector_lengths,
2205  bool check_pasting,
2206  bool neg_determinant_flipvector,
2207  bool update_ptnormals,
2208  GEO_Delta *geodelta,
2209  bool updateaffectednormals,
2210  const char *attribpattern);
2211 
2212 private:
2213  GA_ElementGroup *mergeElementGroup(const GEO_Detail &src,
2214  const GA_ElementGroup &group,
2215  bool override = true);
2216 
2217 public:
2218  /// Some common methods for the standard guys
2219  GA_Attribute *addAttribute(const UT_StringHolder &name,
2220  const UT_Options *creation_args,
2221  const GA_AttributeOptions *attribute_options,
2222  const UT_StringRef &attribtype,
2223  GA_AttributeOwner who,
2225  GA_Attribute *growTuple(GA_AttributeOwner owner,
2226  GA_AttributeScope scope,
2227  const UT_StringRef &name,
2228  int added_size);
2231  const UT_StringRef &name,
2232  int added_size)
2233  {
2234  return growTuple(owner, GA_SCOPE_PUBLIC, name, added_size);
2235  }
2236  void destroyAttribute(GA_AttributeOwner owner,
2237  GA_AttributeScope scope,
2238  const UT_StringRef &name,
2239  const GA_AttributeFilter *filter = 0);
2242  const UT_StringRef &name,
2243  const GA_AttributeFilter *filter = 0)
2244  {
2245  destroyAttribute(owner, GA_SCOPE_PUBLIC, name,
2246  filter);
2247  }
2248 
2249  /// Convenience method to find floating point, int, or string tuples of a
2250  /// specified size range. If max_size or min_size are <= 0, then we won't
2251  /// perform the corresponding size check.
2252  /// @{
2253  const GA_Attribute *findFloatTuple(GA_AttributeOwner owner,
2254  GA_AttributeScope scope,
2255  const UT_StringRef &name,
2256  int min_size=1, int max_size=-1) const;
2259  const UT_StringRef &name,
2260  int min_size=1, int max_size=-1) const
2261  {
2262  return findFloatTuple(owner, GA_SCOPE_PUBLIC, name,
2263  min_size, max_size);
2264  }
2265  GA_Attribute *findFloatTuple(GA_AttributeOwner owner,
2266  GA_AttributeScope scope,
2267  const UT_StringRef &name,
2268  int min_size=1, int max_size=-1);
2271  const UT_StringRef &name,
2272  int min_size=1, int max_size=-1)
2273  {
2274  return findFloatTuple(owner, GA_SCOPE_PUBLIC, name,
2275  min_size, max_size);
2276  }
2277  const GA_Attribute *findIntTuple(GA_AttributeOwner owner,
2278  GA_AttributeScope scope,
2279  const UT_StringRef &name,
2280  int min_size=1, int max_size=-1) const;
2283  const UT_StringRef &name,
2284  int min_size=1, int max_size=-1) const
2285  {
2286  return findIntTuple(owner, GA_SCOPE_PUBLIC, name,
2287  min_size, max_size);
2288  }
2289  GA_Attribute *findIntTuple(GA_AttributeOwner owner,
2290  GA_AttributeScope scope,
2291  const UT_StringRef &name,
2292  int min_size=1, int max_size=-1);
2295  const UT_StringRef &name,
2296  int min_size=1, int max_size=-1)
2297  {
2298  return findIntTuple(owner, GA_SCOPE_PUBLIC, name,
2299  min_size, max_size);
2300  }
2301  /// findNumericTuple will find either float or int.
2302  const GA_Attribute *findNumericTuple(GA_AttributeOwner owner,
2303  GA_AttributeScope scope,
2304  const UT_StringRef &name,
2305  int min_size=1, int max_size=-1) const;
2308  const UT_StringRef &name,
2309  int min_size=1, int max_size=-1) const
2310  {
2311  return findNumericTuple(owner, GA_SCOPE_PUBLIC,
2312  name, min_size, max_size);
2313  }
2314  /// findNumericTuple will find either float or int.
2315  GA_Attribute *findNumericTuple(GA_AttributeOwner owner,
2316  GA_AttributeScope scope,
2317  const UT_StringRef &name,
2318  int min_size=1, int max_size=-1);
2321  const UT_StringRef &name,
2322  int min_size=1, int max_size=-1)
2323  {
2324  return findNumericTuple(owner, GA_SCOPE_PUBLIC,
2325  name, min_size, max_size);
2326  }
2327  const GA_Attribute *findStringTuple(GA_AttributeOwner owner,
2328  GA_AttributeScope scope,
2329  const UT_StringRef &name,
2330  int min_size=1, int max_size=-1) const;
2333  const UT_StringRef &name,
2334  int min_size=1, int max_size=-1) const
2335  {
2336  return findStringTuple(owner, GA_SCOPE_PUBLIC,
2337  name, min_size, max_size);
2338  }
2339  GA_Attribute *findStringTuple(GA_AttributeOwner owner,
2340  GA_AttributeScope scope,
2341  const UT_StringRef &name,
2342  int min_size=1, int max_size=-1);
2345  const UT_StringRef &name,
2346  int min_size=1, int max_size=-1)
2347  {
2348  return findStringTuple(owner, GA_SCOPE_PUBLIC,
2349  name, min_size, max_size);
2350  }
2351  const GA_Attribute *findIndexPair(GA_AttributeOwner owner,
2352  GA_AttributeScope scope,
2353  const UT_StringRef &name) const;
2356  const UT_StringRef &name) const
2357  {
2358  return findIndexPair(owner, GA_SCOPE_PUBLIC, name);
2359  }
2360  GA_Attribute *findIndexPair(GA_AttributeOwner owner,
2361  GA_AttributeScope scope,
2362  const UT_StringRef &name);
2365  const UT_StringRef &name)
2366  {
2367  return findIndexPair(owner, GA_SCOPE_PUBLIC, name);
2368  }
2369  const GA_Attribute *findFloatArray(GA_AttributeOwner owner,
2370  GA_AttributeScope scope,
2371  const UT_StringRef &name,
2372  int min_size=1, int max_size=-1) const;
2375  const UT_StringRef &name,
2376  int min_size=1, int max_size=-1) const
2377  {
2378  return findFloatArray(owner, GA_SCOPE_PUBLIC, name,
2379  min_size, max_size);
2380  }
2381  GA_Attribute *findFloatArray(GA_AttributeOwner owner,
2382  GA_AttributeScope scope,
2383  const UT_StringRef &name,
2384  int min_size=1, int max_size=-1);
2387  const UT_StringRef &name,
2388  int min_size=1, int max_size=-1)
2389  {
2390  return findFloatArray(owner, GA_SCOPE_PUBLIC, name,
2391  min_size, max_size);
2392  }
2393  const GA_Attribute *findIntArray(GA_AttributeOwner owner,
2394  GA_AttributeScope scope,
2395  const UT_StringRef &name,
2396  int min_size=1, int max_size=-1) const;
2399  const UT_StringRef &name,
2400  int min_size=1, int max_size=-1) const
2401  {
2402  return findIntArray(owner, GA_SCOPE_PUBLIC, name,
2403  min_size, max_size);
2404  }
2405  GA_Attribute *findIntArray(GA_AttributeOwner owner,
2406  GA_AttributeScope scope,
2407  const UT_StringRef &name,
2408  int min_size=1, int max_size=-1);
2411  const UT_StringRef &name,
2412  int min_size=1, int max_size=-1)
2413  {
2414  return findIntArray(owner, GA_SCOPE_PUBLIC, name,
2415  min_size, max_size);
2416  }
2417  const GA_Attribute *findNumericArray(GA_AttributeOwner owner,
2418  GA_AttributeScope scope,
2419  const UT_StringRef &name,
2420  int min_size=1, int max_size=-1) const;
2423  const UT_StringRef &name,
2424  int min_size=1, int max_size=-1) const
2425  {
2426  return findNumericArray(owner, GA_SCOPE_PUBLIC, name,
2427  min_size, max_size);
2428  }
2429  GA_Attribute *findNumericArray(GA_AttributeOwner owner,
2430  GA_AttributeScope scope,
2431  const UT_StringRef &name,
2432  int min_size=1, int max_size=-1);
2435  const UT_StringRef &name,
2436  int min_size=1, int max_size=-1)
2437  {
2438  return findNumericArray(owner, GA_SCOPE_PUBLIC, name,
2439  min_size, max_size);
2440  }
2441  const GA_Attribute *findStringArray(GA_AttributeOwner owner,
2442  GA_AttributeScope scope,
2443  const UT_StringRef &name,
2444  int min_size=1, int max_size=-1) const;
2447  const UT_StringRef &name,
2448  int min_size=1, int max_size=-1) const
2449  {
2450  return findStringArray(owner, GA_SCOPE_PUBLIC, name,
2451  min_size, max_size);
2452  }
2453  GA_Attribute *findStringArray(GA_AttributeOwner owner,
2454  GA_AttributeScope scope,
2455  const UT_StringRef &name,
2456  int min_size=1, int max_size=-1);
2459  const UT_StringRef &name,
2460  int min_size=1, int max_size=-1)
2461  {
2462  return findStringArray(owner, GA_SCOPE_PUBLIC, name,
2463  min_size, max_size);
2464  }
2465  const GA_Attribute *findDictArray(GA_AttributeOwner owner,
2466  GA_AttributeScope scope,
2467  const UT_StringRef &name,
2468  int min_size=1, int max_size=-1) const;
2471  const UT_StringRef &name,
2472  int min_size=1, int max_size=-1) const
2473  {
2474  return findDictArray(owner, GA_SCOPE_PUBLIC, name,
2475  min_size, max_size);
2476  }
2477  GA_Attribute *findDictArray(GA_AttributeOwner owner,
2478  GA_AttributeScope scope,
2479  const UT_StringRef &name,
2480  int min_size=1, int max_size=-1);
2483  const UT_StringRef &name,
2484  int min_size=1, int max_size=-1)
2485  {
2486  return findDictArray(owner, GA_SCOPE_PUBLIC, name,
2487  min_size, max_size);
2488  }
2489  /// @}
2490 
2491  /// @{
2492  /// Convenience method for adding a float, integer or string tuple
2493  /// attribute.
2494  ///
2495  /// If there's an existing attribute of the same name, the
2496  /// GA_ReuseStrategy will be used. By default, this will return
2497  /// the existing attribute if it is the same type. If not, it will
2498  /// try to replace it with a new one and copy the old data over.
2499  ///
2500  /// The attribute storage will be determined by the @c storage parameter.
2501  /// For example, if it's GA_STORE_REAL32 or GA_STORE_REAL16, a floating
2502  /// point tuple will be added. An integer tuple would be created for
2503  /// GA_STORE_INT64 and a string tuple for GA_STORE_STRING.
2504  ///
2505  /// The defaults will be ignored for string attributes.
2506  /// @note If you have a GA_StorageClass, you can call
2507  /// @c GAgetDefaultStorage(storageclass);
2508  GA_Attribute *addTuple(GA_Storage storage,
2509  GA_AttributeOwner owner,
2510  GA_AttributeScope scope,
2511  const UT_StringHolder &name,
2512  int tuple_size,
2513  const GA_Defaults &defaults = GA_Defaults(0.0),
2514  const UT_Options *creation_args = 0,
2515  const GA_AttributeOptions *attribute_options = 0,
2516  const GA_ReuseStrategy &reuse =
2517  GA_ReuseStrategy());
2520  GA_AttributeOwner owner,
2521  const UT_StringHolder &name,
2522  int tuple_size,
2523  const GA_Defaults &defaults = GA_Defaults(0.0),
2524  const UT_Options *creation_args = 0,
2525  const GA_AttributeOptions *attribute_options = 0,
2526  const GA_ReuseStrategy &reuse =
2527  GA_ReuseStrategy())
2528  {
2529  return addTuple(storage,
2530  owner,
2532  name,
2533  tuple_size,
2534  defaults,
2535  creation_args,
2536  attribute_options,
2537  reuse);
2538  }
2539  /// @}
2540 
2541  /// @{
2542  /// Convenience method to add a new floating point, int or string tuple
2543  /// attribute.
2544  ///
2545  /// If there's an existing attribute of the same name, the
2546  /// GA_ReuseStrategy will be used. By default, this will return
2547  /// the existing attribute if it is the same type. If not, it will
2548  /// try to replace it with a new one and copy the old data over.
2549  GA_Attribute *addFloatTuple(GA_AttributeOwner owner,
2550  GA_AttributeScope scope,
2551  const UT_StringHolder &name,
2552  int tuple_size,
2553  const GA_Defaults &defaults = GA_Defaults(0.0),
2554  const UT_Options *creation_args=0,
2555  const GA_AttributeOptions *attribute_options=0,
2556  GA_Storage storage = GA_STORE_REAL32,
2557  const GA_ReuseStrategy &reuse
2558  = GA_ReuseStrategy());
2561  const UT_StringHolder &name,
2562  int tuple_size,
2563  const GA_Defaults &defaults = GA_Defaults(0.0),
2564  const UT_Options *creation_args=0,
2565  const GA_AttributeOptions *attribute_options=0,
2566  GA_Storage storage = GA_STORE_REAL32,
2567  const GA_ReuseStrategy &reuse
2568  = GA_ReuseStrategy())
2569  {
2570  return addFloatTuple(owner, GA_SCOPE_PUBLIC, name,
2571  tuple_size, defaults,
2572  creation_args,
2573  attribute_options,
2574  storage, reuse);
2575  }
2576  GA_Attribute *addIntTuple(GA_AttributeOwner owner,
2577  GA_AttributeScope scope,
2578  const UT_StringHolder &name,
2579  int tuple_size,
2580  const GA_Defaults &defaults = GA_Defaults(0),
2581  const UT_Options *creation_args=0,
2582  const GA_AttributeOptions *attribute_options=0,
2583  GA_Storage storage = GA_STORE_INT32,
2584  const GA_ReuseStrategy &reuse
2585  = GA_ReuseStrategy());
2588  const UT_StringHolder &name,
2589  int tuple_size,
2590  const GA_Defaults &defaults = GA_Defaults(0),
2591  const UT_Options *creation_args=0,
2592  const GA_AttributeOptions *attribute_options=0,
2593  GA_Storage storage = GA_STORE_INT32,
2594  const GA_ReuseStrategy &reuse
2595  = GA_ReuseStrategy())
2596  {
2597  return addIntTuple(owner, GA_SCOPE_PUBLIC, name,
2598  tuple_size, defaults,
2599  creation_args,
2600  attribute_options,
2601  storage, reuse);
2602  }
2603 
2604  GA_Attribute *addStringTuple(GA_AttributeOwner owner,
2605  GA_AttributeScope scope,
2606  const UT_StringHolder &name,
2607  int tuple_size,
2608  const UT_Options *creation_args=0,
2609  const GA_AttributeOptions *attribute_options=0,
2610  const GA_ReuseStrategy &reuse
2611  = GA_ReuseStrategy());
2614  const UT_StringHolder &name,
2615  int tuple_size,
2616  const UT_Options *creation_args=0,
2617  const GA_AttributeOptions *attribute_options=0,
2618  const GA_ReuseStrategy &reuse
2619  = GA_ReuseStrategy())
2620  {
2621  return addStringTuple(owner, GA_SCOPE_PUBLIC,
2622  name, tuple_size, creation_args,
2623  attribute_options, reuse);
2624  }
2625 
2626  GA_Attribute *addDictTuple(GA_AttributeOwner owner,
2627  GA_AttributeScope scope,
2628  const UT_StringHolder &name,
2629  int tuple_size,
2630  const UT_Options *creation_args=0,
2631  const GA_AttributeOptions *attribute_options=0,
2632  const GA_ReuseStrategy &reuse
2633  = GA_ReuseStrategy());
2636  const UT_StringHolder &name,
2637  int tuple_size,
2638  const UT_Options *creation_args=0,
2639  const GA_AttributeOptions *attribute_options=0,
2640  const GA_ReuseStrategy &reuse
2641  = GA_ReuseStrategy())
2642  {
2643  return addDictTuple(owner, GA_SCOPE_PUBLIC,
2644  name, tuple_size, creation_args,
2645  attribute_options, reuse);
2646  }
2647  /// @}
2648 
2649  /// @{
2650  /// Convenience method to add a new floating point, or int array
2651  /// attribute.
2652  ///
2653  /// If there's an existing attribute of the same name, the
2654  /// GA_ReuseStrategy will be used. By default, this will return
2655  /// the existing attribute if it is the same type. If not, it will
2656  /// try to replace it with a new one and copy the old data over.
2657  GA_Attribute *addFloatArray(GA_AttributeOwner owner,
2658  GA_AttributeScope scope,
2659  const UT_StringHolder &name,
2660  int tuple_size = 1,
2661  const UT_Options *creation_args=0,
2662  const GA_AttributeOptions *attribute_options=0,
2663  GA_Storage storage = GA_STORE_REAL32,
2664  const GA_ReuseStrategy &reuse
2665  = GA_ReuseStrategy());
2668  const UT_StringHolder &name,
2669  int tuple_size = 1,
2670  const UT_Options *creation_args=0,
2671  const GA_AttributeOptions *attribute_options=0,
2672  GA_Storage storage = GA_STORE_REAL32,
2673  const GA_ReuseStrategy &reuse
2674  = GA_ReuseStrategy())
2675  {
2676  return addFloatArray(owner, GA_SCOPE_PUBLIC, name,
2677  tuple_size,
2678  creation_args,
2679  attribute_options,
2680  storage, reuse);
2681  }
2682  GA_Attribute *addIntArray(GA_AttributeOwner owner,
2683  GA_AttributeScope scope,
2684  const UT_StringHolder &name,
2685  int tuple_size = 1,
2686  const UT_Options *creation_args=0,
2687  const GA_AttributeOptions *attribute_options=0,
2688  GA_Storage storage = GA_STORE_INT32,
2689  const GA_ReuseStrategy &reuse
2690  = GA_ReuseStrategy());
2693  const UT_StringHolder &name,
2694  int tuple_size = 1,
2695  const UT_Options *creation_args=0,
2696  const GA_AttributeOptions *attribute_options=0,
2697  GA_Storage storage = GA_STORE_INT32,
2698  const GA_ReuseStrategy &reuse
2699  = GA_ReuseStrategy())
2700  {
2701  return addIntArray(owner, GA_SCOPE_PUBLIC, name,
2702  tuple_size,
2703  creation_args,
2704  attribute_options,
2705  storage, reuse);
2706  }
2707  GA_Attribute *addStringArray(GA_AttributeOwner owner,
2708  GA_AttributeScope scope,
2709  const UT_StringHolder &name, int tuple_size=1,
2710  const UT_Options *creation_args=0,
2711  const GA_AttributeOptions *attribute_options=0,
2712  GA_Storage storage = GA_STORE_STRING,
2713  const GA_ReuseStrategy &reuse
2714  = GA_ReuseStrategy());
2717  const UT_StringHolder &name, int tuple_size=1,
2718  const UT_Options *creation_args=0,
2719  const GA_AttributeOptions *attribute_options=0,
2720  GA_Storage storage = GA_STORE_STRING,
2721  const GA_ReuseStrategy &reuse
2722  = GA_ReuseStrategy())
2723  {
2724  return addStringArray(owner, GA_SCOPE_PUBLIC, name,
2725  tuple_size,
2726  creation_args,
2727  attribute_options,
2728  storage, reuse);
2729  }
2730  GA_Attribute *addDictArray(GA_AttributeOwner owner,
2731  GA_AttributeScope scope,
2732  const UT_StringHolder &name, int tuple_size=1,
2733  const UT_Options *creation_args=0,
2734  const GA_AttributeOptions *attribute_options=0,
2735  GA_Storage storage = GA_STORE_STRING,
2736  const GA_ReuseStrategy &reuse
2737  = GA_ReuseStrategy());
2740  const UT_StringHolder &name, int tuple_size=1,
2741  const UT_Options *creation_args=0,
2742  const GA_AttributeOptions *attribute_options=0,
2743  GA_Storage storage = GA_STORE_STRING,
2744  const GA_ReuseStrategy &reuse
2745  = GA_ReuseStrategy())
2746  {
2747  return addDictArray(owner, GA_SCOPE_PUBLIC, name,
2748  tuple_size,
2749  creation_args,
2750  attribute_options,
2751  storage, reuse);
2752  }
2753  /// @}
2754 
2755  /// Magic number for ASCII geometry files
2756  static inline int asciiMagicH9()
2757  {
2758  return (('P'<<24) + ('G'<<16) + ('E'<<8) + 'O');
2759  }
2760  /// Magic number for binary geometry files
2761  static inline int binaryMagicH9()
2762  {
2763  return (('B'<<24) + ('g'<<16) + ('e'<<8) + 'o');
2764  }
2765 
2766 private:
2767  bool loadPointsH9(UT_IStream &is, int count,
2769  bool savePointsH9(std::ostream &os, bool binary,
2770  const UT_Array<GA_AttribSaveDataH9> &) const;
2771  bool savePointH9(std::ostream &os, bool binary, GA_Offset offset,
2772  const UT_Array<GA_AttribSaveDataH9> &) const;
2773  bool saveExtraH9(std::ostream &os, bool binary,
2774  const UT_Array<const GA_Primitive*> &) const;
2775  bool loadExtraH9(UT_IStream &is);
2776  bool loadVersionH9(UT_IStream &is, int binary);
2777 
2778 //
2779 // Friends
2780  friend std::ostream &operator<<(std::ostream &os, const GEO_Detail &d)
2781  {
2782  d.saveClassic(
2783  os, /*binary*/ false, /*options*/ nullptr);
2784  return os;
2785  }
2786 
2787  friend class GEO_IOTable; // For loadH9/saveH9
2788  friend class GU_IOClassic; // For loadH9/saveH9
2789 
2790 protected:
2791 
2792  /// This is here just so that GA_AttributeSet::jsonSave() can call
2793  /// GEOcomputeNormals()
2794  void privateComputeNormal(
2795  const GA_RWHandleV3 &normalattrib,
2796  const GA_Group *group,
2797  const float cuspangledegrees,
2798  const int method) const override;
2799 
2800 // The compiler reports some deprecated overrides here
2802 };
2804 
2805 #endif
UT_ValArray< EdgeAdjacencyData > GEO_EdgeAdjArray
Definition: GEO_Detail.h:2048
GLdouble s
Definition: glew.h:1390
void destroyPrimitiveGroup(GA_PrimitiveGroup *g)
Definition: GEO_Detail.h:2112
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:2692
GLbyte * weights
Definition: glew.h:7551
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:2332
GLenum GLint * range
Definition: glew.h:3500
Definition of a geometry attribute.
Definition: GA_Attribute.h:196
SYS_FORCE_INLINE GA_Attribute * addPointAttrib(const GA_Attribute *src)
Definition: GEO_Detail.h:1641
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:2422
void incrementMetaCacheCount()
Definition: GA_Detail.h:2274
Specify when and how to reuse an existing attribute.
GLsizeiptr size
Definition: glew.h:1681
GLenum src
Definition: glew.h:2410
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:1681
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:2320
GLuint const GLchar * name
Definition: glew.h:1814
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:643
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:2294
GEO_Capture_Bone_Property
Definition: GEO_Detail.h:191
GLenum mode
Definition: glew.h:2163
Class which stores the default values for a GA_Attribute.
Definition: GA_Defaults.h:35
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:2739
GLuint GLenum GLenum transform
Definition: glew.h:14742
GA_DataIdStrategy
Definition: GA_Types.h:208
#define SYS_DEPRECATED_PUSH_DISABLE()
#define SYS_DEPRECATED_POP_DISABLE()
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:1798
bool GAisValid(GA_Size v)
Definition: GA_Types.h:647
GLuint GLuint GLfloat weight
Definition: glew.h:13609
void clearAndDestroy()
Clear all the points/primitives out of this detail.
Definition: GEO_Detail.h:254
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:9477
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:2519
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:1719
bool deletePrimitive(GA_Primitive &prim, bool and_points=false)
Definition: GEO_Detail.h:1207
UT_ValArray< PointAdjacencyData > GEO_PointAdjArray
Definition: GEO_Detail.h:2047
SYS_FORCE_INLINE GA_Attribute * findGlobalAttrib(const GA_Attribute &src)
Definition: GEO_Detail.h:1868
SYS_FORCE_INLINE GA_Attribute * findIndexPair(GA_AttributeOwner owner, const UT_StringRef &name)
Definition: GEO_Detail.h:2364
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:2344
void destroyVertexGroup(GA_VertexGroup *g)
Definition: GEO_Detail.h:2114
SYS_FORCE_INLINE void destroyVertexAttrib(GA_AttributeScope scope, const UT_StringRef &n, const GA_AttributeFilter *filter=NULL)
Definition: GEO_Detail.h:1766
IOStatus saveClassic(const char *, const GA_SaveOptions *) const
const GLdouble * v
Definition: glew.h:1391
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:2258
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
GLenum GLint GLuint mask
Definition: glew.h:1845
static int binaryMagicH9()
Magic number for binary geometry files.
Definition: GEO_Detail.h:2761
UT_Vector3T< FLOAT_T > myUpVector
Definition: GEO_Detail.h:786
const UT_StringHolder & getName() const
Definition: GA_Attribute.h:280
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:233
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 GLdouble GLdouble GLint GLint order
Definition: glew.h:3446
void pad(T &out, int n)
Definition: ImfXdr.h:599
void removeVariableName(const char *varname)
Definition: GEO_Detail.h:1625
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:1741
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:2482
A string map of attributes to ease backward compatibility In the GB/GEO/GU library code would often p...
SYS_FORCE_INLINE GEO_Primitive * getGEOPrimitive(GA_Offset primoff)
Definition: GEO_Detail.h: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:1789
double fpreal64
Definition: SYS_Types.h:201
SYS_FORCE_INLINE GA_Attribute * findPrimAttrib(const GA_Attribute &src)
Definition: GEO_Detail.h:1815
GA_Size GA_Offset
Definition: GA_Types.h:639
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:1728
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
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glew.h:2981
GLfloat GLfloat GLfloat v2
Definition: glew.h:1856
SYS_FORCE_INLINE const GA_Attribute * findPointAttrib(const GA_Attribute &src) const
Definition: GEO_Detail.h:1671
bool operator!=(const SoftSymmetryParms &other) const
Definition: GEO_Detail.h:571
UT_Matrix3T< FLOAT_T > myOrient
Definition: GEO_Detail.h:789
SYS_FORCE_INLINE GA_Attribute * addPrimAttrib(const GA_Attribute *src)
Definition: GEO_Detail.h:1782
CaptureType
Methods for manipulating capture weights (GEO_CaptureWeight.C)
Definition: GEO_Detail.h:982
GLclampf f
Definition: glew.h:3499
SYS_FORCE_INLINE GA_Attribute * findVertexAttrib(const GA_Attribute &src)
Definition: GEO_Detail.h:1745
SYS_FORCE_INLINE const GA_Attribute * findGlobalAttrib(const GA_Attribute &src) const
Definition: GEO_Detail.h:1864
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:2587
friend std::ostream & operator<<(std::ostream &os, const GEO_Detail &d)
Definition: GEO_Detail.h:2780
SYS_FORCE_INLINE bool promotePointAttrib(const UT_StringRef &name)
Definition: GEO_Detail.h:1708
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:2667
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:1844
UT_BoundingBoxT< float > UT_BoundingBox
Definition: GEO_Detail.h:43
SYS_FORCE_INLINE void destroyAttribute(GA_AttributeOwner owner, const UT_StringRef &name, const GA_AttributeFilter *filter=0)
Definition: GEO_Detail.h:2241
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
const GLuint GLenum const void * binary
Definition: glew.h:3502
SYS_FORCE_INLINE void destroyPrimAttrib(const UT_StringRef &n, const GA_AttributeFilter *filter=NULL)
Definition: GEO_Detail.h:1828
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:2307
UT_ColorRamp
Definition: UT_Color.h:32
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
SYS_FORCE_INLINE GA_Offset appendPoint()
Append a new point, returning its new data offset.
Definition: GA_Detail.h:277
void
Definition: png.h:1083
GLsizei n
Definition: glew.h:4040
GLuint GLsizei GLsizei * length
Definition: glew.h:1825
GLsizei GLsizei GLfloat distance
Definition: glew.h:13640
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:2470
#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:2374
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:2270
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:1751
HUSD_API bool eval(VtValue &val, T &ret_val)
const GEO_Primitive * getGEOPrimitiveByIndex(GA_Index idx) const
Definition: GEO_Detail.h:1189
#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:1658
GEO_Primitive GB_MACRO_PRIM_TYPE
Definition: GEO_Detail.h:1913
GridType::Ptr normalize(const GridType &grid, bool threaded, InterruptT *interrupt)
Normalize the vectors of the given vector-valued grid.
SYS_FORCE_INLINE const GA_Attribute * findIndexPair(GA_AttributeOwner owner, const UT_StringRef &name) const
Definition: GEO_Detail.h:2355
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:633
GA_AttributeScope getScope() const
Definition: GA_Attribute.h:210
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
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:2230
GA_TypeInfo
Definition: GA_Types.h:99
SYS_FORCE_INLINE GA_Attribute * findPointAttrib(const GA_Attribute &src)
Definition: GEO_Detail.h:1675
SYS_FORCE_INLINE void destroyPointAttrib(const UT_StringRef &n, const GA_AttributeFilter *filter=NULL)
Definition: GEO_Detail.h:1701
SYS_FORCE_INLINE const GA_AttributeDict & attribs() const
Definition: GEO_Detail.h:1908
bool destroyPointGroup(const char *name)
Definition: GEO_Detail.h:2116
LocalXformContextT(const UT_Matrix3T< FLOAT_T > &orient, const UT_Vector3T< FLOAT_T > &origin, PivotSpace pivot_space)
Definition: GEO_Detail.h:778
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:2386
GEO_Primitive * getGEOPrimitiveByIndex(GA_Index idx)
Definition: GEO_Detail.h:1182
IFDmantra py
Definition: HDK_Image.dox:266
Contains transitional objects to provide some backward compatibility for code that references old GEO...
GEO_API const TypeMask GEOPRIMALL
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:1811
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:2458
SYS_FORCE_INLINE GA_Attribute * findPointVectorAttrib(GA_AttributeScope s, const UT_StringRef &n)
Definition: GEO_Detail.h:1688
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:1854
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:2635
GLuint counter
Definition: glew.h:2740
SYS_FORCE_INLINE bool demoteVertexAttrib(const UT_StringRef &name)
Definition: GEO_Detail.h:1778
SYS_FORCE_INLINE const GA_Attribute * findPointVectorAttrib(const UT_StringRef &n) const
Definition: GEO_Detail.h:1685
GA_Primitive * appendPrimitive(const GA_PrimitiveTypeId &type)
Append a primitive by GA_PrimitiveTypeId.
int getValue() const
Definition: GEO_Detail.h:1483
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:2410
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:2756
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:2398
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:1837
SYS_FORCE_INLINE const GA_AttributeDict & primitiveAttribs() const
Definition: GEO_Detail.h:1900
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
void destroyPointGroup(GA_PointGroup *g)
Definition: GEO_Detail.h:2110
GEO_Capture_Muscle_Property
Definition: GEO_Detail.h:198
GLuint GLdouble GLdouble GLint GLint const GLdouble * points
Definition: glew.h:3446
OIIO_API bool copy(string_view from, string_view to, std::string &err)
GLuint GLuint GLsizei count
Definition: glew.h:1253
GLint GLboolean GLint layer
Definition: glew.h:3601
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:2434
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:2560
bool destroyPrimitiveGroup(const char *name)
Definition: GEO_Detail.h:2119
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:2716
#define GA_INVALID_INDEX
Definition: GA_Types.h:675
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:1648
SYS_FORCE_INLINE GA_Attribute * findVertexVectorAttrib(const UT_StringRef &n)
Definition: GEO_Detail.h:1762
SYS_FORCE_INLINE GA_Attribute * findPointVectorAttrib(const UT_StringRef &n)
Definition: GEO_Detail.h:1692
GLuint64EXT * result
Definition: glew.h:14007
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:2282
UT_Vector3T< FLOAT_T > myOrigin
Definition: GEO_Detail.h:790
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:1771
#define const
Definition: zconf.h:214
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:1712
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:2613
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:2446
SYS_FORCE_INLINE void destroyGlobalAttrib(GA_AttributeScope scope, const UT_StringRef &n, const GA_AttributeFilter *filter=NULL)
Definition: GEO_Detail.h:1872
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:1696
Class to specify options for loading geometry.
GEO_Standard_Attributes
Definition: GEO_Detail.h:152
SYS_FORCE_INLINE GA_Attribute * findVertexVectorAttrib(GA_AttributeScope s, const UT_StringRef &n)
Definition: GEO_Detail.h:1758
SYS_FORCE_INLINE void destroyGlobalAttrib(const UT_StringRef &n, const GA_AttributeFilter *filter=NULL)
Definition: GEO_Detail.h:1877
GLsizei const GLfloat * value
Definition: glew.h:1849
GA_Storage
Definition: GA_Types.h:49
GLdouble GLdouble t
Definition: glew.h:1398
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
GLfloat GLfloat v1
Definition: glew.h:1852
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:2122
SYS_FORCE_INLINE const GA_Attribute * findVertexVectorAttrib(const UT_StringRef &n) const
Definition: GEO_Detail.h:1755
SYS_FORCE_INLINE const GA_AttributeDict & vertexAttribs() const
Definition: GEO_Detail.h:1904
GLboolean GLuint group
Definition: glew.h:2745
GLboolean GLboolean g
Definition: glew.h:9477
SYS_FORCE_INLINE void destroyPrimAttrib(GA_AttributeScope scope, const UT_StringRef &n, const GA_AttributeFilter *filter=NULL)
Definition: GEO_Detail.h:1820
GLintptr offset
Definition: glew.h:1682