HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  virtual ~SOP_Capture() {};
61 
62  virtual int isRefInput(unsigned int i) const;
63  static OP_Node *myConstructor(OP_Network*, const char *, OP_Operator*);
64  static PRM_Template myTemplateList[];
65  static PRM_Template myObsoleteList[];
66 
67  virtual bool updateParmsFlags();
68 
69  void setUseAllRegions(bool value);
70 
71 protected:
72  virtual OP_ERROR cookMySop(OP_Context &context);
73  virtual OP_ERROR cookMyGuide1(OP_Context &context);
74  virtual const char *inputLabel(unsigned idx) const;
75 
76  virtual void resetCapture();
77 
78  virtual OP_Node * getRootObjNode();
79  virtual int getCaptureSopMethod() { return CAPTURE_REGION_SOP(); }
80  virtual int getDoSubnets()
81  { EVAL_INT("dosubnets",I_DOSUBNETS,0,0); }
82  virtual float getCaptureFrame()
83  { EVAL_FLT("captframe", I_CAPTFRAME,0,0);}
84  virtual bool useCapturePose()
85  { EVAL_INT("usecaptpose", I_USECAPTPOSE,0,0);}
86 
87 private:
88 
89 //
90 // UI callback methods
91 //
92  static int saveAllOverrideCB( void *data, int index, fpreal t,
93  const PRM_Template *);
94  static int saveSelectedOverrideCB( void *data, int index, fpreal t,
95  const PRM_Template *);
96  void saveOverrideFile (int use_selection);
97 
98 //
99 // Parameter access callbacks
100 //
101  void POINT_GROUPS( UT_String &str )
103  int CAPTURE_REGION_SOP() { EVAL_INT("captregionsop", I_REGIONSOP,0,0);}
104  void ROOT_PATH(UT_String &str){ EVAL_STR("rootpath", I_RBONE,0,0); }
105 
106  int RELATIVE_SKEL_ROOT() { EVAL_INT("relativeskel", I_RELSKELROOT,0,0); }
107 
108  int WEIGHTFROM() { EVAL_INT("weightFrom", I_WEIGHTFRM,0,0);}
109  int NORMALIZEWEIGHT() { EVAL_INT("normweights", I_NORMALIZEWEIGHT,0,0);}
110  int DESTROYWEIGHTS() { EVAL_INT("destroyweights", I_DESTROYWEIGHTS, 0, 0); }
111  float BLENDFACTOR(fpreal t) { EVAL_FLT("blendfactor", I_BLENDFACTOR, 0, t); }
112  int COLORTYPE() { EVAL_INT("color", I_COLOR,0,0);}
113 
114  float ZEROWEIGHTCOLOR_R() { EVAL_INT("zeroweightcolor", I_ZEROWEIGHTCOLOR,
115  0, 0); }
116  float ZEROWEIGHTCOLOR_G() { EVAL_INT("zeroweightcolor", I_ZEROWEIGHTCOLOR,
117  1, 0); }
118  float ZEROWEIGHTCOLOR_B() { EVAL_INT("zeroweightcolor", I_ZEROWEIGHTCOLOR,
119  2, 0); }
120 
121  int AUTOINCR() { EVAL_INT("autoincr", I_AUTOINCR,0,0);}
122 
123  void OVERRIDEFILE(UT_String &str){ EVAL_STR("captfile", I_ORFILE,0,0);}
124  void SAVEFILE(UT_String &str) { EVAL_STR("savefile", I_SVFILE,0,0);}
125  CH_StringMeaning SAVEFILEmeaning()
126  { return getStringMeaning("savefile",0,0.0f);}
127 
128  void setSaveFile(UT_String &str, CH_StringMeaning meaning)
129  {SET_STRING(str, meaning, "savefile",
130  I_SVFILE,0,0);}
131 
132 //
133 // Private internal methods
134 //
135  // this hardens the filename string in the process.
136  void bumpFileName(UT_String &filename) const;
137 
138  // obtain the nodes refered to in the parameter (root and extra regions)
139  void getAllCregionNodes( OP_NodeList &nodes );
140 
141  // add all regions to internal data structure.
142  // returns 0 on error, 1 on success
143  bool createRegions(OP_Context &context,
144  const OP_NodeList &nodes,
145  sop_CRegionIterator &cregion_iter);
146  bool addRegions(OP_Node *region_node, OP_Context &context,
147  sop_CRegionIterator &cregion_iter);
148  bool createExtraRegions(OP_Context &context,
149  sop_CRegionIterator &cregion_iter);
150 
151  //
152  // for point weighting computations. Returns 1 on success, 0 otherwise
153  //
154  void weightPoint(OP_Context &context, GA_Index pt_num,
155  const UT_Vector3 &pt_pos,
156  const UT_IntArray &regions);
157  bool weightPoints(OP_Context &context,
158  const GA_PointGroup *pt_group,
159  const sop_CRegionTree &region_tree);
160 
161  void colorPoints(OP_Context &context);
162 
163 // returns 1 on success, 0 otherwise
164  int buildGuide(OP_Context &context );
165 
166  void setAllCaptureRegions(UT_IntArray& regions);
167 
168 //
169 // Private data
170 //
171 
172 
173 // indirect array is for optimizing UI parameter access
174  static int *parmIndirect;
175 
176  // If this is true, then every cregion specified will have
177  // attributes created for it, even if some points lie outside
178  // of its bbox. False by default.
179  bool myCaptureAllRegions;
180 };
181 
182 #endif
183 
virtual OP_Node * getRootObjNode()=0
virtual bool updateParmsFlags()
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
3D Vector class.
png_uint_32 i
Definition: png.h:2877
#define EVAL_INT(name, idx, vi, t)
Definition: OBJ_Bone.h:78
GLfloat f
Definition: glcorearb.h:1925
virtual OP_ERROR cookMyGuide1(OP_Context &context)
virtual ~SOP_Capture()
Definition: SOP_Capture.h:60
GLboolean * data
Definition: glcorearb.h:130
PRM_API PRM_Name PRMgroupName
#define EVAL_STR(name, idx, vi, t)
Definition: OBJ_Bone.h:80
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:611
virtual int getCaptureSopMethod()
Definition: SOP_Capture.h:79
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:263
SOP_CaptureIndices
Definition: SOP_Capture.h:23
#define EVAL_FLT(name, idx, vi, t)
Definition: OP_ParmMacros.h:21
GLuint index
Definition: glcorearb.h:785
virtual bool useCapturePose()
Definition: SOP_Capture.h:84
#define SOP_API
Definition: SOP_API.h:10
virtual float getCaptureFrame()
Definition: SOP_Capture.h:82
virtual OP_ERROR cookMySop(OP_Context &context)=0
virtual int getDoSubnets()
Definition: SOP_Capture.h:80
virtual void resetCapture()
virtual int isRefInput(unsigned idx) const
const char * getToken() const
Definition: PRM_Name.h:40
#define SET_STRING(val, meaning, name, parm_index, vector_index, t)
Definition: OBJ_Bone.h:89