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  void normal(UT_Vector3DArray &output, bool use_internaln = true) const;
973 
974  /// Compute normals into the existing attribute given. The attribute
975  /// can be detached, and the detail won't ever be modified.
976  void normal(const GA_RWHandleV3 &attrib,
977  const GA_PrimitiveGroup *primgroup = NULL) const;
978 
979  /// Add and compute vertex normal attributes. Returns the normals.
980  void getVertexNormals(UT_Vector3Array &output) const;
981 
982  /// Methods for manipulating capture weights (GEO_CaptureWeight.C)
984  {
985  CAPTURE_BONE = 0,
989  CAPTURE_MUSCLE
990  };
991 
992  /// Get the name of the point attribute which contains (region, weight)
993  /// pairs of capture data.
994  static const UT_StringHolder
995  &getPointCaptureAttribName(CaptureType type);
996 
997  /// Get the name of the property which contains an index of
998  /// region names (like capture regions and metaball groups). Returns NULL
999  /// if no such region mapping exists for a type.
1000  static const char *getPointCaptureIndexPropertyName(CaptureType type);
1001 
1002  /// Get the name of the detail attribute for capture frame. Returns NULL
1003  /// if a capture type doesn't use capture frame.
1004  static const UT_StringHolder
1005  &getPointCaptureFrameAttribName(CaptureType type);
1006 
1007  /// Get the name of the detail attribute for capture root. Returns NULL
1008  /// if a capture type doesn't use capture frame.
1009  static const UT_StringHolder
1010  &getPointCaptureRootAttribName(CaptureType type);
1011 
1012  /// Get the name of the property for capture data (usually,
1013  /// a linear array of transformation matrices + possibly other data).
1014  /// Returns NULL if a capture type doesn't use a capture data attribute.
1015  static const char *getPointCaptureDataPropertyName(CaptureType type);
1016 
1017  // Get the cregion root path. Returns true if successful with the value
1018  // in root_path.
1019  bool getCaptureRegionRootPath(UT_String &root_path,
1020  CaptureType t = CAPTURE_BONE) const;
1021  bool setCaptureRegionRootPath(const UT_String &root_path,
1022  CaptureType t = CAPTURE_BONE);
1023 
1024  /// Given a string representing a capture region for type t, return that
1025  /// region's index. -1 is returned if no index exists.
1026  int getCaptureRegionIndex(const UT_String &cregion_name,
1027  CaptureType t = CAPTURE_BONE);
1028 
1029  /// Add a new bone capture region. Sets the detail's capture transforms
1030  /// for the new region. Returns the index for this new region or -1 for
1031  /// failure.
1032  int addCaptureRegion(const UT_String &cregion_name,
1033  const UT_Matrix4 &parent_xform,
1034  const GEO_Detail *tube_gdp);
1035  int addCaptureRegion(const UT_String &cregion_name,
1036  const UT_Matrix4 &xform, float tcap, float bcap,
1037  float taperx, float taperz);
1038 
1039  /// Add a non-bone capture capture region of type type to this detail.
1040  /// Returns the index for this new region, or -1 for failure.
1041  int addCaptureRegion(const UT_String &cregion_name,
1042  CaptureType type);
1043 
1044  /// Delete a capture region (detail and point attributes) data.
1045  /// Return index of deleted attribute, -1 if cannot delete capture region
1046  int removeCaptureRegion(const UT_String &cregion_name,
1047  CaptureType t = CAPTURE_BONE);
1048 
1049  /// Set the capture weight on a group of points
1050  void setCaptureWeight(int cregion_index, float weight,
1051  const GA_PointGroup *ptgroup = NULL,
1052  GEO_Delta *geodelta = NULL,
1053  bool add_weight = false,
1054  bool clamp_negative = false,
1055  bool normalizeweight = false,
1056  CaptureType t = CAPTURE_BONE);
1057 
1058  /// Set the capture weight on a point
1059  void setCaptureWeight(int cregion_index, float weight,
1060  GA_Offset ptoff,
1061  GEO_Delta *geodelta = NULL,
1062  bool add_weight = false,
1063  bool clamp_negative = false,
1064  bool normalizeweight = false,
1065  CaptureType t = CAPTURE_BONE);
1066 
1067  /// Get the capture weight of a point
1068  float getCaptureWeight(int cregion_index, GA_Offset ptoff,
1069  CaptureType t = CAPTURE_BONE) const;
1070 
1071  /// Get the average capture weight of a set of points
1072  bool addAverageCaptureWeight(const GA_PointGroup *ptgroup,
1073  const UT_String &root_path,
1074  UT_StringMap<float *> &averages ) const;
1075 
1076  void getCaptureWeights(GA_Offset ptoff, UT_IntArray &regions,
1078  CaptureType t = CAPTURE_BONE) const;
1079  void clearCaptureWeights(GA_Offset ptoff,
1080  CaptureType t = CAPTURE_BONE);
1081 
1083  {
1085  VISTYPE_MULTIPLE
1086  };
1087 
1088  /// Color points according to their capture (normalized) weight
1089  void colorPointsByCaptureWeight(
1090  const UT_Array<const UT_Vector3 *> &colors,
1091  const UT_Vector3 &zero_weight_color,
1092  CaptureType t = CAPTURE_BONE,
1093  VisualizationType vistype = VISTYPE_MULTIPLE,
1094  UT_ColorRamp singlevismode = UT_COLORRAMP_FALSE);
1095 
1096  /// Color points according to their capture weight, with option to
1097  /// normalize the weights for visualization.
1098  void colorPointsByCaptureWeight(
1099  const UT_Array<const UT_Vector3 *> &colors,
1100  const UT_Vector3 &zero_weight_color,
1101  CaptureType t,
1102  VisualizationType vistype,
1103  UT_ColorRamp singlevismode,
1104  bool normalize);
1105 
1106  void normalizeCaptureWeights(const GA_PointGroup *ptgroup = nullptr,
1107  CaptureType t = CAPTURE_BONE,
1108  fpreal tolerance = SYS_FTOLERANCE_R);
1109 
1110  /// clamp the capture weights to the given low/hi values, if the
1111  /// corresponding flag is true and the capture weight is below/above
1112  /// the corresponding threshold. If low/hi flag is false, the capture
1113  /// weight will be unaffected for respecive clamping.
1114  void clampCaptureWeights(const GA_PointGroup *ptgroup = NULL,
1115  bool clamp_low_flag = true,
1116  float low_threshold = 0.0f, float low_val = 0.0f,
1117  bool clamp_hi_flag = false,
1118  float hi_threshold = 1.0f, float hi_val = 1.0f,
1119  CaptureType t = GEO_Detail::CAPTURE_BONE);
1120 
1121  /// This specifies a capture index that is exempt from normalization.
1122  void normalizeRelativeCaptureWeights(int idx, GA_Offset ptoff,
1123  GEO_Delta *delta=NULL);
1124 
1125  ///
1126  /// Methods for adding to the point list.
1127  ///
1128  GA_Offset insertPointOffset(GA_Index beforeWhich = GA_INVALID_INDEX);
1131  /// Insert a point, copying data from the source point. If the @c
1132  /// beforeWhich index isn't specified, the point will be added at the
1133  /// end of the point list.
1134  GA_Offset insertPointCopy(GA_Offset src,
1135  GA_PointWrangler &wrangler,
1136  GA_Index beforeWhich = GA_INVALID_INDEX);
1137  /// Insert a point, copying data from the source point. If the @c
1138  /// beforeWhich index isn't specified, the point will be added at the
1139  /// end of the point list.
1140  /// @note It is more efficient to use the GA_PointWrangler version.
1141  GA_Offset insertPointCopy(GA_Offset src,
1142  GA_Index beforeWhich = GA_INVALID_INDEX);
1143 
1144  /// Append a point, copying data from the source point.
1146  { return insertPointCopy(src, wrangler); }
1147  /// Append a point, copying data from the source point.
1148  /// @note It is more efficient to use the GA_PointWrangler version.
1150  { return insertPointCopy(src); }
1151 
1152  /// Provide a few additional overloads of deletePoints() in addition
1153  /// to those available in GA_Detail.
1155  GA_Size deletePoints(const GA_PointGroup &point_group,
1156  GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES)
1157  {
1158  return destroyPoints(GA_Range(point_group), mode);
1159  }
1160 
1161  /// Get a GEO_Primitive pointer by primitive offset
1162  /// @{
1165  {
1166  if (!GAisValid(primoff))
1167  return NULL;
1168  // reinterpret_cast to avoid including header
1169  return reinterpret_cast<GEO_Primitive*>(
1170  getPrimitive(primoff));
1171  }
1174  {
1175  if (!GAisValid(off))
1176  return NULL;
1177  return reinterpret_cast<const GEO_Primitive*>(
1178  getPrimitive(off));
1179  }
1180  /// @}
1181 
1182  /// Get a GEO_Primitive pointer by primitive index
1183  /// @{
1185  {
1186  if (!GAisValid(idx))
1187  return NULL;
1188  return reinterpret_cast<GEO_Primitive*>(
1189  getPrimitiveByIndex(idx));
1190  }
1192  {
1193  if (!GAisValid(idx))
1194  return NULL;
1195  return reinterpret_cast<const GEO_Primitive*>(
1196  getPrimitiveByIndex(idx));
1197  }
1198  /// @}
1199 
1200  /// @{
1201  /// GA uses "destroy" instead of "delete" as the verb. However, the old
1202  /// GEO/GB code made extensive use of "delete". These methods are to save
1203  /// the sanity of people trying to port code.
1205  GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES)
1206  { return destroyPoints(range, mode); }
1207  GA_Size deletePrimitives(const GA_Range &range, bool and_points=false)
1208  { return destroyPrimitives(range, and_points); }
1209  bool deletePrimitive(GA_Primitive &prim, bool and_points=false)
1210  { return destroyPrimitive(prim, and_points); }
1211  /// @}
1212 
1213  /// Inserting and appending a new primitive
1214  /// Insertion works the same way as insertion of points. However, the
1215  /// primitive is not allocated beforehand, leaving this to the allocator.
1216  /// If the source primitive is from another detail, our primitive attribute
1217  /// dictionary must be an extension of that detail's (see
1218  /// sortAllAttributes()). Note that this last condition is the reverse of
1219  /// that for inserting or appending a copy of a point.
1220  GEO_Primitive *insertPrimitive(const GA_PrimitiveTypeId &type,
1221  const GEO_Primitive *beforeWhich = NULL);
1224  {
1225  return static_cast<GEO_Primitive *>(GA_Detail::appendPrimitive(type));
1226  }
1227 
1228  /// Provide a few additional overloads of deletePrimitives() in addition
1229  /// to those available in GA_Detail.
1230  GA_Size deletePrimitives(const GA_PrimitiveGroup &primGrp,
1231  bool and_points = false);
1232  GA_Size deletePrimitives(
1233  const UT_Array<GEO_Primitive*> &prims_in,
1234  bool and_points = false);
1235 
1236  /// Delete a whole group of breakpoints.
1237  /// @note The group is cleared when done (non-const operation)
1238  virtual void deleteBreakpoints(const GA_BreakpointGroup &bkptgrp);
1239 
1240  // Find the bounding box (optionally of a group of primitives)
1241  // instantiation. Returns false if the box is empty and true otherwise.
1242  bool getBBox(UT_BoundingBox *bbox,
1243  const GA_PrimitiveGroup *g = nullptr) const;
1244 
1245  /// Find the bounding box (optionally of a group of primitives) of
1246  /// transformed instantiation. Returns false if the box is empty and true
1247  /// otherwise.
1248  bool getBBox(UT_BoundingBox &bbox,
1249  const UT_Matrix4R &transform,
1250  const GA_PrimitiveGroup *g = nullptr) const;
1251 
1252  bool getBSphere(UT_BoundingSphere *bsphere,
1253  const GA_PrimitiveGroup *g = nullptr,
1254  bool accurate_bounds = false) const;
1255 
1256  /// Find the bounding box (optionally of a group of points)
1257  /// instantiation. Returns false if the box is empty and true otherwise.
1258  bool getPointBBox(
1259  UT_BoundingBox *bbox,
1260  const GA_PointGroup *g = nullptr) const;
1261  bool getPointBBox(
1262  UT_BoundingBox& bbox,
1263  const UT_Matrix4R &transform,
1264  const GA_PointGroup *g = nullptr) const;
1265  bool getPointBSphere(
1266  UT_BoundingSphere *bsphere,
1267  const GA_PointGroup *g = nullptr,
1268  bool accurate_bounds = false) const;
1269  bool getVertexBBox(
1270  UT_BoundingBox *bbox,
1271  const GA_VertexGroup *g = nullptr) const;
1272  bool getVertexBBox(
1273  UT_BoundingBox& bbox,
1274  const UT_Matrix4R &transform,
1275  const GA_VertexGroup *g = nullptr) const;
1276  bool getEdgeBBox(
1277  UT_BoundingBox &bbox,
1278  const GA_EdgeGroup &grp) const;
1279  bool getEdgeBBox(
1280  UT_BoundingBox &bbox,
1281  const UT_Matrix4R &transform,
1282  const GA_EdgeGroup &grp) const;
1283  bool getEdgeBSphere(
1284  UT_BoundingSphere &bsphere,
1285  const GA_EdgeGroup &grp,
1286  bool accurate_bounds = false) const;
1287  bool getBreakpointBBox(
1288  UT_BoundingBox &bbox,
1289  const GA_BreakpointGroup &grp) const;
1290  bool getBreakpointBBox(
1291  UT_BoundingBox &bbox,
1292  const UT_Matrix4R &transform,
1293  const GA_BreakpointGroup &grp) const;
1294  bool getBreakpointBSphere(
1295  UT_BoundingSphere &bsphere,
1296  const GA_BreakpointGroup &grp,
1297  bool accurate_bounds = false) const;
1298  bool getGroupBBox(
1299  UT_BoundingBox *bbox,
1300  const GA_Group *grp) const;
1301  bool getGroupBBox(
1302  UT_BoundingBox& bbox,
1303  const UT_Matrix4R &transform,
1304  const GA_Group *grp) const;
1305  bool getGroupBSphere(
1306  UT_BoundingSphere *bsphere,
1307  const GA_Group *grp,
1308  bool accurate_bounds) const;
1309 
1310  /// The following method computes either a 2D or 3D bounding box
1311  /// for the specified float attribute.
1312  bool getPointAttribBBox(
1313  const UT_StringRef &name,
1314  UT_BoundingBox *bbox,
1315  const GA_PointGroup *g = nullptr) const;
1316  bool getPointAttribBBox(
1317  const UT_StringRef &name,
1318  UT_BoundingBox *bbox,
1319  const GA_PrimitiveGroup &g) const;
1320  bool getPointAttribBBox(
1321  const UT_StringRef &name,
1322  UT_BoundingBox *bbox,
1323  const GA_EdgeGroup &g) const;
1324  bool getPointAttribBBox(
1325  const UT_StringRef &name,
1326  UT_BoundingBox *bbox,
1327  const GA_VertexGroup &g) const;
1328 
1329  /// Compute the 3D centroid with the given attribute and group.
1330  /// typename T can either be single or double precision.
1331  /// Returns false if there are no points. Behaviour is undefined if the
1332  /// attribute has less than 3 components.
1333  template <typename T>
1334  bool getPointAttribCentroid(
1335  UT_Vector3T<T> &centroid,
1336  const GA_Attribute &attrib,
1337  const GA_PointGroup *grp = nullptr) const;
1338 
1339  bool getPointAttribGroupBBox(
1340  const UT_StringRef &name,
1341  UT_BoundingBox *bbox,
1342  const GA_Group *grp) const;
1343 
1344  bool getVertexAttribBBox(
1345  const UT_StringRef &name,
1346  UT_BoundingBox *bbox,
1347  const GA_PointGroup *g = nullptr) const;
1348  bool getVertexAttribBBox(
1349  const UT_StringRef &name,
1350  UT_BoundingBox *bbox,
1351  const GA_PrimitiveGroup &g) const;
1352  bool getVertexAttribBBox(
1353  const UT_StringRef &name,
1354  UT_BoundingBox *bbox,
1355  const GA_EdgeGroup &g) const;
1356  bool getVertexAttribBBox(
1357  const UT_StringRef &name,
1358  UT_BoundingBox *bbox,
1359  const GA_VertexGroup &g) const;
1360  bool getVertexAttribGroupBBox(
1361  const UT_StringRef &name,
1362  UT_BoundingBox *bbox,
1363  const GA_Group *grp) const;
1364 
1365  /// Copy vertex attributes from source to destination
1366  SYS_DEPRECATED_HDK(13.0)
1367  void copyVertexAttributes(GEO_Vertex dest,
1369  void copyVertexAttributes(GA_Offset dest, GA_Offset src,
1370  GA_VertexWrangler &wrangler) const;
1371  /// Copy vertex AND point attributes
1372  SYS_DEPRECATED_HDK(13.0)
1373  void copyPointVertexAttributes(GEO_Vertex dest,
1374  const GEO_Vertex &src,
1375  bool copy_point_P = true) const;
1376  void copyPointVertexAttributes(
1377  GA_Offset dest_vtx, GA_Offset src_vtx,
1378  const GA_AttributeRefMap &vertex_attribs,
1379  const GA_AttributeRefMap &point_attribs);
1380  void copyPointVertexAttributes(
1381  GA_Offset dest_vtx, GA_Offset src_vtx,
1382  GA_VertexWrangler &vertex_wrangler,
1383  GA_PointWrangler &point_wrangler,
1384  bool copy_point_P)
1385  {
1386  copyVertex(dest_vtx, src_vtx, vertex_wrangler,
1387  point_wrangler, copy_point_P);
1388  }
1389  /// Copy vertex attributes AND change the point reference of the vertex
1390  SYS_DEPRECATED_HDK(13.0)
1391  void copyFullVertex(GEO_Vertex dest,
1393  /// Copy vertex attributes AND change the point reference of the vertex
1394  void copyFullVertex(GA_Offset dest_vtx,
1395  GA_Offset src_vtx,
1396  GA_VertexWrangler &vertex_wrangler)
1397  {
1398  copyVertex(dest_vtx, src_vtx, vertex_wrangler,
1399  NULL);
1400  }
1401  /// Copy primitive attributes
1402  void copyPrimitiveAttributes(GEO_Primitive &dest,
1403  const GEO_Primitive &src);
1404 
1405  void copyPrimitiveGroups(GEO_Primitive &dest,
1406  const GEO_Primitive &src) const;
1407 
1408  /// Create a copy of the source vertex. Regardless of the "shallow" parm,
1409  /// this method will copy the vertex attribute data. If not shallow, it
1410  /// will also copy the point attribute data and will assign the source
1411  /// point position to the destination point. If shallow, it will assign the
1412  /// source point offset to the destination.
1413  SYS_DEPRECATED_HDK(13.0)
1414  void copyVertex(GEO_Vertex dest, const GEO_Vertex &src,
1415  int shallow = 0) const;
1416 
1417  /// Inherit the simple version of copyVertex from GA_Detail.
1418  using GA_Detail::copyVertex;
1419 
1420  /// Create a copy of the source vertex, copying only the vertex attributes
1421  /// specified by "vertex_attribs" and only the point attributes specified
1422  /// by the optional "point_attribs". If "point_attribs" is NULL, then a
1423  /// shallow point copy is performed wiring the source's point (if any) to
1424  /// dest.
1425  void copyVertex(GA_Offset dest, GA_Offset src,
1426  GA_AttributeRefMap &vertex_attribs,
1427  GA_AttributeRefMap *point_attribs);
1428 
1429  /// Create a copy of the source vertex using the supplied wranglers to
1430  /// copy attributes. If "point_wrangler" is NULL, then a shallow point
1431  /// copy is performed, wiring the source's point (if any) to dest.
1432  void copyVertex(GA_Offset dest, GA_Offset src,
1433  GA_VertexWrangler &vertex_wrangler,
1434  GA_PointWrangler *point_wrangler);
1435 
1436  /// Create a copy of the source vertex using the supplied wranglers to
1437  /// copy attributes. Unlike the previous method which takes an optional
1438  /// "point_wrangler", this overload always performs a non-shallow point
1439  /// copy and specifies whether or not "P" should be copied, regardless of
1440  /// the setting of the point wrangler.
1441  void copyVertex(GA_Offset dest, GA_Offset src,
1442  GA_VertexWrangler &vertex_wrangler,
1443  GA_PointWrangler &point_wrangler,
1444  bool copy_point_p);
1445 
1446  /// The following method will fix all rational curve/patch weights by
1447  /// flagging the curve/patch appropriately. It is quite expensive since
1448  /// it traverses the entire primitive list. Only call it as a last resort.
1449  void fixSplineWeights();
1450 
1451  /// Some useful alias functions, they simplify your life a lot
1452  /// Attribute handling
1453  ///
1454  /// These alias methods return the offset of the (new) attribute, or -1 if
1455  /// they failed for some reason.
1456 
1457  GA_Attribute *addNormalAttribute(GA_AttributeOwner who,
1459  GA_Attribute *addTextureAttribute(GA_AttributeOwner who,
1460  GA_Storage s = GA_STORE_INVALID);
1461  GA_Attribute *addVelocityAttribute(GA_AttributeOwner who,
1462  GA_Storage s = GA_STORE_INVALID);
1463  GA_Attribute *addAngularVelocityAttribute(GA_AttributeOwner who,
1464  GA_Storage s = GA_STORE_INVALID);
1465  GA_Attribute *addOrientAttribute(GA_AttributeOwner who,
1466  GA_Storage s = GA_STORE_INVALID);
1467  GA_Attribute *addAlphaAttribute(GA_AttributeOwner who,
1468  GA_Storage s = GA_STORE_INVALID);
1469  GA_Attribute *addComAttribute(GA_AttributeOwner who,
1470  GA_Storage s = GA_STORE_INVALID);
1471  GA_Attribute *addDiffuseAttribute(GA_AttributeOwner who,
1472  GA_Storage s = GA_STORE_INVALID);
1473  GA_Attribute *addDistanceAttribute(GA_AttributeOwner who,
1474  GA_Storage s = GA_STORE_INVALID);
1475  GA_Attribute *addLODAttribute(GA_AttributeOwner who,
1476  GA_Storage s = GA_STORE_INVALID);
1477  GA_Attribute *addRestAttribute(GA_AttributeOwner who,
1478  GA_Storage s = GA_STORE_INVALID,
1479  const UT_StringHolder &name
1480  = UT_StringHolder::theEmptyString);
1481  GA_Attribute *addTubeCaptureAttribute(
1482  GA_Storage s = GA_STORE_INVALID);
1483 
1484  /// Add the detail's capture frame attribute for capture type t.
1485  GA_Attribute *addCaptureFrameAttribute(CaptureType t = CAPTURE_BONE,
1486  GA_Storage s = GA_STORE_INVALID);
1487 
1488  /// Add the bone capture skeleton root detail attribute.
1489  GA_Attribute *addCaptureSkelRootAttribute(CaptureType t
1490  = CAPTURE_BONE);
1491 
1492  /// Add a new custom (index, weight) point attribute.
1493  /// TODO: geo_NPairs is temporary to force examination of old signature
1494  /// uses, which took size in bytes instead of the # of pairs.
1496  {
1497  public:
1498  explicit geo_NPairs(int v) : myValue(v) {}
1499 
1500  int getValue() const { return myValue; }
1501  private:
1502  int myValue;
1503  };
1504  GA_Attribute *addPtIndexPairAttribute(const UT_StringHolder &name,
1505  geo_NPairs n_pairs,
1507  GA_Attribute *addIndexPairAttribute(GA_AttributeOwner owner,
1508  const UT_StringHolder &name,
1509  int n_pairs,
1511 
1512  /// Add the (index, weight) point attribute for capture type t.
1513  GA_Attribute *addPointCaptureAttribute(geo_NPairs n_pairs,
1514  CaptureType t = CAPTURE_BONE,
1515  GA_Storage s =
1517 
1518  /// Add the bone capture alpha point attribute.
1519  GA_Attribute *addPointCaptureAlphaAttribute(float dflt,
1521 
1522  const GA_Attribute *findNormalAttribute(GA_AttributeOwner who) const;
1523  GA_Attribute *findNormalAttribute(GA_AttributeOwner who);
1524  const GA_Attribute *findTextureAttribute(GA_AttributeOwner who) const;
1525  GA_Attribute *findTextureAttribute(GA_AttributeOwner who);
1526  const GA_Attribute *findVelocityAttribute(GA_AttributeOwner who) const;
1527  GA_Attribute *findVelocityAttribute(GA_AttributeOwner who);
1528  const GA_Attribute *findAlphaAttribute(GA_AttributeOwner who) const;
1529  GA_Attribute *findAlphaAttribute(GA_AttributeOwner who);
1530  const GA_Attribute *findComAttribute(GA_AttributeOwner who) const;
1531  GA_Attribute *findComAttribute(GA_AttributeOwner who);
1532  const GA_Attribute *findDiffuseAttribute(GA_AttributeOwner who) const;
1533  GA_Attribute *findDiffuseAttribute(GA_AttributeOwner who);
1534  const GA_Attribute *findDistanceAttribute(GA_AttributeOwner who) const;
1535  GA_Attribute *findDistanceAttribute(GA_AttributeOwner who);
1536  const GA_Attribute *findLODAttribute(GA_AttributeOwner who) const;
1537  GA_Attribute *findLODAttribute(GA_AttributeOwner who);
1538  const GA_Attribute *findRestAttribute(GA_AttributeOwner who) const;
1539  GA_Attribute *findRestAttribute(GA_AttributeOwner who);
1540  const GA_Attribute *findTubeCaptureAttribute() const;
1541  GA_Attribute *findTubeCaptureAttribute();
1542 
1543  /// Find the material attribute if it exists. This checks for the
1544  /// GEO_STD_ATTRIB_MATERIAL name.
1545  GA_ROHandleS findMaterialAttribute(GA_AttributeOwner who) const;
1546 
1547  /// The internal normal attribute is always a point attribute
1548  /// @todo Remove internalN code path with the H11 viewport?
1549  const GA_Attribute *findInternalNormalAttribute() const;
1550  GA_Attribute *findInternalNormalAttribute();
1551 
1552  /// Find the offset for the detail's capture frame attribute for capture
1553  /// type t.
1554  const GA_Attribute *findCaptureFrameAttribute(
1555  CaptureType t = CAPTURE_BONE) const;
1556  GA_Attribute *findCaptureFrameAttribute(
1557  CaptureType t = CAPTURE_BONE);
1558 
1559  /// Find the offset for the bone capture skeleton root detail attribute.
1560  const GA_Attribute *findCaptureSkelRootAttribute(CaptureType t
1561  = CAPTURE_BONE) const;
1562  GA_Attribute *findCaptureSkelRootAttribute(CaptureType t
1563  = CAPTURE_BONE);
1564 
1565  /// Find the offset for the (region, weight) point capture *point*
1566  /// attribute for capture type t.
1567  const GA_Attribute *findPointCaptureAttribute(
1568  CaptureType t = CAPTURE_BONE) const;
1569  GA_Attribute *findPointCaptureAttribute(
1570  CaptureType t = CAPTURE_BONE);
1571  /// Find the offset for the bone capture alpha point attribute.
1572  const GA_Attribute *findPointCaptureAlphaAttribute() const;
1573  GA_Attribute *findPointCaptureAlphaAttribute();
1574 
1575  /// Find the offset for a custom (index, weight) point attribute.
1576  const GA_Attribute *findPtIndexPairAttribute(const UT_StringRef &name) const;
1577  GA_Attribute *findPtIndexPairAttribute(const UT_StringRef &name);
1578 
1579  void destroyNormalAttribute(GA_AttributeOwner who);
1580  void destroyInternalNormalAttribute();
1581  void destroyTextureAttribute(GA_AttributeOwner who);
1582  void destroyVelocityAttribute(GA_AttributeOwner who);
1583  void destroyAlphaAttribute(GA_AttributeOwner who);
1584  void destroyComAttribute(GA_AttributeOwner who);
1585  void destroyDiffuseAttribute(GA_AttributeOwner who);
1586  void destroyDistanceAttribute(GA_AttributeOwner who);
1587  void destroyLODAttribute(GA_AttributeOwner who);
1588  void destroyRestAttribute(GA_AttributeOwner who);
1589  void destroyTubeCaptureAttribute();
1590 
1591  /// Destroy the detail's capture frame attribute for capture type t.
1592  void destroyCaptureFrameAttribute(CaptureType t
1593  = CAPTURE_BONE);
1594 
1595  /// Destroy the bone capture skeleton root detail attribute.
1596  void destroyCaptureSkelRootAttribute(CaptureType t
1597  = CAPTURE_BONE);
1598 
1599  /// Destroy the (region, weight) point capture *point* attribute for
1600  /// capture type t.
1601  void destroyPointCaptureAttribute(CaptureType t =
1602  CAPTURE_BONE);
1603 
1604  /// Destroy the bone capture alpha point attribute.
1605  void destroyPointCaptureAlphaAttribute();
1606 
1607  /// Destroy a custom (index, weight) point attribute.
1608  void destroyPtIndexPairAttribute(const UT_StringRef &name);
1609 
1610  /// Retrieve the restAnchor string attribute from this gdp, if
1611  /// it exists - return true if successful
1612  bool getMetaRestAnchorPath(UT_String &anchorPath) const;
1613 
1614  /// You should never assume that "uv" is textures!
1615  /// Note that Point capture is still special cased.
1616  /// If the supplied layer is <= 0, then the current layer is used.
1617  /// To extract all the layers names, one should do:
1618  /// for (layer = 1; layer <= getNumLayers(); layer++)
1619  /// layername[layer] = getStdAttributeName(..., layer);
1620  ///
1621  /// WARNING: The returned UT_StringHolder may own the string it references,
1622  /// so you *must* either assign it to a UT_StringHolder or UT_String,
1623  /// or pass it to a function that takes a UT_StringHolder, UT_StringRef,
1624  /// const UT_StringHolder&, or const UT_StringRef&.
1625  /// *DO* *NOT* assign it to a const char* variable! The UT_StringHolder
1626  /// will be destructed immediately after the assignment, deleting the
1627  /// string that the const char* points to!
1628  UT_StringHolder getStdAttributeName(GEO_Standard_Attributes name,
1629  int layer = -1) const;
1630  int getAttributeLayer(const char* attr_name) const;
1631 
1632  static GA_TypeInfo getStdAttributeTypeInfo(const char *name, int floattuplesize);
1633 
1634  /// These handle layers:
1635  int getCurrentLayer() const;
1636  void setCurrentLayer(int layer);
1637  void setNumLayers(int numlayer);
1638  int getNumLayers() const;
1639  /// These get and set the CURRENT layer's merge mode:
1640  void setLayerMerge(int preclear, int mask, int srcblend,
1641  int dstblend);
1642  void getLayerMerge(int &preclear, int &mask, int &srcblend,
1643  int &dstblend) const;
1644 
1645  void addVariableName(const char *attr, const char *varname);
1646  void removeVariableName(const char *varname)
1647  { addVariableName(0, varname); }
1648  /// This gets a raw list of the variable maps suitable for caching
1649  /// to see if they changed.
1650  void getVariableNameMap(UT_String &result) const;
1651 
1652  /// Traverses the variable name mappings currently present:
1653  void traverseVariableNames(int (*function)(const char *attr,
1654  const char *varname, void *data),
1655  void *data) const;
1656 
1657  /// increase the memory size of the attribute
1658  GA_Attribute *growPointCaptureAttribute(geo_NPairs num_added_pairs,
1659  CaptureType t = CAPTURE_BONE);
1660 
1663  {
1664  return getAttributes().cloneAttribute(
1666  src->getName(), *src, true);
1667  }
1670  const UT_StringHolder &n,
1671  const UT_Options *creation_args,
1672  const GA_AttributeOptions *attribute_options,
1673  const UT_StringRef &attribtype)
1674  {
1675  return createAttribute(GA_ATTRIB_POINT, scope, n,
1676  creation_args, attribute_options,attribtype);
1677  }
1680  const UT_Options *creation_args,
1681  const GA_AttributeOptions *attribute_options,
1682  const UT_StringRef &attribtype)
1683  {
1684  return createAttribute(GA_ATTRIB_POINT, n,
1685  creation_args, attribute_options,attribtype);
1686  }
1687 
1688  /// Replace old findPointAttribute(const char *name...) with
1689  /// findIntTuple(GA_ATTRIB_POINT, ...), findFloatTuple(),
1690  /// findStringTuple(), etc.
1693  { return findPointAttribute(src.getScope(),
1694  src.getName()); }
1697  { return findPointAttribute(src.getScope(),
1698  src.getName()); }
1699 
1700  /// Looks for a 3-float point attribute
1703  const UT_StringRef &n) const
1704  { return findFloatTuple(GA_ATTRIB_POINT, s, n, 3, 3); }
1707  { return findFloatTuple(GA_ATTRIB_POINT, n, 3, 3); }
1710  const UT_StringRef &n)
1711  { return findFloatTuple(GA_ATTRIB_POINT, s, n, 3, 3); }
1714  { return findFloatTuple(GA_ATTRIB_POINT, n, 3, 3); }
1715 
1718  const UT_StringRef &n,
1719  const GA_AttributeFilter *filter=NULL)
1720  { destroyAttribute(GA_ATTRIB_POINT,scope, n, filter); }
1723  const GA_AttributeFilter *filter=NULL)
1724  { destroyAttribute(GA_ATTRIB_POINT, n, filter); }
1725 
1726  bool promotePointAttrib(GA_AttributeScope scope,
1727  const UT_StringRef &name);
1730  { return promotePointAttrib(GA_SCOPE_PUBLIC, name); }
1731 
1734  {
1735  return getAttributes().cloneAttribute(
1737  src->getName(), *src, true);
1738  }
1741  const UT_Options *creation_args,
1742  const GA_AttributeOptions *attribute_options,
1743  const UT_StringRef &attribtype)
1744  {
1745  return createAttribute(GA_ATTRIB_VERTEX, scope, n,
1746  creation_args, attribute_options,attribtype);
1747  }
1750  const UT_Options *creation_args,
1751  const GA_AttributeOptions *attribute_options,
1752  const UT_StringRef &attribtype)
1753  {
1754  return createAttribute(GA_ATTRIB_VERTEX, n,
1755  creation_args, attribute_options,attribtype);
1756  }
1757 
1758  /// Replace old findVertexAttribute(const char *name...) with
1759  /// findIntTuple(GA_ATTRIB_VERTEX, ...), findFloatTuple(),
1760  /// findStringTuple(), etc.
1763  { return findVertexAttribute(src.getScope(),
1764  src.getName()); }
1767  { return findVertexAttribute(src.getScope(),
1768  src.getName()); }
1769 
1770  /// Looks for a 3-float vertex attribute
1773  const UT_StringRef &n) const
1774  { return findFloatTuple(GA_ATTRIB_VERTEX,s, n, 3, 3); }
1777  { return findFloatTuple(GA_ATTRIB_VERTEX, n, 3, 3); }
1780  const UT_StringRef &n)
1781  { return findFloatTuple(GA_ATTRIB_VERTEX,s, n, 3, 3); }
1784  { return findFloatTuple(GA_ATTRIB_VERTEX, n, 3, 3); }
1785 
1788  const UT_StringRef &n,
1789  const GA_AttributeFilter *filter=NULL)
1790  { destroyAttribute(GA_ATTRIB_VERTEX,scope, n,filter); }
1793  const GA_AttributeFilter *filter=NULL)
1794  { destroyAttribute(GA_ATTRIB_VERTEX, n, filter); }
1795 
1796  bool demoteVertexAttrib(GA_AttributeScope scope,
1797  const UT_StringRef &name);
1800  { return demoteVertexAttrib(GA_SCOPE_PUBLIC, name); }
1801 
1804  {
1805  return getAttributes().cloneAttribute(
1807  src->getName(), *src,true);
1808  }
1811  const UT_Options *creation_args,
1812  const GA_AttributeOptions *attribute_options,
1813  const UT_StringRef &attribtype)
1814  {
1815  return createAttribute(GA_ATTRIB_PRIMITIVE, scope,
1816  n, creation_args, attribute_options,attribtype);
1817  }
1820  const UT_Options *creation_args,
1821  const GA_AttributeOptions *attribute_options,
1822  const UT_StringRef &attribtype)
1823  {
1824  return createAttribute(GA_ATTRIB_PRIMITIVE, n,
1825  creation_args, attribute_options,attribtype);
1826  }
1827 
1828  /// Replace old findPrimAttribute(const char *name...) with
1829  /// findIntTuple(GA_ATTRIB_PRIMITIVE, ...), findFloatTuple(),
1830  /// findStringTuple(), etc.
1833  { return findPrimitiveAttribute(src.getScope(),
1834  src.getName()); }
1837  { return findPrimitiveAttribute(src.getScope(),
1838  src.getName()); }
1839 
1842  const UT_StringRef &n,
1843  const GA_AttributeFilter *filter=NULL)
1844  {
1845  destroyAttribute(GA_ATTRIB_PRIMITIVE, scope, n,
1846  filter);
1847  }
1850  const GA_AttributeFilter *filter=NULL)
1851  {
1852  destroyAttribute(GA_ATTRIB_PRIMITIVE, n, filter);
1853  }
1854 
1855  /// Note: if attrib already exists, will return pointer to existing
1856  /// attrib.
1859  {
1860  return getAttributes().cloneAttribute(
1862  src->getName(), *src, true);
1863  }
1866  const UT_StringHolder &n,
1867  const UT_Options *creation_args,
1868  const GA_AttributeOptions *attribute_options,
1869  const UT_StringRef &attribtype)
1870  {
1871  return createAttribute(GA_ATTRIB_DETAIL, scope, n,
1872  creation_args, attribute_options,attribtype);
1873  }
1876  const UT_Options *creation_args,
1877  const GA_AttributeOptions *attribute_options,
1878  const UT_StringRef &attribtype)
1879  {
1880  return createAttribute(GA_ATTRIB_DETAIL, n,
1881  creation_args, attribute_options,attribtype);
1882  }
1883 
1886  { return findGlobalAttribute(src.getScope(),
1887  src.getName()); }
1890  { return findGlobalAttribute(src.getScope(),
1891  src.getName()); }
1894  const UT_StringRef &n,
1895  const GA_AttributeFilter *filter=NULL)
1896  { destroyAttribute(GA_ATTRIB_DETAIL,scope, n,filter); }
1899  const GA_AttributeFilter *filter=NULL)
1900  { destroyAttribute(GA_ATTRIB_DETAIL, n, filter); }
1901 
1903  /// Query the internal structures:
1904  SYS_DEPRECATED_HDK(13.0)
1905  GEO_PrimList primitives()
1906  {
1907  return GEO_PrimList(getPrimitiveMap());
1908  }
1909  SYS_DEPRECATED_HDK(13.0)
1910  const GEO_PrimList primitives() const
1911  {
1912  return GEO_PrimList(getPrimitiveMap());
1913  }
1915 
1917  const GA_AttributeDict &pointAttribs() const
1918  { return getAttributes().getDict(
1919  GA_ATTRIB_POINT); }
1922  { return getAttributes().getDict(
1926  { return getAttributes().getDict(
1927  GA_ATTRIB_VERTEX); }
1929  const GA_AttributeDict &attribs() const
1930  { return getAttributes().getDict(
1931  GA_ATTRIB_DETAIL); }
1932 
1933  // Typedef for the GA_Detail::GB_MACRO_CAST static methods.
1935 
1936  bool hasMetaPrimitives() const;
1937  bool hasPastedPrimitives() const;
1938  bool hasQuadricPrimitives() const;
1939  bool hasParticlePrimitives() const;
1940  bool hasVolumePrimitives() const;
1941  bool hasTransformingPrimitives() const;
1942 
1943  /// Check to see whether the detail has any custom primitive types (i.e.
1944  /// non-factory primitives)
1945  bool hasCustomPrimitives() const;
1946 
1947  GA_Size getMetaCount() const;
1948  GA_Size getPastedCount() const;
1949  GA_Size getQuadricCount() const;
1950  GA_Size getParticleCount() const;
1951  GA_Size getVolumeCount() const;
1952 
1953  // This function will find the GEO_Standard_Attributes enum that
1954  // matches the provided string s.
1955  // true is returned on if a match is found; false if no match.
1956  bool getStandardAttributes(const char *s, GEO_Standard_Attributes &a);
1957 
1958  bool mergeCaptureProperties(
1959  GA_Attribute *my_atr,
1960  const GA_Attribute *src_atr,
1961  UT_IntArray &new_indices);
1962 
1963  /// Methods for dealing with attribute handles. It is important to note
1964  /// that the const methods return READ-ONLY handles which will fail when
1965  /// any write methods are called.
1966  SYS_DEPRECATED_HDK(13.0)
1967  GEO_AttributeHandle getPointAttribute (const char *attrib_name) const;
1968  SYS_DEPRECATED_HDK(13.0)
1969  GEO_AttributeHandle getPointAttribute (const char *attrib_name);
1970  SYS_DEPRECATED_HDK(13.0)
1971  GEO_AttributeHandle getPrimAttribute (const char *attrib_name) const;
1972  SYS_DEPRECATED_HDK(13.0)
1973  GEO_AttributeHandle getPrimAttribute (const char *attrib_name);
1974  SYS_DEPRECATED_HDK(13.0)
1975  GEO_AttributeHandle getVertexAttribute(const char *attrib_name) const;
1976  SYS_DEPRECATED_HDK(13.0)
1977  GEO_AttributeHandle getVertexAttribute(const char *attrib_name);
1978  SYS_DEPRECATED_HDK(13.0)
1979  GEO_AttributeHandle getDetailAttribute(const char *attrib_name) const;
1980  SYS_DEPRECATED_HDK(13.0)
1981  GEO_AttributeHandle getDetailAttribute(const char *attrib_name);
1982  SYS_DEPRECATED_HDK(13.0)
1983  GEO_AttributeHandle getAttribute(GA_AttributeOwner dict,
1984  const char *attrib_name) const;
1985  SYS_DEPRECATED_HDK(13.0)
1986  GEO_AttributeHandle getAttribute(GA_AttributeOwner dict,
1987  const char *attrib_name);
1988 
1989  /// Change the storage type from one type to another. For example, cast an
1990  /// integer attribute into a floating point attribute, or vice versa.
1991  /// Only some casting methods have been implemented, so it's quite likely
1992  /// that this method may fail.
1993  bool changeAttributeStorage(GA_AttributeOwner dict,
1994  const UT_StringRef &name,
1995  GA_Storage new_storage);
1996  bool changePointAttributeStorage(const UT_StringRef &nm, GA_Storage s);
1997  bool changeVertexAttributeStorage(const UT_StringRef &nm, GA_Storage s);
1998  bool changePrimAttributeStorage(const UT_StringRef &nm, GA_Storage s);
1999  bool changeDetailAttributeStorage(const UT_StringRef &nm, GA_Storage s);
2000 
2001  /// @{
2002  /// Convenience functions to set a detail attribute to a specific
2003  /// value, and also create the attribute if it doesn't exist.
2004  /// Values will only be assigned to the first N tuple components. For
2005  /// example, for strings, only the first string value will be set, while
2006  /// for a vector2, only the first 2 components will be set.
2007  /// @note Storing a ramp will call the save() method on the UT_Ramp and
2008  /// assign that string to the attribute.
2009  /// @note If the attribute already exists but is the wrong type, or the
2010  /// attribute has too small a tuple size, this method will fail.
2011  bool setDetailAttributeS(const UT_StringHolder &aname, const char *value);
2012  bool setDetailAttributeS(const UT_StringHolder &aname, const UT_StringArray &s);
2013  bool setDetailAttributeR(const UT_StringHolder &aname, const UT_Ramp &ramp);
2014  bool setDetailAttributeF(const UT_StringHolder &aname, float v);
2015  bool setDetailAttributeF(const UT_StringHolder &aname, float v1, float v2);
2016  bool setDetailAttributeF(const UT_StringHolder &aname, const UT_Vector2 &v);
2017  bool setDetailAttributeF(const UT_StringHolder &aname, const UT_Vector3 &v);
2018  bool setDetailAttributeF(const UT_StringHolder &aname, const UT_Vector4 &v);
2019  bool setDetailAttributeF(const UT_StringHolder &aname, const UT_Matrix3 &v);
2020  bool setDetailAttributeF(const UT_StringHolder &aname, const UT_Matrix4 &v);
2021  bool setDetailAttributeI(const UT_StringHolder &aname, int v);
2022  /// @}
2023 
2024  /// @{
2025  /// Convenience routines to retrieve a group of points referenced
2026  /// by a range/group of primitives. These routines assume that the point
2027  /// group pointer is not NULL and return the size of the resulting point
2028  /// group.
2029  GA_Size getPointGroupAdjacentToPrimitiveGroup(
2030  const GA_PrimitiveGroup *in_prim_grp,
2031  GA_PointGroup *adj_pt_grp);
2032  GA_Size getPointGroupAdjacentToPrimitiveRange(
2033  const GA_Range &in_prim_rng,
2034  GA_PointGroup *adj_pt_rng);
2035  GA_Size getVertexGroupAdjacentToPrimitiveGroup(
2036  const GA_PrimitiveGroup *in_prim_grp,
2037  GA_VertexGroup *adj_vtx_grp);
2038  GA_Size getVertexGroupAdjacentToPrimitiveRange(
2039  const GA_Range &in_prim_rng,
2040  GA_VertexGroup *adj_vtx_rng);
2041  /// @}
2042 
2043 private:
2044  struct AdjacentPolygonData
2045  {
2046  GA_Offset myAdjacentPolygon;
2047 
2048  bool operator==(const AdjacentPolygonData &pad) const
2049  { return myAdjacentPolygon == pad.myAdjacentPolygon; }
2050  bool operator<(const AdjacentPolygonData &pad) const
2051  { return myAdjacentPolygon < pad.myAdjacentPolygon; }
2052  };
2053 
2054 public:
2055 
2056  struct PointAdjacencyData : public AdjacentPolygonData
2057  {
2059  };
2060 
2061  struct EdgeAdjacencyData : public AdjacentPolygonData
2062  {
2066  };
2067 
2070 
2071  // Get an array of PointAdjacencyData structs representing the polygons
2072  // adjacent to a polygon (poly_off) through a point. Notice that
2073  // PointAdjacencyData contains a point shared by the two polygons
2074  GA_Size getPointAdjacentPolygons(GEO_PointAdjArray &adjacencies,
2075  GA_Offset poly_off) const;
2076 
2077  // Get an array of polygon Offsets adjacent to a polygon (poly_off)
2078  // through a point
2079  GA_Size getPointAdjacentPolygons(GA_OffsetArray &polygons,
2080  GA_Offset poly_off) const;
2081 
2082 
2083  // Get an array of EdgeAdjacencyData structs representing the polygons
2084  // adjacent to a polygon (poly_off) through an edge. Notice that
2085  // EdgeAdjacencyData contains additional information about the type of
2086  // adjacency
2087  GA_Size getEdgeAdjacentPolygons(GEO_EdgeAdjArray &adjacencies,
2088  GA_Offset poly_off) const;
2089 
2090  // Get an array of polygon Offsets adjacent to a polygon (poly_off)
2091  // through an edge
2092  GA_Size getEdgeAdjacentPolygons(GA_OffsetArray &polygons,
2093  GA_Offset poly_off) const;
2094 
2095  /// Searches primitive list for a primitive whose name attribute
2096  /// matches the given name.
2097  /// UT_String::multiMatch is used for comparison so searching
2098  /// for Cd.* will return as expected.
2099  /// Returns the matchnumberth matching primitive.
2100  const GEO_Primitive *findPrimitiveByName(const char *nametomatch,
2103  const char *nameattrib="name",
2104  int matchnumber = 0) const;
2105  GEO_Primitive *findPrimitiveByName(const char *nametomatch,
2108  const char *nameattrib="name",
2109  int matchnumber = 0);
2110 
2111  /// Like findPrimitiveByName, but adds all matching primitives to the list
2112  void findAllPrimitivesByName(
2114  const char *nametomatch,
2117  const char *nameattrib="name") const;
2118  void findAllPrimitivesByName(
2119  UT_Array<GEO_Primitive*> &primlist,
2120  const char *nametomatch,
2123  const char *nameattrib="name");
2124 
2125  /// Merges attributes from 'src' into this detail. Capture attributes for
2126  /// newly merged points are also updated. Newly merged points are
2127  /// identified by point numbers beginning from 'num_pts_prev'.
2128  void mergeDetailAttributes( const GEO_Detail &src,
2129  int num_pts_prev );
2130 
2132  { destroyElementGroup(g); }
2134  { destroyElementGroup(g); }
2136  { destroyElementGroup(g); }
2137  bool destroyPointGroup(const char *name)
2138  { return
2139  destroyElementGroup(GA_ATTRIB_POINT, name); }
2140  bool destroyPrimitiveGroup(const char *name)
2141  { return
2142  destroyElementGroup(GA_ATTRIB_PRIMITIVE, name); }
2143  bool destroyVertexGroup(const char *name)
2144  { return
2145  destroyElementGroup(GA_ATTRIB_VERTEX, name); }
2146 
2147  /// Attempt to copy groups from the source detail. If override is true,
2148  /// existing groups with the same names as src groups are cleared, else
2149  /// existing groups are not affected. The status (ordered/unordered,
2150  /// internal/persistent) of the source group is also copied.
2151  ///
2152  /// Membership is matched by element index for point and primitive groups,
2153  /// by primitive and local vertex index for vertex groups, and by element
2154  /// index validated by adjacency for edge groups.
2155  void mergeGroups(const GEO_Detail &src, bool override,
2156  unsigned mask = GA_GMASK_FULL_MASK);
2157  GA_PointGroup *mergeGroup(const GEO_Detail &src,
2158  const GA_PointGroup &group,
2159  bool override = true);
2160  GA_PrimitiveGroup *mergeGroup(const GEO_Detail &src,
2161  const GA_PrimitiveGroup &group,
2162  bool override = true);
2163  GA_VertexGroup *mergeGroup(const GEO_Detail &src,
2164  const GA_VertexGroup &group,
2165  GA_OffsetArray &map_cache,
2166  bool override = true);
2167  GA_EdgeGroup *mergeGroup(const GEO_Detail &src,
2168  const GA_EdgeGroup &group,
2169  bool override = true);
2170 
2171 protected:
2173  registerIntrinsics(GA_PrimitiveFactory &factory);
2174 
2175  GA_Size localIntrinsicTupleSize(
2176  GA_IntrinsicEval &eval) const override;
2177  GA_Size localGetIntrinsicS(GA_IntrinsicEval &eval,
2178  UT_String &value) const override;
2179  GA_Size localGetIntrinsicSA(GA_IntrinsicEval &eval,
2180  UT_StringArray &value) const override;
2181  GA_Size localGetIntrinsicD(GA_IntrinsicEval &eval,
2182  UT_OptionsHolder &value) const override;
2183  GA_Size localGetIntrinsicDA(GA_IntrinsicEval &eval,
2185  ) const override;
2186  GA_Size localGetIntrinsicI(GA_IntrinsicEval &eval,
2187  int64 *value, GA_Size size) const override;
2188  GA_Size localGetIntrinsicF(GA_IntrinsicEval &eval,
2189  fpreal64 *value, GA_Size size) const override;
2190  GA_Size localSetIntrinsicS(GA_IntrinsicEval &eval,
2191  const char *value) override;
2192  GA_Size localSetIntrinsicSA(GA_IntrinsicEval &eval,
2193  const UT_StringArray &value) override;
2194  GA_Size localSetIntrinsicSS(GA_IntrinsicEval &eval,
2195  const char **value, GA_Size size) override;
2196  GA_Size localSetIntrinsicDA(GA_IntrinsicEval &eval,
2198  ) override;
2199  GA_Size localSetIntrinsicDS(GA_IntrinsicEval &eval,
2200  const UT_OptionsHolder *value,
2201  GA_Size size) override;
2202  GA_Size localSetIntrinsicI(GA_IntrinsicEval &eval,
2203  const int64 *value, GA_Size size) override;
2204  GA_Size localSetIntrinsicF(GA_IntrinsicEval &eval,
2205  const fpreal64 *value, GA_Size size) override;
2206 
2207  GA_Detail::IOStatus saveH9Stream(std::ostream& os, bool binary,
2208  const GA_SaveOptions *options) const;
2209  GA_Detail::IOStatus loadH9(UT_IStream &is, const GA_LoadOptions *options);
2210 
2211  /// Simple stat of an H9 file. This only fills out the point/prim counts
2212  /// This assumes the magic number (32-bits) has already been read from the
2213  /// file.
2214  static GA_Detail::IOStatus statH9Basic(UT_IStream &is, GA_Stat &sbuf,
2215  bool binstream);
2216 
2217  bool convertIndexPairDataFromH9();
2218  bool convertIndexPairDataToH9();
2219 
2220  template<typename FLOAT_T>
2221  void transformInternal(const UT_Matrix4T<FLOAT_T> &mat,
2222  const GA_Range &prim_range,
2223  const GA_Range &pt_range,
2224  bool just_P,
2225  bool keep_vector_lengths,
2226  bool check_pasting,
2227  bool neg_determinant_flipvector,
2228  bool update_ptnormals,
2229  GEO_Delta *geodelta,
2230  bool updateaffectednormals,
2231  const char *attribpattern);
2232 
2233 private:
2234  GA_ElementGroup *mergeElementGroup(const GEO_Detail &src,
2235  const GA_ElementGroup &group,
2236  bool override = true);
2237 
2238 public:
2239  /// Some common methods for the standard guys
2240  GA_Attribute *addAttribute(const UT_StringHolder &name,
2241  const UT_Options *creation_args,
2242  const GA_AttributeOptions *attribute_options,
2243  const UT_StringRef &attribtype,
2244  GA_AttributeOwner who,
2246  GA_Attribute *growTuple(GA_AttributeOwner owner,
2247  GA_AttributeScope scope,
2248  const UT_StringRef &name,
2249  int added_size);
2252  const UT_StringRef &name,
2253  int added_size)
2254  {
2255  return growTuple(owner, GA_SCOPE_PUBLIC, name, added_size);
2256  }
2257  void destroyAttribute(GA_AttributeOwner owner,
2258  GA_AttributeScope scope,
2259  const UT_StringRef &name,
2260  const GA_AttributeFilter *filter = 0);
2263  const UT_StringRef &name,
2264  const GA_AttributeFilter *filter = 0)
2265  {
2266  destroyAttribute(owner, GA_SCOPE_PUBLIC, name,
2267  filter);
2268  }
2269 
2270  /// Convenience method to find floating point, int, or string tuples of a
2271  /// specified size range. If max_size or min_size are <= 0, then we won't
2272  /// perform the corresponding size check.
2273  /// @{
2274  const GA_Attribute *findFloatTuple(GA_AttributeOwner owner,
2275  GA_AttributeScope scope,
2276  const UT_StringRef &name,
2277  int min_size=1, int max_size=-1) const;
2280  const UT_StringRef &name,
2281  int min_size=1, int max_size=-1) const
2282  {
2283  return findFloatTuple(owner, GA_SCOPE_PUBLIC, name,
2284  min_size, max_size);
2285  }
2286  GA_Attribute *findFloatTuple(GA_AttributeOwner owner,
2287  GA_AttributeScope scope,
2288  const UT_StringRef &name,
2289  int min_size=1, int max_size=-1);
2292  const UT_StringRef &name,
2293  int min_size=1, int max_size=-1)
2294  {
2295  return findFloatTuple(owner, GA_SCOPE_PUBLIC, name,
2296  min_size, max_size);
2297  }
2298  const GA_Attribute *findIntTuple(GA_AttributeOwner owner,
2299  GA_AttributeScope scope,
2300  const UT_StringRef &name,
2301  int min_size=1, int max_size=-1) const;
2304  const UT_StringRef &name,
2305  int min_size=1, int max_size=-1) const
2306  {
2307  return findIntTuple(owner, GA_SCOPE_PUBLIC, name,
2308  min_size, max_size);
2309  }
2310  GA_Attribute *findIntTuple(GA_AttributeOwner owner,
2311  GA_AttributeScope scope,
2312  const UT_StringRef &name,
2313  int min_size=1, int max_size=-1);
2316  const UT_StringRef &name,
2317  int min_size=1, int max_size=-1)
2318  {
2319  return findIntTuple(owner, GA_SCOPE_PUBLIC, name,
2320  min_size, max_size);
2321  }
2322  /// findNumericTuple will find either float or int.
2323  const GA_Attribute *findNumericTuple(GA_AttributeOwner owner,
2324  GA_AttributeScope scope,
2325  const UT_StringRef &name,
2326  int min_size=1, int max_size=-1) const;
2329  const UT_StringRef &name,
2330  int min_size=1, int max_size=-1) const
2331  {
2332  return findNumericTuple(owner, GA_SCOPE_PUBLIC,
2333  name, min_size, max_size);
2334  }
2335  /// findNumericTuple will find either float or int.
2336  GA_Attribute *findNumericTuple(GA_AttributeOwner owner,
2337  GA_AttributeScope scope,
2338  const UT_StringRef &name,
2339  int min_size=1, int max_size=-1);
2342  const UT_StringRef &name,
2343  int min_size=1, int max_size=-1)
2344  {
2345  return findNumericTuple(owner, GA_SCOPE_PUBLIC,
2346  name, min_size, max_size);
2347  }
2348  const GA_Attribute *findStringTuple(GA_AttributeOwner owner,
2349  GA_AttributeScope scope,
2350  const UT_StringRef &name,
2351  int min_size=1, int max_size=-1) const;
2354  const UT_StringRef &name,
2355  int min_size=1, int max_size=-1) const
2356  {
2357  return findStringTuple(owner, GA_SCOPE_PUBLIC,
2358  name, min_size, max_size);
2359  }
2360  GA_Attribute *findStringTuple(GA_AttributeOwner owner,
2361  GA_AttributeScope scope,
2362  const UT_StringRef &name,
2363  int min_size=1, int max_size=-1);
2366  const UT_StringRef &name,
2367  int min_size=1, int max_size=-1)
2368  {
2369  return findStringTuple(owner, GA_SCOPE_PUBLIC,
2370  name, min_size, max_size);
2371  }
2372  const GA_Attribute *findIndexPair(GA_AttributeOwner owner,
2373  GA_AttributeScope scope,
2374  const UT_StringRef &name) const;
2377  const UT_StringRef &name) const
2378  {
2379  return findIndexPair(owner, GA_SCOPE_PUBLIC, name);
2380  }
2381  GA_Attribute *findIndexPair(GA_AttributeOwner owner,
2382  GA_AttributeScope scope,
2383  const UT_StringRef &name);
2386  const UT_StringRef &name)
2387  {
2388  return findIndexPair(owner, GA_SCOPE_PUBLIC, name);
2389  }
2390  const GA_Attribute *findFloatArray(GA_AttributeOwner owner,
2391  GA_AttributeScope scope,
2392  const UT_StringRef &name,
2393  int min_size=1, int max_size=-1) const;
2396  const UT_StringRef &name,
2397  int min_size=1, int max_size=-1) const
2398  {
2399  return findFloatArray(owner, GA_SCOPE_PUBLIC, name,
2400  min_size, max_size);
2401  }
2402  GA_Attribute *findFloatArray(GA_AttributeOwner owner,
2403  GA_AttributeScope scope,
2404  const UT_StringRef &name,
2405  int min_size=1, int max_size=-1);
2408  const UT_StringRef &name,
2409  int min_size=1, int max_size=-1)
2410  {
2411  return findFloatArray(owner, GA_SCOPE_PUBLIC, name,
2412  min_size, max_size);
2413  }
2414  const GA_Attribute *findIntArray(GA_AttributeOwner owner,
2415  GA_AttributeScope scope,
2416  const UT_StringRef &name,
2417  int min_size=1, int max_size=-1) const;
2420  const UT_StringRef &name,
2421  int min_size=1, int max_size=-1) const
2422  {
2423  return findIntArray(owner, GA_SCOPE_PUBLIC, name,
2424  min_size, max_size);
2425  }
2426  GA_Attribute *findIntArray(GA_AttributeOwner owner,
2427  GA_AttributeScope scope,
2428  const UT_StringRef &name,
2429  int min_size=1, int max_size=-1);
2432  const UT_StringRef &name,
2433  int min_size=1, int max_size=-1)
2434  {
2435  return findIntArray(owner, GA_SCOPE_PUBLIC, name,
2436  min_size, max_size);
2437  }
2438  const GA_Attribute *findNumericArray(GA_AttributeOwner owner,
2439  GA_AttributeScope scope,
2440  const UT_StringRef &name,
2441  int min_size=1, int max_size=-1) const;
2444  const UT_StringRef &name,
2445  int min_size=1, int max_size=-1) const
2446  {
2447  return findNumericArray(owner, GA_SCOPE_PUBLIC, name,
2448  min_size, max_size);
2449  }
2450  GA_Attribute *findNumericArray(GA_AttributeOwner owner,
2451  GA_AttributeScope scope,
2452  const UT_StringRef &name,
2453  int min_size=1, int max_size=-1);
2456  const UT_StringRef &name,
2457  int min_size=1, int max_size=-1)
2458  {
2459  return findNumericArray(owner, GA_SCOPE_PUBLIC, name,
2460  min_size, max_size);
2461  }
2462  const GA_Attribute *findStringArray(GA_AttributeOwner owner,
2463  GA_AttributeScope scope,
2464  const UT_StringRef &name,
2465  int min_size=1, int max_size=-1) const;
2468  const UT_StringRef &name,
2469  int min_size=1, int max_size=-1) const
2470  {
2471  return findStringArray(owner, GA_SCOPE_PUBLIC, name,
2472  min_size, max_size);
2473  }
2474  GA_Attribute *findStringArray(GA_AttributeOwner owner,
2475  GA_AttributeScope scope,
2476  const UT_StringRef &name,
2477  int min_size=1, int max_size=-1);
2480  const UT_StringRef &name,
2481  int min_size=1, int max_size=-1)
2482  {
2483  return findStringArray(owner, GA_SCOPE_PUBLIC, name,
2484  min_size, max_size);
2485  }
2486  const GA_Attribute *findDictArray(GA_AttributeOwner owner,
2487  GA_AttributeScope scope,
2488  const UT_StringRef &name,
2489  int min_size=1, int max_size=-1) const;
2492  const UT_StringRef &name,
2493  int min_size=1, int max_size=-1) const
2494  {
2495  return findDictArray(owner, GA_SCOPE_PUBLIC, name,
2496  min_size, max_size);
2497  }
2498  GA_Attribute *findDictArray(GA_AttributeOwner owner,
2499  GA_AttributeScope scope,
2500  const UT_StringRef &name,
2501  int min_size=1, int max_size=-1);
2504  const UT_StringRef &name,
2505  int min_size=1, int max_size=-1)
2506  {
2507  return findDictArray(owner, GA_SCOPE_PUBLIC, name,
2508  min_size, max_size);
2509  }
2510  /// @}
2511 
2512  /// @{
2513  /// Convenience method for adding a float, integer or string tuple
2514  /// attribute.
2515  ///
2516  /// If there's an existing attribute of the same name, the
2517  /// GA_ReuseStrategy will be used. By default, this will return
2518  /// the existing attribute if it is the same type. If not, it will
2519  /// try to replace it with a new one and copy the old data over.
2520  ///
2521  /// The attribute storage will be determined by the @c storage parameter.
2522  /// For example, if it's GA_STORE_REAL32 or GA_STORE_REAL16, a floating
2523  /// point tuple will be added. An integer tuple would be created for
2524  /// GA_STORE_INT64 and a string tuple for GA_STORE_STRING.
2525  ///
2526  /// The defaults will be ignored for string attributes.
2527  /// @note If you have a GA_StorageClass, you can call
2528  /// @c GAgetDefaultStorage(storageclass);
2529  GA_Attribute *addTuple(GA_Storage storage,
2530  GA_AttributeOwner owner,
2531  GA_AttributeScope scope,
2532  const UT_StringHolder &name,
2533  int tuple_size,
2534  const GA_Defaults &defaults = GA_Defaults(0.0),
2535  const UT_Options *creation_args = 0,
2536  const GA_AttributeOptions *attribute_options = 0,
2537  const GA_ReuseStrategy &reuse =
2538  GA_ReuseStrategy());
2541  GA_AttributeOwner owner,
2542  const UT_StringHolder &name,
2543  int tuple_size,
2544  const GA_Defaults &defaults = GA_Defaults(0.0),
2545  const UT_Options *creation_args = 0,
2546  const GA_AttributeOptions *attribute_options = 0,
2547  const GA_ReuseStrategy &reuse =
2548  GA_ReuseStrategy())
2549  {
2550  return addTuple(storage,
2551  owner,
2553  name,
2554  tuple_size,
2555  defaults,
2556  creation_args,
2557  attribute_options,
2558  reuse);
2559  }
2560  /// @}
2561 
2562  /// @{
2563  /// Convenience method to add a new floating point, int or string tuple
2564  /// attribute.
2565  ///
2566  /// If there's an existing attribute of the same name, the
2567  /// GA_ReuseStrategy will be used. By default, this will return
2568  /// the existing attribute if it is the same type. If not, it will
2569  /// try to replace it with a new one and copy the old data over.
2570  GA_Attribute *addFloatTuple(GA_AttributeOwner owner,
2571  GA_AttributeScope scope,
2572  const UT_StringHolder &name,
2573  int tuple_size,
2574  const GA_Defaults &defaults = GA_Defaults(0.0),
2575  const UT_Options *creation_args=0,
2576  const GA_AttributeOptions *attribute_options=0,
2577  GA_Storage storage = GA_STORE_REAL32,
2578  const GA_ReuseStrategy &reuse
2579  = GA_ReuseStrategy());
2582  const UT_StringHolder &name,
2583  int tuple_size,
2584  const GA_Defaults &defaults = GA_Defaults(0.0),
2585  const UT_Options *creation_args=0,
2586  const GA_AttributeOptions *attribute_options=0,
2587  GA_Storage storage = GA_STORE_REAL32,
2588  const GA_ReuseStrategy &reuse
2589  = GA_ReuseStrategy())
2590  {
2591  return addFloatTuple(owner, GA_SCOPE_PUBLIC, name,
2592  tuple_size, defaults,
2593  creation_args,
2594  attribute_options,
2595  storage, reuse);
2596  }
2597  GA_Attribute *addIntTuple(GA_AttributeOwner owner,
2598  GA_AttributeScope scope,
2599  const UT_StringHolder &name,
2600  int tuple_size,
2601  const GA_Defaults &defaults = GA_Defaults(0),
2602  const UT_Options *creation_args=0,
2603  const GA_AttributeOptions *attribute_options=0,
2604  GA_Storage storage = GA_STORE_INT32,
2605  const GA_ReuseStrategy &reuse
2606  = GA_ReuseStrategy());
2609  const UT_StringHolder &name,
2610  int tuple_size,
2611  const GA_Defaults &defaults = GA_Defaults(0),
2612  const UT_Options *creation_args=0,
2613  const GA_AttributeOptions *attribute_options=0,
2614  GA_Storage storage = GA_STORE_INT32,
2615  const GA_ReuseStrategy &reuse
2616  = GA_ReuseStrategy())
2617  {
2618  return addIntTuple(owner, GA_SCOPE_PUBLIC, name,
2619  tuple_size, defaults,
2620  creation_args,
2621  attribute_options,
2622  storage, reuse);
2623  }
2624 
2625  GA_Attribute *addStringTuple(GA_AttributeOwner owner,
2626  GA_AttributeScope scope,
2627  const UT_StringHolder &name,
2628  int tuple_size,
2629  const UT_Options *creation_args=0,
2630  const GA_AttributeOptions *attribute_options=0,
2631  const GA_ReuseStrategy &reuse
2632  = GA_ReuseStrategy());
2635  const UT_StringHolder &name,
2636  int tuple_size,
2637  const UT_Options *creation_args=0,
2638  const GA_AttributeOptions *attribute_options=0,
2639  const GA_ReuseStrategy &reuse
2640  = GA_ReuseStrategy())
2641  {
2642  return addStringTuple(owner, GA_SCOPE_PUBLIC,
2643  name, tuple_size, creation_args,
2644  attribute_options, reuse);
2645  }
2646 
2647  GA_Attribute *addDictTuple(GA_AttributeOwner owner,
2648  GA_AttributeScope scope,
2649  const UT_StringHolder &name,
2650  int tuple_size,
2651  const UT_Options *creation_args=0,
2652  const GA_AttributeOptions *attribute_options=0,
2653  const GA_ReuseStrategy &reuse
2654  = GA_ReuseStrategy());
2657  const UT_StringHolder &name,
2658  int tuple_size,
2659  const UT_Options *creation_args=0,
2660  const GA_AttributeOptions *attribute_options=0,
2661  const GA_ReuseStrategy &reuse
2662  = GA_ReuseStrategy())
2663  {
2664  return addDictTuple(owner, GA_SCOPE_PUBLIC,
2665  name, tuple_size, creation_args,
2666  attribute_options, reuse);
2667  }
2668  /// @}
2669 
2670  /// @{
2671  /// Convenience method to add a new floating point, or int array
2672  /// attribute.
2673  ///
2674  /// If there's an existing attribute of the same name, the
2675  /// GA_ReuseStrategy will be used. By default, this will return
2676  /// the existing attribute if it is the same type. If not, it will
2677  /// try to replace it with a new one and copy the old data over.
2678  GA_Attribute *addFloatArray(GA_AttributeOwner owner,
2679  GA_AttributeScope scope,
2680  const UT_StringHolder &name,
2681  int tuple_size = 1,
2682  const UT_Options *creation_args=0,
2683  const GA_AttributeOptions *attribute_options=0,
2684  GA_Storage storage = GA_STORE_REAL32,
2685  const GA_ReuseStrategy &reuse
2686  = GA_ReuseStrategy());
2689  const UT_StringHolder &name,
2690  int tuple_size = 1,
2691  const UT_Options *creation_args=0,
2692  const GA_AttributeOptions *attribute_options=0,
2693  GA_Storage storage = GA_STORE_REAL32,
2694  const GA_ReuseStrategy &reuse
2695  = GA_ReuseStrategy())
2696  {
2697  return addFloatArray(owner, GA_SCOPE_PUBLIC, name,
2698  tuple_size,
2699  creation_args,
2700  attribute_options,
2701  storage, reuse);
2702  }
2703  GA_Attribute *addIntArray(GA_AttributeOwner owner,
2704  GA_AttributeScope scope,
2705  const UT_StringHolder &name,
2706  int tuple_size = 1,
2707  const UT_Options *creation_args=0,
2708  const GA_AttributeOptions *attribute_options=0,
2709  GA_Storage storage = GA_STORE_INT32,
2710  const GA_ReuseStrategy &reuse
2711  = GA_ReuseStrategy());
2714  const UT_StringHolder &name,
2715  int tuple_size = 1,
2716  const UT_Options *creation_args=0,
2717  const GA_AttributeOptions *attribute_options=0,
2718  GA_Storage storage = GA_STORE_INT32,
2719  const GA_ReuseStrategy &reuse
2720  = GA_ReuseStrategy())
2721  {
2722  return addIntArray(owner, GA_SCOPE_PUBLIC, name,
2723  tuple_size,
2724  creation_args,
2725  attribute_options,
2726  storage, reuse);
2727  }
2728  GA_Attribute *addStringArray(GA_AttributeOwner owner,
2729  GA_AttributeScope scope,
2730  const UT_StringHolder &name, int tuple_size=1,
2731  const UT_Options *creation_args=0,
2732  const GA_AttributeOptions *attribute_options=0,
2733  GA_Storage storage = GA_STORE_STRING,
2734  const GA_ReuseStrategy &reuse
2735  = GA_ReuseStrategy());
2738  const UT_StringHolder &name, int tuple_size=1,
2739  const UT_Options *creation_args=0,
2740  const GA_AttributeOptions *attribute_options=0,
2741  GA_Storage storage = GA_STORE_STRING,
2742  const GA_ReuseStrategy &reuse
2743  = GA_ReuseStrategy())
2744  {
2745  return addStringArray(owner, GA_SCOPE_PUBLIC, name,
2746  tuple_size,
2747  creation_args,
2748  attribute_options,
2749  storage, reuse);
2750  }
2751  GA_Attribute *addDictArray(GA_AttributeOwner owner,
2752  GA_AttributeScope scope,
2753  const UT_StringHolder &name, int tuple_size=1,
2754  const UT_Options *creation_args=0,
2755  const GA_AttributeOptions *attribute_options=0,
2756  GA_Storage storage = GA_STORE_STRING,
2757  const GA_ReuseStrategy &reuse
2758  = GA_ReuseStrategy());
2761  const UT_StringHolder &name, int tuple_size=1,
2762  const UT_Options *creation_args=0,
2763  const GA_AttributeOptions *attribute_options=0,
2764  GA_Storage storage = GA_STORE_STRING,
2765  const GA_ReuseStrategy &reuse
2766  = GA_ReuseStrategy())
2767  {
2768  return addDictArray(owner, GA_SCOPE_PUBLIC, name,
2769  tuple_size,
2770  creation_args,
2771  attribute_options,
2772  storage, reuse);
2773  }
2774  /// @}
2775 
2776  /// Magic number for ASCII geometry files
2777  static inline int asciiMagicH9()
2778  {
2779  return (('P'<<24) + ('G'<<16) + ('E'<<8) + 'O');
2780  }
2781  /// Magic number for binary geometry files
2782  static inline int binaryMagicH9()
2783  {
2784  return (('B'<<24) + ('g'<<16) + ('e'<<8) + 'o');
2785  }
2786 
2787 private:
2788  bool loadPointsH9(UT_IStream &is, int count,
2790  bool savePointsH9(std::ostream &os, bool binary,
2791  const UT_Array<GA_AttribSaveDataH9> &) const;
2792  bool savePointH9(std::ostream &os, bool binary, GA_Offset offset,
2793  const UT_Array<GA_AttribSaveDataH9> &) const;
2794  bool saveExtraH9(std::ostream &os, bool binary,
2795  const UT_Array<const GA_Primitive*> &) const;
2796  bool loadExtraH9(UT_IStream &is);
2797  bool loadVersionH9(UT_IStream &is, int binary);
2798 
2799 //
2800 // Friends
2801  friend std::ostream &operator<<(std::ostream &os, const GEO_Detail &d)
2802  {
2803  d.saveClassic(
2804  os, /*binary*/ false, /*options*/ nullptr);
2805  return os;
2806  }
2807 
2808  friend class GEO_IOTable; // For loadH9/saveH9
2809  friend class GU_IOClassic; // For loadH9/saveH9
2810 
2811 protected:
2812 
2813  /// This is here just so that GA_AttributeSet::jsonSave() can call
2814  /// GEOcomputeNormals()
2815  void privateComputeNormal(
2816  const GA_RWHandleV3 &normalattrib,
2817  const GA_Group *group,
2818  const float cuspangledegrees,
2819  const int method) const override;
2820 
2821 // The compiler reports some deprecated overrides here
2823 };
2825 
2826 #endif
UT_ValArray< EdgeAdjacencyData > GEO_EdgeAdjArray
Definition: GEO_Detail.h:2069
void destroyPrimitiveGroup(GA_PrimitiveGroup *g)
Definition: GEO_Detail.h:2133
virtual void clearCaches()
Definition: GA_Detail.h:1915
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:2713
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:2353
Definition of a geometry attribute.
Definition: GA_Attribute.h:197
SYS_FORCE_INLINE GA_Attribute * addPointAttrib(const GA_Attribute *src)
Definition: GEO_Detail.h:1662
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:2443
void incrementMetaCacheCount()
Definition: GA_Detail.h:2342
GLuint counter
Definition: glew.h:2745
Specify when and how to reuse an existing attribute.
SYS_FORCE_INLINE const GA_Attribute * findPointVectorAttrib(GA_AttributeScope s, const UT_StringRef &n) const
Looks for a 3-float point attribute.
Definition: GEO_Detail.h:1702
GLuint GLdouble GLdouble GLint GLint order
Definition: glew.h:3460
SYS_FORCE_INLINE GA_Attribute * findNumericTuple(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1)
Definition: GEO_Detail.h:2341
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
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:623
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:2315
GEO_Capture_Bone_Property
Definition: GEO_Detail.h:191
Class which stores the default values for a GA_Attribute.
Definition: GA_Defaults.h:35
void
Definition: png.h:1083
GEO_Capture_Cloth_Property
Definition: GEO_Detail.h:220
SYS_FORCE_INLINE GA_Attribute * addDictArray(GA_AttributeOwner owner, const UT_StringHolder &name, int tuple_size=1, const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, GA_Storage storage=GA_STORE_STRING, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())
Definition: GEO_Detail.h:2760
GA_DataIdStrategy
Definition: GA_Types.h:209
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
#define SYS_DEPRECATED_PUSH_DISABLE()
#define SYS_DEPRECATED_POP_DISABLE()
Transformation order of scales, rotates, and translates.
Definition: UT_XformOrder.h:23
SYS_FORCE_INLINE GA_Attribute * addPrimAttrib(const UT_StringHolder &n, const UT_Options *creation_args, const GA_AttributeOptions *attribute_options, const UT_StringRef &attribtype)
Definition: GEO_Detail.h:1819
bool GAisValid(GA_Size v)
Definition: GA_Types.h:648
void clearAndDestroy()
Clear all the points/primitives out of this detail.
Definition: GEO_Detail.h:254
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
SYS_FORCE_INLINE GA_Attribute * addTuple(GA_Storage storage, GA_AttributeOwner owner, const UT_StringHolder &name, int tuple_size, const GA_Defaults &defaults=GA_Defaults(0.0), const UT_Options *creation_args=0, const GA_AttributeOptions *attribute_options=0, const GA_ReuseStrategy &reuse=GA_ReuseStrategy())
Definition: GEO_Detail.h:2540
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:1740
GLboolean GLboolean g
Definition: glcorearb.h:1222
bool deletePrimitive(GA_Primitive &prim, bool and_points=false)
Definition: GEO_Detail.h:1209
UT_ValArray< PointAdjacencyData > GEO_PointAdjArray
Definition: GEO_Detail.h:2068
SYS_FORCE_INLINE GA_Attribute * findGlobalAttrib(const GA_Attribute &src)
Definition: GEO_Detail.h:1889
SYS_FORCE_INLINE GA_Attribute * findIndexPair(GA_AttributeOwner owner, const UT_StringRef &name)
Definition: GEO_Detail.h:2385
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:2365
void destroyVertexGroup(GA_VertexGroup *g)
Definition: GEO_Detail.h:2135
SYS_FORCE_INLINE void destroyVertexAttrib(GA_AttributeScope scope, const UT_StringRef &n, const GA_AttributeFilter *filter=NULL)
Definition: GEO_Detail.h:1787
IOStatus saveClassic(const char *, const GA_SaveOptions *) const
GLuint const GLchar * name
Definition: glcorearb.h:786
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:2279
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:1204
static int binaryMagicH9()
Magic number for binary geometry files.
Definition: GEO_Detail.h:2782
UT_Vector3T< FLOAT_T > myUpVector
Definition: GEO_Detail.h:786
GLenum src
Definition: glcorearb.h:1793
const UT_StringHolder & getName() const
Definition: GA_Attribute.h:282
GLdouble GLdouble t
Definition: glew.h:1403
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:234
GA_Size deletePrimitives(const GA_Range &range, bool and_points=false)
Definition: GEO_Detail.h:1207
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:1149
GA_DestroyPointMode
Definition: GA_Detail.h:641
GLuint GLuint GLfloat weight
Definition: glew.h:13892
void pad(T &out, int n)
Definition: ImfXdr.h:490
void removeVariableName(const char *varname)
Definition: GEO_Detail.h:1646
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:1762
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:2503
A string map of attributes to ease backward compatibility In the GB/GEO/GU library code would often p...
GLsizeiptr size
Definition: glcorearb.h:664
SYS_FORCE_INLINE GEO_Primitive * getGEOPrimitive(GA_Offset primoff)
Definition: GEO_Detail.h:1164
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:1810
double fpreal64
Definition: SYS_Types.h:201
SYS_FORCE_INLINE GA_Attribute * findPrimAttrib(const GA_Attribute &src)
Definition: GEO_Detail.h:1836
GLuint GLenum GLenum transform
Definition: glew.h:15055
GA_Size GA_Offset
Definition: GA_Types.h:640
SYS_FORCE_INLINE GA_Attribute * addVertexAttrib(const UT_StringHolder &n, const UT_Options *creation_args, const GA_AttributeOptions *attribute_options, const UT_StringRef &attribtype)
Definition: GEO_Detail.h:1749
SYS_FORCE_INLINE const GEO_Primitive * getGEOPrimitive(GA_Offset off) const
Definition: GEO_Detail.h:1173
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
Class used to create a map of source points during merging.
GA_AttributeScope
Definition: GA_Types.h:141
SYS_FORCE_INLINE const GA_Attribute * findPointAttrib(const GA_Attribute &src) const
Definition: GEO_Detail.h:1692
bool operator!=(const SoftSymmetryParms &other) const
Definition: GEO_Detail.h:571
GLuint64EXT * result
Definition: glew.h:14311
UT_Matrix3T< FLOAT_T > myOrient
Definition: GEO_Detail.h:789
SYS_FORCE_INLINE GA_Attribute * addPrimAttrib(const GA_Attribute *src)
Definition: GEO_Detail.h:1803
CaptureType
Methods for manipulating capture weights (GEO_CaptureWeight.C)
Definition: GEO_Detail.h:983
SYS_FORCE_INLINE GA_Attribute * findVertexAttrib(const GA_Attribute &src)
Definition: GEO_Detail.h:1766
SYS_FORCE_INLINE const GA_Attribute * findGlobalAttrib(const GA_Attribute &src) const
Definition: GEO_Detail.h:1885
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:2608
GLfloat GLfloat GLfloat v2
Definition: glcorearb.h:818
friend std::ostream & operator<<(std::ostream &os, const GEO_Detail &d)
Definition: GEO_Detail.h:2801
SYS_FORCE_INLINE bool promotePointAttrib(const UT_StringRef &name)
Definition: GEO_Detail.h:1729
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:2688
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:1865
GLsizei GLsizei GLfloat distance
Definition: glew.h:13923
UT_BoundingBoxT< float > UT_BoundingBox
Definition: GEO_Detail.h:43
GLint GLuint mask
Definition: glcorearb.h:124
SYS_FORCE_INLINE void destroyAttribute(GA_AttributeOwner owner, const UT_StringRef &name, const GA_AttributeFilter *filter=0)
Definition: GEO_Detail.h:2262
SYS_FORCE_INLINE void destroyPrimAttrib(const UT_StringRef &n, const GA_AttributeFilter *filter=NULL)
Definition: GEO_Detail.h:1849
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:2328
UT_ColorRamp
Definition: UT_Color.h:32
const GLdouble * v
Definition: glcorearb.h:837
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
#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:325
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:2491
#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:2395
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:2291
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:1772
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glcorearb.h:1297
HUSD_API bool eval(VtValue &val, T &ret_val)
const GEO_Primitive * getGEOPrimitiveByIndex(GA_Index idx) const
Definition: GEO_Detail.h:1191
GLint GLsizei count
Definition: glcorearb.h:405
#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:1679
GEO_Primitive GB_MACRO_PRIM_TYPE
Definition: GEO_Detail.h:1934
SYS_FORCE_INLINE const GA_Attribute * findIndexPair(GA_AttributeOwner owner, const UT_StringRef &name) const
Definition: GEO_Detail.h:2376
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:634
GA_AttributeScope getScope() const
Definition: GA_Attribute.h:211
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:2251
Read-only handle for string attribute data.
Definition: GA_Handle.h:858
GA_TypeInfo
Definition: GA_Types.h:99
SYS_FORCE_INLINE GA_Attribute * findPointAttrib(const GA_Attribute &src)
Definition: GEO_Detail.h:1696
SYS_FORCE_INLINE void destroyPointAttrib(const UT_StringRef &n, const GA_AttributeFilter *filter=NULL)
Definition: GEO_Detail.h:1722
SYS_FORCE_INLINE const GA_AttributeDict & attribs() const
Definition: GEO_Detail.h:1929
GLenum mode
Definition: glcorearb.h:99
bool destroyPointGroup(const char *name)
Definition: GEO_Detail.h:2137
LocalXformContextT(const UT_Matrix3T< FLOAT_T > &orient, const UT_Vector3T< FLOAT_T > &origin, PivotSpace pivot_space)
Definition: GEO_Detail.h:778
GLuint GLdouble GLdouble GLint GLint const GLdouble * points
Definition: glew.h:3460
SYS_FORCE_INLINE GA_Attribute * findFloatArray(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1)
Definition: GEO_Detail.h:2407
GLdouble n
Definition: glcorearb.h:2008
GEO_Primitive * getGEOPrimitiveByIndex(GA_Index idx)
Definition: GEO_Detail.h:1184
IFDmantra py
Definition: HDK_Image.dox:266
Contains transitional objects to provide some backward compatibility for code that references old GEO...
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
GEO_API const TypeMask GEOPRIMALL
SYS_FORCE_INLINE GA_Offset appendPointOffset()
Definition: GEO_Detail.h:1130
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:1832
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:2479
SYS_FORCE_INLINE GA_Attribute * findPointVectorAttrib(GA_AttributeScope s, const UT_StringRef &n)
Definition: GEO_Detail.h:1709
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:1875
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:2656
SYS_FORCE_INLINE bool demoteVertexAttrib(const UT_StringRef &name)
Definition: GEO_Detail.h:1799
SYS_FORCE_INLINE const GA_Attribute * findPointVectorAttrib(const UT_StringRef &n) const
Definition: GEO_Detail.h:1706
GA_Primitive * appendPrimitive(const GA_PrimitiveTypeId &type)
Append a primitive by GA_PrimitiveTypeId.
int getValue() const
Definition: GEO_Detail.h:1500
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:2431
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:2777
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:2419
#define SYS_FTOLERANCE_R
Definition: SYS_Types.h:283
SYS_FORCE_INLINE GEO_Primitive * appendPrimitive(const GA_PrimitiveTypeId &type)
Definition: GEO_Detail.h:1223
SYS_FORCE_INLINE GA_Attribute * addGlobalAttrib(const GA_Attribute *src)
Definition: GEO_Detail.h:1858
SYS_FORCE_INLINE const GA_AttributeDict & primitiveAttribs() const
Definition: GEO_Detail.h:1921
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
void destroyPointGroup(GA_PointGroup *g)
Definition: GEO_Detail.h:2131
GEO_Capture_Muscle_Property
Definition: GEO_Detail.h:198
GLbyte * weights
Definition: glew.h:7581
GLboolean GLuint group
Definition: glew.h:2750
SYS_FORCE_INLINE GA_Attribute * findNumericArray(GA_AttributeOwner owner, const UT_StringRef &name, int min_size=1, int max_size=-1)
Definition: GEO_Detail.h:2455
SYS_FORCE_INLINE GA_Size deletePoints(const GA_PointGroup &point_group, GA_DestroyPointMode mode=GA_LEAVE_PRIMITIVES)
Definition: GEO_Detail.h:1155
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:2581
bool destroyPrimitiveGroup(const char *name)
Definition: GEO_Detail.h:2140
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:2737
GLfloat f
Definition: glcorearb.h:1926
#define GA_INVALID_INDEX
Definition: GA_Types.h:676
GLenum GLint * range
Definition: glcorearb.h:1925
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:1669
SYS_FORCE_INLINE GA_Attribute * findVertexVectorAttrib(const UT_StringRef &n)
Definition: GEO_Detail.h:1783
SYS_FORCE_INLINE GA_Attribute * findPointVectorAttrib(const UT_StringRef &n)
Definition: GEO_Detail.h:1713
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:2303
UT_Vector3T< FLOAT_T > myOrigin
Definition: GEO_Detail.h:790
Definition: core.h:1131
GLintptr offset
Definition: glcorearb.h:665
GA_Offset appendPointCopy(GA_Offset src, GA_PointWrangler &wrangler)
Append a point, copying data from the source point.
Definition: GEO_Detail.h:1145
SYS_FORCE_INLINE void destroyVertexAttrib(const UT_StringRef &n, const GA_AttributeFilter *filter=NULL)
Definition: GEO_Detail.h:1792
#define const
Definition: zconf.h:214
GLfloat GLfloat v1
Definition: glcorearb.h:817
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:1733
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:2634
type
Definition: core.h:1059
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:2467
SYS_FORCE_INLINE void destroyGlobalAttrib(GA_AttributeScope scope, const UT_StringRef &n, const GA_AttributeFilter *filter=NULL)
Definition: GEO_Detail.h:1893
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:1717
Class to specify options for loading geometry.
GEO_Standard_Attributes
Definition: GEO_Detail.h:152
GLdouble s
Definition: glew.h:1395
SYS_FORCE_INLINE GA_Attribute * findVertexVectorAttrib(GA_AttributeScope s, const UT_StringRef &n)
Definition: GEO_Detail.h:1779
SYS_FORCE_INLINE void destroyGlobalAttrib(const UT_StringRef &n, const GA_AttributeFilter *filter=NULL)
Definition: GEO_Detail.h:1898
GA_Storage
Definition: GA_Types.h:49
LocalXformContextT(const UT_Vector3T< FLOAT_T > &forward, const UT_Vector3T< FLOAT_T > &up, PivotSpace pivot_space)
Coordinate frame defined by lookat(zero, forward, up).
Definition: GEO_Detail.h:769
GEO_CopyMethod
An enum for GEO_Detail::copy's method parameter.
Definition: GEO_Detail.h:227
Definition: format.h:895
constexpr T normalize(UT_FixedVector< T, D > &a) noexcept
bool destroyVertexGroup(const char *name)
Definition: GEO_Detail.h:2143
SYS_FORCE_INLINE const GA_Attribute * findVertexVectorAttrib(const UT_StringRef &n) const
Definition: GEO_Detail.h:1776
SYS_FORCE_INLINE const GA_AttributeDict & vertexAttribs() const
Definition: GEO_Detail.h:1925
SYS_FORCE_INLINE void destroyPrimAttrib(GA_AttributeScope scope, const UT_StringRef &n, const GA_AttributeFilter *filter=NULL)
Definition: GEO_Detail.h:1841