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  virtual ~SOP_CaptureBase();
31 
32  virtual void setVisualization( int onoff ) override
33  {
34  // only trigger recooks if different!
35  if( myVisualization != onoff )
36  {
37  myVisualization = onoff;
38  forceRecook();
39  }
40  }
41 
42  virtual void setForceCapture( int 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  virtual int changeString(const char *from, const char *to,
56  bool fullword) override;
57 
58  virtual void resolveObsoleteParms(
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  virtual void buildParmDependency( int parm_index ) override;
79  virtual 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  virtual 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 UT_String &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  unsigned myVisualization : 1,
135  myForceCapture : 1;
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)
virtual void setVisualization(int onoff) override
OP_InterestType
Definition: OP_DataTypes.h:45
GLint ref
Definition: glcorearb.h:123
This class provides a way to manage a reference to an attribute permitting Read-Only access...
virtual void setForceCapture(int onoff) override
GLboolean * data
Definition: glcorearb.h:130
GLuint const GLchar * name
Definition: glcorearb.h:785
double fpreal
Definition: SYS_Types.h:270
virtual int changeString(const char *from, const char *to, bool fullword)
virtual void resolveObsoleteParms(PRM_ParmList *)
GLuint index
Definition: glcorearb.h:785
#define SOP_API
Definition: SOP_API.h:10
virtual bool handleTimeChange(fpreal)
Definition: OP_Node.h:1913
virtual void buildParmDependency(int parm_index)
#define const
Definition: zconf.h:214