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