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