HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_GraphProxy.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: OP_GraphProxy.h ( OP Library, C++)
7  *
8  * COMMENTS:
9  * Allows the idea of a OP_Node network to be abstracted from
10  * actual OP_Node *s.
11  */
12 
13 #ifndef __OP_GraphProxy_h__
14 #define __OP_GraphProxy_h__
15 
16 #include "OP_API.h"
17 #include "OP_Node.h"
18 #include "OP_NodeParms.h"
19 #include <DEP/DEP_TimedMicroNode.h>
20 
22 class OP_GraphProxy;
23 class SOP_NodeVerb;
24 class COP_Verb;
25 
26 /// Returns singleton proxy for our OP_Director network.
27 /// This uses getUniqueId() as the indices
29 
30 /// Sets the global direct graph proxy, used for registration.
31 OP_API void OPsetDirectGraphProxy(const OP_GraphProxy *proxy);
32 
34 {
35 public:
36  OP_GraphProxy();
37  virtual ~OP_GraphProxy();
38 
39  using NodeIdx = exint;
40 
41  /// Direct proxies mirror actual nodes:
42  virtual bool isDirect() const = 0;
43  /// Return an actual node associated with an index, callers must
44  /// handle this being nullptr as the point of proxies is to allow
45  /// non-node proxies.
46  virtual OP_Node *idxToNode(NodeIdx idx) const = 0;
47 
48  // Will only work with direct proxies, as indirect don't have an
49  // index for a node.
50  virtual NodeIdx nodeToIdx(const OP_Node *node) const = 0;
51  virtual UT_StringHolder getFullPath(NodeIdx idx) const = 0;
52  virtual UT_StringHolder getType(NodeIdx idx) const = 0;
53 
54  // Micronode accessors
55  virtual DEP_MicroNode *getEventMicroNode(NodeIdx idx, OP_EventType e) const = 0;
56  virtual DEP_MicroNode *getFlagMicroNode(NodeIdx idx) const = 0;
57 
58  virtual bool validate(NodeIdx idx) const = 0;
59  virtual const SOP_NodeVerb *cookVerb(NodeIdx idx) const = 0;
60 
61  // COP specific accessors
62  virtual int getCOPSignatureCount(NodeIdx idx) const = 0;
63  virtual int getCOPInputCableSize(NodeIdx idx, OP_InputIdx input) const = 0;
64  virtual int getCOPOutputCableSize(NodeIdx idx, OP_OutputIdx output) const = 0;
65  virtual int getCOPNodeInputType(NodeIdx idx, OP_InputIdx input_port_idx, int sig_idx) const = 0;
66  virtual int getCOPNodeOutputType(NodeIdx idx, OP_OutputIdx output_port_idx, int sig_idx) const = 0;
67  virtual bool isCOPOutputNull(NodeIdx idx, OP_OutputIdx output_port_idx, int sig_idx) const = 0;
68  virtual DEP_MicroNode *getCOPSignatureMicroNode(NodeIdx idx) const = 0;
69  virtual const COP_Verb *getCOPVerb(NodeIdx idx) const = 0;
70  virtual int getCOPNumInputs(NodeIdx idx) const = 0;
71  virtual int getCOPNumOutputs(NodeIdx idx) const = 0;
72  virtual bool getCOPAlwaysBypass(NodeIdx idx) const = 0;
73  virtual void getCOPInputName(NodeIdx idx, UT_String& name, OP_InputIdx input_idx) const = 0;
74  virtual NodeIdx getCOPSubNetOutputNode(NodeIdx idx) const = 0;
75  virtual bool addCOPError(NodeIdx idx, UT_ErrorManager &error) const = 0;
76 
77  // Must be in-sync with COP_Node::OutputPort (with the exception of the
78  // override ID field, which is not needed).
79  typedef std::tuple<NodeIdx, OP_OutputIdx, int> COP_NodeOutputPort;
80  virtual COP_NodeOutputPort getCOPBypassPort(NodeIdx idx, UT_ErrorManager& error, OP_OutputIdx port_index, int sig_index) const = 0;
81  virtual COP_NodeOutputPort getCOPOutputPortFromInput(NodeIdx idx, OP_InputIdx input, int sig_index, bool markused=false) const = 0;
82 
83  // Flag accessors
84  virtual bool getBypass(NodeIdx idx) const = 0;
85  virtual bool getHardLock(NodeIdx idx) const = 0;
86  virtual bool getUnload(NodeIdx idx) const = 0;
87 
88  virtual bool getLockedGeometry(NodeIdx idx, GU_ConstDetailHandle *handle) const = 0;
89 
90  // Topology
91  virtual int nInputs(NodeIdx idx) const = 0;
92  virtual int minInputs(NodeIdx idx) const = 0;
93  virtual NodeIdx getInput(NodeIdx idx, OP_InputIdx input, bool markused=false) const = 0;
94  virtual NodeIdx getInputFollowingOutputs(NodeIdx idx, OP_InputIdx input, DEP_MicroNode *depnode=0) const = 0;
95  virtual NodeIdx getOutputSop(NodeIdx idx, OP_OutputIdx output) const = 0;
96  virtual NodeIdx findNode(const UT_StringRef &path) const = 0;
97  virtual NodeIdx getSOPNode(NodeIdx idx, const UT_StringRef &path, bool addref=true) const = 0;
98  virtual bool isPaired(NodeIdx idx, NodeIdx pair) const = 0;
99  virtual OP_OutputIdx whichOutputIsFollowingIndirect(NodeIdx idx, NodeIdx target, OP_InputIdx input_on_target) const = 0;
100  virtual int numSpareInputs(NodeIdx idx) const = 0;
101 
102  virtual NodeIdx getParentNode(NodeIdx idx) const = 0;
103  virtual void getPathWithSubnet(NodeIdx idx, UT_String &str) const = 0;
104 
105  // Gets the spare input using 0-based number.
106  virtual bool hasSpareInput(NodeIdx idx, int input, fpreal t, DEP_MicroNode *depnode) const = 0;
107  virtual NodeIdx getSpareInput(NodeIdx idx, int input, fpreal t, DEP_MicroNode *depnode) const = 0;
108  // Input number of parm override, in -1 base.
109  virtual int getParmOverrideInput(NodeIdx idx, fpreal time, DEP_MicroNode *depnode) const = 0;
110 
111  virtual NodeIdx getTemplateSOP(NodeIdx idx, fpreal t) const = 0;
112  virtual NodeIdx getFeedbackSOP(NodeIdx idx, fpreal t) const = 0;
113 
114  // Type tests
115  virtual bool isBlockBeginCompile(NodeIdx idx) const = 0;
116  virtual bool isBlockEndCompile(NodeIdx idx) const = 0;
117  virtual bool isBlockBeginFor(NodeIdx idx) const = 0;
118  virtual bool isBlockEndFor(NodeIdx idx) const = 0;
119  virtual bool isInvoke(NodeIdx idx) const = 0;
120  virtual bool isSubNet(NodeIdx idx) const = 0;
121  virtual bool isSubNetInputNode(NodeIdx idx) const = 0;
122  virtual bool isSubNetOutputNode(NodeIdx idx) const = 0;
123  virtual bool isObjectMerge(NodeIdx idx) const = 0;
124 
125  // Parameter evaluation
126  virtual bool hasParm(NodeIdx node, const char *parmname) const = 0;
127  virtual void evalOpParm(
128  int64 &v, NodeIdx node, const char *parmname, fpreal time,
129  DEP_MicroNode *depnode) const = 0;
130  virtual void evalOpParm(
131  bool &v, NodeIdx node, const char *parmname, fpreal time,
132  DEP_MicroNode *depnode) const = 0;
133  virtual void evalOpParm(
134  fpreal64 &v, NodeIdx node, const char *parmname, fpreal time,
135  DEP_MicroNode *depnode) const = 0;
136  virtual void evalOpParm(
137  UT_Vector2D &v, NodeIdx node, const char *parmname, fpreal time,
138  DEP_MicroNode *depnode) const = 0;
139  virtual void evalOpParm(
140  UT_Vector3D &v, NodeIdx node, const char *parmname, fpreal time,
141  DEP_MicroNode *depnode) const = 0;
142  virtual void evalOpParm(
143  UT_Vector4D &v, NodeIdx node, const char *parmname, fpreal time,
144  DEP_MicroNode *depnode) const = 0;
145 
146  virtual void evalOpParm(
147  UT_Matrix2D &v, NodeIdx node, const char *parmname, fpreal time,
148  DEP_MicroNode *depnode) const = 0;
149  virtual void evalOpParm(
150  UT_Matrix3D &v, NodeIdx node, const char *parmname, fpreal time,
151  DEP_MicroNode *depnode) const = 0;
152  virtual void evalOpParm(
153  UT_Matrix4D &v, NodeIdx node, const char *parmname, fpreal time,
154  DEP_MicroNode *depnode) const = 0;
155 
156  virtual void evalOpParm(
157  UT_Vector2I &v, NodeIdx node, const char *parmname, fpreal time,
158  DEP_MicroNode *depnode) const = 0;
159  virtual void evalOpParm(
160  UT_Vector3I &v, NodeIdx node, const char *parmname, fpreal time,
161  DEP_MicroNode *depnode) const = 0;
162  virtual void evalOpParm(
163  UT_Vector4I &v, NodeIdx node, const char *parmname, fpreal time,
164  DEP_MicroNode *depnode) const = 0;
165  virtual void evalOpParm(
166  UT_StringHolder &v, NodeIdx node, const char *parmname, fpreal time,
167  DEP_MicroNode *depnode) const = 0;
168  virtual void evalOpParmRaw(
169  UT_StringHolder &v, NodeIdx node, const char *parmname, fpreal time,
170  DEP_MicroNode *depnode) const = 0;
171  virtual void evalOpParm(
172  UT_SharedPtr<UT_Ramp> &v, NodeIdx node, const char *parmname, fpreal time,
173  DEP_MicroNode *depnode) const = 0;
174  virtual void evalOpParm(
175  PRM_DataItemHandle &v, NodeIdx node, const char *parmname, fpreal time,
176  DEP_MicroNode *depnode) const = 0;
177 
178  virtual void evalOpParmInst(
179  int64 &v, NodeIdx node, const char *parmname,
180  const int *inst, const int *offsets, fpreal time,
181  DEP_MicroNode *depnode, int nestlevel=1) const = 0;
182  virtual void evalOpParmInst(
183  bool &v, NodeIdx node, const char *parmname,
184  const int *inst, const int *offsets, fpreal time,
185  DEP_MicroNode *depnode, int nestlevel=1) const = 0;
186  virtual void evalOpParmInst(
187  fpreal64 &v, NodeIdx node, const char *parmname,
188  const int *inst, const int *offsets, fpreal time,
189  DEP_MicroNode *depnode, int nestlevel=1) const = 0;
190  virtual void evalOpParmInst(
191  UT_Vector2D &v, NodeIdx node, const char *parmname,
192  const int *inst, const int *offsets, fpreal time,
193  DEP_MicroNode *depnode, int nestlevel=1) const = 0;
194  virtual void evalOpParmInst(
195  UT_Vector3D &v, NodeIdx node, const char *parmname,
196  const int *inst, const int *offsets, fpreal time,
197  DEP_MicroNode *depnode, int nestlevel=1) const = 0;
198  virtual void evalOpParmInst(
199  UT_Vector4D &v, NodeIdx node, const char *parmname,
200  const int *inst, const int *offsets, fpreal time,
201  DEP_MicroNode *depnode, int nestlevel=1) const = 0;
202 
203  virtual void evalOpParmInst(
204  UT_Matrix2D &v, NodeIdx node, const char *parmname,
205  const int *inst, const int *offsets, fpreal time,
206  DEP_MicroNode *depnode, int nestlevel=1) const = 0;
207  virtual void evalOpParmInst(
208  UT_Matrix3D &v, NodeIdx node, const char *parmname,
209  const int *inst, const int *offsets, fpreal time,
210  DEP_MicroNode *depnode, int nestlevel=1) const = 0;
211  virtual void evalOpParmInst(
212  UT_Matrix4D &v, NodeIdx node, const char *parmname,
213  const int *inst, const int *offsets, fpreal time,
214  DEP_MicroNode *depnode, int nestlevel=1) const = 0;
215 
216  virtual void evalOpParmInst(
217  UT_Vector2I &v, NodeIdx node, const char *parmname,
218  const int *inst, const int *offsets, fpreal time,
219  DEP_MicroNode *depnode, int nestlevel=1) const = 0;
220  virtual void evalOpParmInst(
221  UT_Vector3I &v, NodeIdx node, const char *parmname,
222  const int *inst, const int *offsets, fpreal time,
223  DEP_MicroNode *depnode, int nestlevel=1) const = 0;
224  virtual void evalOpParmInst(
225  UT_Vector4I &v, NodeIdx node, const char *parmname,
226  const int *inst, const int *offsets, fpreal time,
227  DEP_MicroNode *depnode, int nestlevel=1) const = 0;
228 
229  virtual void evalOpParmInst(
230  UT_StringHolder &v, NodeIdx node, const char *parmname,
231  const int *inst, const int *offsets, fpreal time,
232  DEP_MicroNode *depnode, int nestlevel=1) const = 0;
233  virtual void evalOpParmInst(
234  UT_SharedPtr<UT_Ramp> &v, NodeIdx node, const char *parmname,
235  const int *inst, const int *offsets, fpreal time,
236  DEP_MicroNode *depnode, int nestlevel=1) const = 0;
237  virtual void evalOpParmInst(
238  PRM_DataItemHandle &v, NodeIdx node, const char *parmname,
239  const int *inst, const int *offsets, fpreal time,
240  DEP_MicroNode *depnode, int nestlevel=1) const = 0;
241 
242  /// Returns the override ID that can possibly prescribe different signatures
243  /// to nodes (separate from what the pure network contains). This is
244  /// presently only used by COPs to specify input null states and cable
245  /// structures when traversing a graph.
246  virtual int getOverrideId() const
247  { UT_ASSERT(false); return -1; }
248 };
249 
250 
251 
252 #endif
short * getInput(int size) override
virtual int getOverrideId() const
std::tuple< NodeIdx, OP_OutputIdx, int > COP_NodeOutputPort
Definition: OP_GraphProxy.h:79
GT_API const UT_StringHolder time
const GLdouble * v
Definition: glcorearb.h:837
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
int OP_InputIdx
Definition: OP_DataTypes.h:184
int64 exint
Definition: SYS_Types.h:125
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
< returns > If no error
Definition: snippets.dox:2
double fpreal64
Definition: SYS_Types.h:201
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
Definition: APEX_Include.h:55
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
long long int64
Definition: SYS_Types.h:116
GLenum target
Definition: glcorearb.h:1667
GLuint const GLchar * name
Definition: glcorearb.h:786
GLdouble t
Definition: glad.h:2397
fpreal64 fpreal
Definition: SYS_Types.h:278
#define OP_API
Definition: OP_API.h:10
OP_API const OP_GraphProxy * OPdirectGraphProxy()
OP_API void OPsetDirectGraphProxy(const OP_GraphProxy *proxy)
Sets the global direct graph proxy, used for registration.
OP_EventType
Definition: OP_Value.h:22
A global error manager scope.
int OP_OutputIdx
Definition: OP_DataTypes.h:185
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156