HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_OpNode.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  * COMMENTS:
7  */
8 
9 #ifndef __HOM_OpNode_h__
10 #define __HOM_OpNode_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_Node.h"
14 
15 SWIGOUT(%rename(OpNode) HOM_OpNode;)
16 
17 class HOM_API HOM_OpNode : public HOM_Node
18 {
19 public:
21  : HOM_Node()
22  { HOM_CONSTRUCT_OBJECT(this) }
23  HOM_OpNode(const HOM_OpNode &node)
24  : HOM_Node(node)
26  { HOM_CONSTRUCT_OBJECT(this) }
27  ~HOM_OpNode() override
28  { HOM_DESTRUCT_OBJECT(this) }
29 
30  virtual std::vector<std::string> _getArgumentAutoComplete(
31  const char *method_name, const char *arguments,
32  bool meta_info_only = false) = 0;
33 
34  int __hash__() override = 0;
35  std::string __repr__() override = 0;
36 
37  // We need a quick way to get the OP_OpTypeId from C++ code so we know
38  // which subclass of HOM_Node we should cast to, so that's why
39  // opTypeIdAsInt() exists.
40  SWIGOUT(%ignore opTypeIdAsInt;)
41  virtual int opTypeIdAsInt() = 0;
42  // Further, we need a quick way to get the OBJ_OBJECT_TYPE from C++ code
43  // so we know which subclass of HOM_ObjNode we should cast to.
44  // That's why objTypeAsInt() exists.
45  SWIGOUT(%ignore objTypeAsInt;)
46  virtual int objTypeAsInt() = 0;
47 
48  virtual std::string creatorState() = 0;
49  virtual void setCreatorState(const char *state) = 0;
50 
51  virtual bool isBuiltExplicitly() = 0;
52  virtual void setBuiltExplicitly(bool built_explicitly) = 0;
53 
54  virtual HOM_EnumValue *expressionLanguage() = 0;
55  virtual void setExpressionLanguage(HOM_EnumValue &language) = 0;
56 
57  SWIGOUT(%newobject parm;)
58  virtual HOM_Parm *parm(const char* parm_path) = 0;
59 
60  SWIGOUT(%newobject parmTuple;)
61  virtual HOM_ParmTuple *parmTuple(const char* parm_path) = 0;
62 
63  SWIGOUT(%kwargs globParms;)
64  virtual std::vector<HOM_ElemPtr<HOM_Parm> > globParms(
65  const char *pattern, bool ignore_case=false,
66  bool search_label=false,
67  bool single_pattern=false) = 0;
68 
69  virtual std::vector<HOM_ElemPtr<HOM_Parm> > parms() = 0;
70 
71  virtual std::vector<HOM_ElemPtr<HOM_Parm> > parmsReferencingThis() = 0;
72 
73  virtual std::vector<HOM_ElemPtr<HOM_ParmTuple> > parmTuples() = 0;
74 
75  virtual std::vector<HOM_ElemPtr<HOM_Parm> > spareParms() = 0;
76  virtual void removeSpareParms() = 0;
77 
78  virtual void syncNodeVersionIfNeeded(const std::string &from_version) = 0;
79 
80  SWIGOUT(%kwargs setParmTemplateGroup;)
81  virtual void setParmTemplateGroup(
82  HOM_ParmTemplateGroup &parm_template_group,
83  bool rename_conflicting_parms=false) = 0;
84 
85  virtual std::vector<HOM_ElemPtr<HOM_ParmTuple> > parmTuplesInFolder(
86  const std::vector<std::string> &folder_names) = 0;
87 
88  virtual std::vector<HOM_ElemPtr<HOM_Parm> > parmsInFolder(
89  const std::vector<std::string> &folder_names) = 0;
90 
91  SWIGOUT(%newobject parmTemplateGroup;)
92  virtual HOM_ParmTemplateGroup *parmTemplateGroup() = 0;
93 
94  virtual std::vector<std::string> localVariables() = 0;
95  virtual std::vector<std::string> localAttributes() = 0;
96 
97  // Dependency information.
98  SWIGOUT(%kwargs references;)
99  virtual std::vector<HOM_ElemPtr<HOM_Node> >
100  references(bool include_children=true) = 0;
101  SWIGOUT(%kwargs dependents;)
102  virtual std::vector<HOM_ElemPtr<HOM_Node> >
103  dependents(bool include_children=true) = 0;
104  SWIGOUT(%kwargs fileReferences;)
105  SWIGOUT(%newobject fileReferences;)
106  virtual std::vector<std::pair<HOM_ElemPtr<HOM_Parm>, std::string> >
107  fileReferences(bool recurse = true,
108  const char* project_dir_variable = "HIP",
109  bool include_all_refs = true) = 0;
110  virtual bool isTimeDependent() = 0;
111 
112  // If propagate==true, unlock will be propagated to ancestors
113  SWIGOUT(%kwargs allowEditingOfContents;)
114  virtual void allowEditingOfContents(bool propagate=false) = 0;
115  virtual void matchCurrentDefinition() = 0;
116  virtual bool matchesCurrentDefinition() = 0;
117 
118  virtual void syncDelayedDefinition() = 0;
119  virtual bool isDelayedDefinition() = 0;
120 
121  SWIGOUT(%kwargs parmAliases;)
122  virtual std::map<HOM_ElemPtr<HOM_Parm>, std::string>
123  parmAliases(bool recurse=false) = 0;
124 
125  virtual void clearParmAliases() = 0;
126 
127  SWIGOUT(%kwargs createCompiledDigitalAsset);
128  virtual void createCompiledDigitalAsset(const char *name=NULL,
129  const char *hda_file_name=NULL, const char *description=NULL) = 0;
130  virtual bool isInsideLockedHDA() = 0;
131  virtual bool isEditableInsideLockedHDA() = 0;
132  virtual bool isLockedHDA() = 0;
133  virtual bool isCompiled() = 0;
134  virtual bool isMaterialManager() = 0;
135 
136  virtual int outputForViewFlag() = 0;
137  virtual void setOutputForViewFlag(int output) = 0;
138  SWIGOUT(%newobject hdaModule;)
139  virtual HOM_HDAModule *hdaModule() = 0;
140  SWIGOUT(%newobject hdaViewerStateModule;)
141  virtual HOM_HDAViewerStateModule *hdaViewerStateModule() = 0;
142  SWIGOUT(%newobject hdaViewerHandleModule;)
143  virtual HOM_HDAViewerHandleModule *hdaViewerHandleModule() = 0;
144  // hm is an alias for hdaModule.
145  SWIGOUT(%newobject hm;)
146  virtual HOM_HDAModule *hm()
147  { return hdaModule(); }
148  SWIGOUT(%kwargs createDigitalAsset);
149  SWIGOUT(%newobject createDigitalAsset;)
150  virtual HOM_Node *createDigitalAsset(const char *name=NULL,
151  const char *hda_file_name=NULL, const char *description=NULL,
152  int min_num_inputs=0, int max_num_inputs=0,
153  bool compress_contents=false, const char *comment=NULL,
154  const char *version=NULL, bool save_as_embedded=false,
155  bool ignore_external_references=false,
156  bool compile_asset = false,
157  bool change_node_type = true,
158  bool create_backup = true,
159  const char *install_path=NULL) = 0;
160 
161  SWIGOUT(%kwargs changeNodeType);
162  SWIGOUT(%newobject changeNodeType;)
163  virtual HOM_Node *changeNodeType(const char *new_node_type,
164  bool keep_name=true, bool keep_parms=true,
165  bool keep_network_contents=true,
166  bool force_change_on_node_type_match=false) = 0;
167 
168 
169  // TOPs work item navigation, these are here
170  // so both TopNode and SopNode (for sop top networks)
171  // can call them
172  virtual void selectNextVisibleWorkItem() = 0;
173  virtual void selectPreviousVisibleWorkItem() = 0;
174  virtual void deselectWorkItem() = 0;
175  virtual void setCurrentTOPPage(int page) = 0;
176 
177  virtual bool canGenerateCookCode(bool check_parent=false,
178  bool check_auto_shader=true) = 0;
179  SWIGOUT(%newobject cookCodeGeneratorNode;)
180  virtual HOM_Node *cookCodeGeneratorNode() = 0;
181  virtual std::string cookCodeLanguage() = 0;
182  virtual bool supportsMultiCookCodeContexts() = 0;
183 
184  SWIGOUT(%kwargs saveCookCodeToFile;)
185  virtual void saveCookCodeToFile(
186  const char *file_name, bool skip_header=false,
187  const char *context_name = NULL) = 0;
188 
189  // This method is deprecated.
190  void saveCodeToFile(const char *file_name, bool skip_header=false,
191  const char *context_name = NULL)
192  { saveCookCodeToFile(file_name, skip_header, context_name); }
193 
194  virtual void saveCompiledCookCodeToFile(const char *file_name,
195  const char *context_name = NULL) = 0;
196 
197  // This method is deprecated.
198  void saveToCompiledVexFile(const char *file_name,
199  const char *context_name = NULL)
200  { saveCompiledCookCodeToFile(file_name, context_name); }
201 
202  SWIGOUT(%kwargs cook;)
203  virtual void cook(
204  bool force = false,
205  const std::vector<double> frame_range = std::vector<double>()) = 0;
206 
207  SWIGOUT(%kwargs cookNoInterruptInternal;)
208  virtual void _cookNoInterruptInternal(
209  bool force = false,
210  const std::vector<double> frame_range = std::vector<double>()) = 0;
211 
212  /// Determine if this node to cook at the current evaluation time
213  virtual bool needsToCook() = 0;
214  /// Determine if this node to cook at the given time
215  virtual bool needsToCook(double time) = 0;
216 
217  virtual int cookCount() = 0;
218  virtual std::vector<HOM_ElemPtr<HOM_Node> > cookPathNodes() = 0;
219  SWIGOUT(%kwargs infoTree;)
220  virtual HOM_NodeInfoTree infoTree(
221  bool verbose = false,
222  bool debug = false,
223  int output_index = 0,
224  bool force_cook = false) = 0;
225 
226  virtual void updateParmStates() = 0;
227 
228  virtual void runInitScripts() = 0;
229  virtual std::string deleteScript() = 0;
230  virtual void setDeleteScript(const std::string &script_text,
231  HOM_EnumValue &language = HOM_scriptLanguage::Python) = 0;
232 
233  SWIGOUT(%newobject addNodeGroup;)
234  virtual HOM_NodeGroup *addNodeGroup(const char *name = NULL) = 0;
235 
236  virtual std::vector<HOM_ElemPtr<HOM_NodeGroup> > nodeGroups() = 0;
237 
238  SWIGOUT(%newobject nodeGroup;)
239  virtual HOM_NodeGroup *nodeGroup(const char *name) = 0;
240 
241  virtual std::string motionEffectsNetworkPath() = 0;
242  SWIGOUT(%newobject findOrCreateMotionEffectsNetwork;)
243  virtual HOM_Node *findOrCreateMotionEffectsNetwork(bool create=true) = 0;
244  virtual void createOrMoveVisualizer(int output_index) = 0;
245 
246  SWIGOUT(%kwargs saveItemsToFile;)
247  virtual void saveItemsToFile(
248  const std::vector<HOM_NetworkMovableItem *> &items,
249  const char *file_name,
250  bool save_hda_fallbacks = false) = 0;
251  SWIGOUT(%kwargs loadItemsFromFile;)
252  virtual void loadItemsFromFile(
253  const char *file_name, bool ignore_load_warnings=false) = 0;
254 
255  SWIGOUT(%ignore addOpaqueEventCallback;)
256  virtual void addOpaqueEventCallback(
257  const std::vector<HOM_EnumValue *> &event_types,
258  void *py_callback) = 0;
259  SWIGOUT(%ignore addOpaqueParmCallback;)
260  virtual void addOpaqueParmCallback(
261  void *py_callback,
262  const std::vector<std::string> &names) = 0;
263  SWIGOUT(%ignore removeOpaqueEventCallback;)
264  virtual void removeOpaqueEventCallback(
265  const std::vector<HOM_EnumValue *> &event_types,
266  void *py_callback) = 0;
267  virtual void removeAllEventCallbacks() = 0;
268  SWIGOUT(%ignore opaqueEventCallbacks;)
269  virtual std::vector<std::pair<std::vector<HOM_EnumValue *>, void *> >
270  opaqueEventCallbacks() = 0;
271 
272  SWIGOUT(%ignore getUniqueId;)
273  virtual int getUniqueId() = 0;
274 
275  virtual double stampValue(const char *name, double default_value) = 0;
276  virtual std::string stampValue(
277  const char *name, const char *default_value) = 0;
278 
279  // asCode methods:
280  SWIGOUT(%kwargs asCode;)
281  virtual std::string asCode(bool brief=false,
282  bool recurse=false,
283  bool save_channels_only=false,
284  bool save_creation_commands=true,
285  bool save_keys_in_frames=false,
286  bool save_outgoing_wires=false,
287  bool save_parm_values_only=false,
288  bool save_spare_parms=true,
289  bool save_box_membership=true,
290  const char *function_name=NULL) = 0;
291 
292  // Data Block methods (like user data, but bigger blobs with associated
293  // data types).
294  virtual std::vector<std::string> dataBlockKeys(
295  const char *blocktype = nullptr) = 0;
296  virtual std::string dataBlockType(const char *key) = 0;
297  virtual HOM_BinaryString dataBlock(const char *key) = 0;
298  SWIGOUT(%kwargs setDataBlock;)
299  virtual void setDataBlock(const char *key, HOM_BinaryString data,
300  const char *block_type = nullptr) = 0;
301  virtual void removeDataBlock(const char *key) = 0;
302 
303  // Cached user data methods:
304  SWIGOUT(%ignore setOpaqueCachedUserData;)
305  virtual void setOpaqueCachedUserData(
306  const char *name, void *opaque_py_object) = 0;
307  SWIGOUT(%ignore opaqueCachedUserData;)
308  virtual void *opaqueCachedUserData(const char *name) = 0;
309  virtual void destroyCachedUserData(
310  const char *name, bool must_exist=true) = 0;
311  virtual void clearCachedUserDataDict() = 0;
312  virtual std::map<std::string, PY_OpaqueObject> cachedUserDataDict() = 0;
313 
314 #ifdef SWIG
315 %extend
316 {
317  void setCachedUserData(const char *name, InterpreterObject value)
318  { return self->setOpaqueCachedUserData(name, value); }
319 
320  InterpreterObject cachedUserData(const char *name)
321  { return HOMincRef((InterpreterObject)self->opaqueCachedUserData(name)); }
322 }
323 #endif
324 
325  SWIGOUT(%newobject simulation;)
326  virtual HOM_DopSimulation *simulation() = 0;
327 
328  virtual std::vector<HOM_ElemPtr<HOM_Node> >
329  findNodesThatProcessedObject(HOM_DopObject &dop_object) = 0;
330 
331  virtual HOM_BinaryString _parmClipData(double start,
332  double end,
333  bool binary = true,
334  bool use_blosc_compression = true,
335  double sample_rate = 0,
336  bool scoped_only = false) = 0;
337 
338  SWIGOUT(%kwargs _setParmClipData;)
339  virtual void _setParmClipData(HOM_BinaryString data,
340  bool binary = true,
341  bool blosc_compressed = true,
342  double sample_rate = 0,
343  double start = HOM_MIN_NEGATIVE_DOUBLE) = 0;
344 
345  virtual void _saveParmClip(std::string file_name,
346  double start,
347  double end,
348  double sample_rate = 0,
349  bool scoped_only = false) = 0;
350 
351  SWIGOUT(%kwargs _loadParmClip;)
352  virtual void _loadParmClip(std::string file_name,
353  double sample_rate = 0,
354  double start = HOM_MIN_NEGATIVE_DOUBLE) = 0;
355 
356  virtual int __creationTime() = 0;
357  virtual int __modificationTime() = 0;
358  virtual void *_asVoidPointer() = 0;
359 
360  SWIGOUT(%kwargs addError;)
361  virtual void addError(const char *message = 0,
363  SWIGOUT(%kwargs addWarning;)
364  virtual void addWarning(const char *message = 0) = 0;
365  SWIGOUT(%kwargs addMessage;)
366  virtual void addMessage(const char *message = 0) = 0;
367 
368  virtual float lastCookTime() = 0;
369 
370 #ifdef SWIG
371 %extend
372 {
373  // evalParm() and evalParmTuple() need to be special methods because
374  // their return types can vary.
375  InterpreterObject evalParm(const char *parm_path)
376  {
377  HOM_Parm *parm = self->parm(parm_path);
378 
379  if (!parm)
380  throw HOM_OperationFailed("Invalid parm name");
381 
382  InterpreterObject result = HOMevalParm(*parm);
383  delete parm;
384  return result;
385  }
386 
387  InterpreterObject evalParmTuple(const char *parm_path)
388  {
389  HOM_ParmTuple *parm_tuple = self->parmTuple(parm_path);
390 
391  if (!parm_tuple)
392  throw HOM_OperationFailed("Invalid parm tuple name");
393 
394  InterpreterObject result = HOMevalParmTuple(*parm_tuple);
395  delete parm_tuple;
396  return result;
397  }
398 
399  void addEventCallback(
400  const std::vector<HOM_EnumValue *> &event_types,
401  InterpreterObject callback)
402  { self->addOpaqueEventCallback(event_types, callback); }
403 
404  void addParmCallback(
405  InterpreterObject callback,
406  const std::vector<std::string> &names)
407  { self->addOpaqueParmCallback(callback,names); }
408 
409  void removeEventCallback(
410  const std::vector<HOM_EnumValue *> &event_types,
411  InterpreterObject callback)
412  { self->removeOpaqueEventCallback(event_types, callback); }
413 
414 
415  std::vector<std::pair<std::vector<HOM_EnumValue *>, InterpreterObject> >
416  eventCallbacks()
417  {
418  std::vector<std::pair<std::vector<HOM_EnumValue *>, void *> >
419  opaque_callbacks(self->opaqueEventCallbacks());
420 
421  std::vector<std::pair<std::vector<HOM_EnumValue *>, InterpreterObject> >
422  callbacks;
423  for (int i=0; i< opaque_callbacks.size(); ++i)
424  callbacks.push_back(std::make_pair(
425  opaque_callbacks[i].first,
426  (InterpreterObject)opaque_callbacks[i].second));
427  return callbacks;
428  }
429 }
430 #endif
431 };
432 
433 #endif
GLuint GLsizei const GLchar * message
Definition: glcorearb.h:2543
std::string ignore_case(std::string item)
Helper function to allow ignore_case to be passed to IsMember or Transform.
Definition: CLI11.h:3456
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1303
GT_API const UT_StringHolder time
GLuint start
Definition: glcorearb.h:475
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:349
**But if you need a result
Definition: thread.h:613
void saveCodeToFile(const char *file_name, bool skip_header=false, const char *context_name=NULL)
Definition: HOM_OpNode.h:190
#define HOM_API
Definition: HOM_API.h:13
void ignore(T const &) VULKAN_HPP_NOEXCEPT
Definition: vulkan.hpp:6508
GLuint GLuint end
Definition: glcorearb.h:475
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1302
void * _asVoidPointer()
Definition: HOM_Vector3.h:148
#define HOM_MIN_NEGATIVE_DOUBLE
Definition: HOM_Defines.h:50
GLenum GLenum severity
Definition: glcorearb.h:2539
GLuint const GLchar * name
Definition: glcorearb.h:786
GLushort pattern
Definition: glad.h:2583
GT_API const UT_StringHolder version
OIIO_API void debug(string_view str)
HOM_OpNode(const HOM_OpNode &node)
Definition: HOM_OpNode.h:23
Error
Definition: oidn.hpp:577
SIM_API const UT_StringHolder force
OIIO_UTIL_API bool rename(string_view from, string_view to, std::string &err)
virtual HOM_HDAModule * hm()
Definition: HOM_OpNode.h:146
Definition: core.h:1131
void saveToCompiledVexFile(const char *file_name, const char *context_name=NULL)
Definition: HOM_OpNode.h:198
~HOM_OpNode() override
Definition: HOM_OpNode.h:27
Definition: format.h:895
int __hash__()