HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_Duplicate.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: GU_Duplicate.h ( GU Library, C++) (based on GU_Copy.h)
7  *
8  * COMMENTS: Duplicate (copy) subset of a gdp with a transform.
9  * Retain source geometry.
10  */
11 
12 #ifndef __GU_Duplicate__
13 #define __GU_Duplicate__
14 
15 #include "GU_API.h"
16 
17 #include <GA/GA_Types.h>
18 #include <UT/UT_VectorTypes.h>
19 class UT_String;
20 class UT_Interrupt;
21 class GA_AttributeRefMap;
22 class GA_PrimitiveGroup;
23 class GA_PointGroup;
24 class GEO_Detail;
25 
26 typedef int (*GU_DuplicateTransformCallback)(UT_Matrix4&,int copynum,void*data);
27 
29 
31 {
32 public:
35 
36  void setKeepVectorLength(bool onoff) { myKeepFlag = onoff; }
37  void setPreserveGroups(bool onoff) { myPreserveGroups = onoff; }
39  {
40  myXformCallback = callback;
41  }
43  {
44  myGNameCallback = callback;
45  }
46 
47  // If a setSource is used, the callback is ignored.
48 
49  void setSource(const GEO_Detail *inputgdp, const GEO_Detail *dupgdp)
50  {
51  myInputSource = inputgdp;
52  myDuplicateSource = dupgdp;
53  }
54 
55  void duplicate(GEO_Detail *gdp, int ncopies,
56  bool changed, void *data = nullptr);
57 
58 private:
59 
60  void transform(
61  GEO_Detail *gdp, bool changed,
62  const UT_Matrix4 &xform, GA_PrimitiveGroup *grp,
63  GA_Index primstart, GA_Index primend,
64  GA_Index ptstart, GA_Index ptend,
65  GA_AttributeRefMap &ptattribs,
66  GA_AttributeRefMap &vtxattribs,
67  GA_AttributeRefMap &primattribs);
68 
69  GU_DuplicateTransformCallback myXformCallback;
70  GU_DuplicateGroupNameCallback myGNameCallback;
71 
72  const GEO_Detail *myInputSource;
73  const GEO_Detail *myDuplicateSource;
74 
75  bool myKeepFlag;
76  bool myPreserveGroups;
77 };
78 
79 #endif
80 
int(* GU_DuplicateTransformCallback)(UT_Matrix4 &, int copynum, void *data)
Definition: GU_Duplicate.h:26
void setPreserveGroups(bool onoff)
Definition: GU_Duplicate.h:37
void setSource(const GEO_Detail *inputgdp, const GEO_Detail *dupgdp)
Definition: GU_Duplicate.h:49
A handle to simplify manipulation of multiple attributes.
int(* GU_DuplicateGroupNameCallback)(UT_String &, void *data)
Definition: GU_Duplicate.h:28
#define GU_API
Definition: GU_API.h:12
GLboolean * data
Definition: glcorearb.h:130
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:611
GA_API const UT_StringHolder transform
void setGroupNameCallback(GU_DuplicateGroupNameCallback callback)
Definition: GU_Duplicate.h:42
typedef int
Definition: png.h:1175
void setKeepVectorLength(bool onoff)
Definition: GU_Duplicate.h:36
void setTransformCallback(GU_DuplicateTransformCallback callback)
Definition: GU_Duplicate.h:38