HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_Capture.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: SOP_Capture.h ( SOP Library, C++)
7  *
8  * COMMENTS: The Capture SOP
9  * Assigns capture weighting between surface points and
10  * deformation spheres
11  */
12 
13 #ifndef __SOP_Capture__
14 #define __SOP_Capture__
15 
16 #include "SOP_API.h"
17 #include <UT/UT_IntArray.h>
18 #include <OP/OP_ParmMacros.h>
19 #include <PRM/PRM_Include.h>
20 
21 #include "SOP_CaptureBase.h"
22 
24 {
25  I_PNTGRPS = 0,
41  I_N_SOPCAPTURE_INDICES // should remain the last in this list
42 };
43 
44 class OP_Node;
45 class GEO_PrimTube;
46 
47 class sop_CRegionIterator;
48 class sop_CRegionTree;
49 
50 //________________________________________________________________________
51 //
52 // The SOP_Capture class
53 //
54 //________________________________________________________________________
55 
57 {
58 public:
59  SOP_Capture(OP_Network*, const char *, OP_Operator*);
60  ~SOP_Capture() override {};
61 
62  int isRefInput(unsigned int i) const override;
63  static OP_Node *myConstructor(OP_Network*, const char *, OP_Operator*);
64  static PRM_Template myTemplateList[];
65  static PRM_Template myObsoleteList[];
66 
67  bool updateParmsFlags() override;
68 
69  void setUseAllRegions(bool value);
70 
71 protected:
72  OP_ERROR cookMySop(OP_Context &context) override;
73  OP_ERROR cookMyGuide1(OP_Context &context) override;
74  const char *inputLabel(unsigned idx) const override;
75 
76  void resetCapture() override;
77 
78  OP_Node *getRootObjNode() override;
79  int getCaptureSopMethod() override
80  { return CAPTURE_REGION_SOP(); }
81  int getDoSubnets() override
82  { EVAL_INT("dosubnets",I_DOSUBNETS,0,0); }
83  float getCaptureFrame() override
84  { EVAL_FLT("captframe", I_CAPTFRAME,0,0);}
85  bool useCapturePose() override
86  { EVAL_INT("usecaptpose", I_USECAPTPOSE,0,0);}
87 
88 private:
89 
90 //
91 // UI callback methods
92 //
93  static int saveAllOverrideCB( void *data, int index, fpreal t,
94  const PRM_Template *);
95  static int saveSelectedOverrideCB( void *data, int index, fpreal t,
96  const PRM_Template *);
97  void saveOverrideFile (int use_selection);
98 
99 //
100 // Parameter access callbacks
101 //
102  void POINT_GROUPS( UT_String &str )
104  int CAPTURE_REGION_SOP() { EVAL_INT("captregionsop", I_REGIONSOP,0,0);}
105  void ROOT_PATH(UT_String &str){ EVAL_STR("rootpath", I_RBONE,0,0); }
106 
107  int RELATIVE_SKEL_ROOT() { EVAL_INT("relativeskel", I_RELSKELROOT,0,0); }
108 
109  int WEIGHTFROM() { EVAL_INT("weightFrom", I_WEIGHTFRM,0,0);}
110  int NORMALIZEWEIGHT() { EVAL_INT("normweights", I_NORMALIZEWEIGHT,0,0);}
111  int DESTROYWEIGHTS() { EVAL_INT("destroyweights", I_DESTROYWEIGHTS, 0, 0); }
112  float BLENDFACTOR(fpreal t) { EVAL_FLT("blendfactor", I_BLENDFACTOR, 0, t); }
113  int COLORTYPE() { EVAL_INT("color", I_COLOR,0,0);}
114 
115  float ZEROWEIGHTCOLOR_R() { EVAL_INT("zeroweightcolor", I_ZEROWEIGHTCOLOR,
116  0, 0); }
117  float ZEROWEIGHTCOLOR_G() { EVAL_INT("zeroweightcolor", I_ZEROWEIGHTCOLOR,
118  1, 0); }
119  float ZEROWEIGHTCOLOR_B() { EVAL_INT("zeroweightcolor", I_ZEROWEIGHTCOLOR,
120  2, 0); }
121 
122  int AUTOINCR() { EVAL_INT("autoincr", I_AUTOINCR,0,0);}
123 
124  void OVERRIDEFILE(UT_String &str){ EVAL_STR("captfile", I_ORFILE,0,0);}
125  void SAVEFILE(UT_String &str) { EVAL_STR("savefile", I_SVFILE,0,0);}
126  CH_StringMeaning SAVEFILEmeaning()
127  { return getStringMeaning("savefile",0,0.0f);}
128 
129  void setSaveFile(UT_String &str, CH_StringMeaning meaning)
130  {SET_STRING(str, meaning, "savefile",
131  I_SVFILE,0,0);}
132 
133 //
134 // Private internal methods
135 //
136  // this hardens the filename string in the process.
137  void bumpFileName(UT_String &filename) const;
138 
139  // obtain the nodes refered to in the parameter (root and extra regions)
140  void getAllCregionNodes( OP_NodeList &nodes );
141 
142  // add all regions to internal data structure.
143  // returns 0 on error, 1 on success
144  bool createRegions(OP_Context &context,
145  const OP_NodeList &nodes,
146  sop_CRegionIterator &cregion_iter);
147  bool addRegions(OP_Node *region_node, OP_Context &context,
148  sop_CRegionIterator &cregion_iter);
149  bool createExtraRegions(OP_Context &context,
150  sop_CRegionIterator &cregion_iter);
151 
152  //
153  // for point weighting computations. Returns 1 on success, 0 otherwise
154  //
155  void weightPoint(OP_Context &context, GA_Index pt_num,
156  const UT_Vector3 &pt_pos,
157  const UT_IntArray &regions);
158  bool weightPoints(OP_Context &context,
159  const GA_PointGroup *pt_group,
160  const sop_CRegionTree &region_tree);
161 
162  void colorPoints(OP_Context &context);
163 
164 // returns 1 on success, 0 otherwise
165  int buildGuide(OP_Context &context );
166 
167  void setAllCaptureRegions(UT_IntArray& regions);
168 
169 //
170 // Private data
171 //
172 
173 
174 // indirect array is for optimizing UI parameter access
175  static int *parmIndirect;
176 
177  // If this is true, then every cregion specified will have
178  // attributes created for it, even if some points lie outside
179  // of its bbox. False by default.
180  bool myCaptureAllRegions;
181 };
182 
183 #endif
184 
virtual OP_Node * getRootObjNode()=0
virtual bool updateParmsFlags()
GT_API const UT_StringHolder filename
CH_StringMeaning
virtual const char * inputLabel(unsigned idx) const
UT_ErrorSeverity
Definition: UT_Error.h:25
CH_StringMeaning getStringMeaning(int pi, int vi, fpreal t) const
float getCaptureFrame() override
Definition: SOP_Capture.h:83
~SOP_Capture() override
Definition: SOP_Capture.h:60
#define EVAL_INT(name, idx, vi, t)
Definition: OBJ_Bone.h:83
GLfloat f
Definition: glcorearb.h:1926
virtual OP_ERROR cookMyGuide1(OP_Context &context)
bool useCapturePose() override
Definition: SOP_Capture.h:85
PRM_API PRM_Name PRMgroupName
#define EVAL_STR(name, idx, vi, t)
Definition: OBJ_Bone.h:87
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:640
GLdouble t
Definition: glad.h:2397
SOP_CaptureIndices
Definition: SOP_Capture.h:23
int getCaptureSopMethod() override
Definition: SOP_Capture.h:79
#define EVAL_FLT(name, idx, vi, t)
Definition: OP_ParmMacros.h:21
int getDoSubnets() override
Definition: SOP_Capture.h:81
fpreal64 fpreal
Definition: SYS_Types.h:277
GLuint index
Definition: glcorearb.h:786
#define SOP_API
Definition: SOP_API.h:10
Definition: core.h:1131
virtual OP_ERROR cookMySop(OP_Context &context)=0
virtual void resetCapture()
virtual int isRefInput(unsigned idx) const
Definition: format.h:895
const char * getToken() const
Definition: PRM_Name.h:79
#define SET_STRING(val, meaning, name, parm_index, vector_index, t)
Definition: OBJ_Bone.h:96