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