HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SOP_CaptureBase.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_CaptureBase.h ( SOP Library, C++)
7  *
8  * COMMENTS: Rudimentary base class for the Capture and ProximityCapture
9  * classes to share some functions. Since they started out as
10  * separate sources, only minimal commonalities have been
11  * abstracted.
12  */
13 
14 #ifndef __SOP_CaptureBase__
15 #define __SOP_CaptureBase__
16 
17 #include "SOP_API.h"
18 #include <GEO/GEO_CaptureData.h>
19 #include "SOP_Node.h"
20 
21 class PRM_RefId;
22 class SOP_CaptureRegion;
23 
25 {
26  friend class SOP_UndoCaptureOpDepend;
27 
28 public:
29  SOP_CaptureBase( OP_Network *parent, const char *name, OP_Operator *entry );
30  ~SOP_CaptureBase() override;
31 
32  void setVisualization(bool onoff) override
33  {
34  // only trigger recooks if different!
35  if (myVisualization != onoff)
36  {
37  myVisualization = onoff;
38  forceRecook();
39  }
40  }
41 
42  void setForceCapture(bool onoff) override
43  {
44  // only trigger recooks if different!
45  if (myForceCapture != onoff)
46  {
47  myForceCapture = onoff;
48  if( onoff )
49  forceRecook();
50  }
51  }
52 
53  static void buildObjectMenu(void *, PRM_Name *, int, void *, PRM_Parm *);
54 
55  int changeString(const char *from, const char *to,
56  bool fullword) override;
57 
59  PRM_ParmList *obsolete_parms) override;
60 
61 protected: // methods
62 
63  // cregion methods
64  enum {
65  SOP_REGION_DISPLAY = 0,
67  SOP_REGION_CREGION
68  };
69 
70  enum {
71  SOP_INPUT_GEOMETRY = 0,
73  SOP_NUM_INPUTS
74  };
75 
76  // override this to do special cases, make sure you call the base class
77  // first before adding your own dependencies!
78  void buildParmDependency( int parm_index ) override;
79  void handleOpDependency( int referenced_op_id,
80  const OP_Dependency &op_dep,
81  OP_InterestType interest_type,
82  bool &need_cook,
83  const char *old_fullpath,
84  const char *old_cwd,
85  const char *old_chan_name ) override;
86 
87  // This will be called if the timeInterest flag is set.
88  // This will return true if the node needs to be dirtied for cooking
89  bool handleTimeChange(fpreal t) override;
90 
91  virtual void resetCapture();
92 
93  virtual OP_Node * getRootObjNode() = 0;
94  virtual int getCaptureSopMethod() = 0;
95  virtual int getDoSubnets() = 0;
96  virtual float getCaptureFrame() = 0;
97  virtual bool useCapturePose() = 0;
98 
99  static int forceRecapture( void *data, int index, fpreal t,
100  const PRM_Template * );
101 
102  void getCregionNodes( OP_Node *root, OP_NodeList &nodes );
103  void getCregionNodesFromString( const char *str,
104  OP_NodeList &nodes );
105  SOP_Node * getRegionNode( OP_Node *bone,
106  bool add_extra_input = false );
107 
108  SYS_DEPRECATED(12.0) bool getRegionData( fpreal t,
109  const OP_Node *region_sop,
110  const GEO_Detail *region_gdp,
111  const GA_ROAttributeRef &capt_atr_offset,
112  const GEO_Primitive *tube_prim,
113  float *atr_data,
114  UT_Matrix4 &xform );
115 
116  bool getRegionData( fpreal t,
117  const OP_Node *region_sop,
118  const GA_ROAttributeRef &capt_atr_offset,
119  const GEO_Primitive *tube_prim,
120  UT_Matrix4 &xform,
121  float &bcap, float &tcap,
122  float &taperx, float &taperz,
123  float &iweight, float &oweight);
124 
125  GU_DetailHandle getRegionGdh( OP_Context &context, int region_idx,
126  int add_error = 1 );
127  bool validateCaptureRegions( OP_Context &context );
128 
129 protected: // data
130 
131  GEO_CaptureData myCaptureData; // transferred to gdp when cooked
132  int myNumPtsAtCaptureFrame;
133 
134  bool myVisualization;
135  bool myForceCapture;
136 
137 private: // methods
138  void buildCRegionDependencies(const PRM_RefId &ref,
139  OP_Node *node);
140  // traverses the network up from each of the "nodes" and finds
141  // the instances of SOP_CaptureRegion and returns them in the "cregions"
142  void getCaptureRegionInstances( const OP_NodeList &nodes,
143  UT_ValArray< SOP_CaptureRegion *> &cregions);
144 
145 private: //data
146  bool myOldCaptureOverride; //used for restoring old override
147 
148 };
149 
150 #endif // __SOP_CaptureBase__
#define SYS_DEPRECATED(__V__)
virtual void forceRecook(bool evensmartcache=true)
virtual void handleOpDependency(int referenced_op_id, const OP_Dependency &op_dep, OP_InterestType interest_type, bool &need_cook, const char *old_fullpath, const char *old_cwd, const char *old_chan_name)
void setForceCapture(bool onoff) override
OP_InterestType
Definition: OP_DataTypes.h:44
GLint ref
Definition: glcorearb.h:124
This class provides a way to manage a reference to an attribute permitting Read-Only access...
GLuint const GLchar * name
Definition: glcorearb.h:786
GLdouble t
Definition: glad.h:2397
int changeString(const char *from, const char *to, bool fullword) override
virtual void resolveObsoleteParms(PRM_ParmList *)
fpreal64 fpreal
Definition: SYS_Types.h:277
GLuint index
Definition: glcorearb.h:786
#define SOP_API
Definition: SOP_API.h:10
virtual bool handleTimeChange(fpreal)
Definition: OP_Node.h:1965
virtual void buildParmDependency(int parm_index)
void setVisualization(bool onoff) override
#define const
Definition: zconf.h:214
Definition: format.h:895