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  // Return the name of the default viewer state for this node.
52  virtual std::string defaultState() = 0;
53 
54  virtual bool isBuiltExplicitly() = 0;
55  virtual void setBuiltExplicitly(bool built_explicitly) = 0;
56 
57  virtual HOM_EnumValue *expressionLanguage() = 0;
58  virtual void setExpressionLanguage(HOM_EnumValue &language) = 0;
59 
60  SWIGOUT(%newobject parm;)
61  virtual HOM_Parm *parm(const char* parm_path) = 0;
62 
63  SWIGOUT(%newobject parmTuple;)
64  virtual HOM_ParmTuple *parmTuple(const char* parm_path) = 0;
65 
66  SWIGOUT(%kwargs globParms;)
67  virtual std::vector<HOM_ElemPtr<HOM_Parm> > globParms(
68  const char *pattern, bool ignore_case=false,
69  bool search_label=false,
70  bool single_pattern=false) = 0;
71 
72  virtual std::vector<HOM_ElemPtr<HOM_Parm> > parms() = 0;
73 
74  virtual std::vector<HOM_ElemPtr<HOM_Parm> > parmsReferencingThis() = 0;
75 
76  virtual std::vector<HOM_ElemPtr<HOM_ParmTuple> > parmTuples() = 0;
77 
78  virtual std::vector<HOM_ElemPtr<HOM_Parm> > spareParms() = 0;
79  virtual void removeSpareParms() = 0;
80 
81  virtual void revertParmInterface() = 0;
82 
83  virtual void syncNodeVersionIfNeeded(const std::string &from_version) = 0;
84 
85  SWIGOUT(%kwargs setParmTemplateGroup;)
86  virtual void setParmTemplateGroup(
87  HOM_ParmTemplateGroup &parm_template_group,
88  bool rename_conflicting_parms=false) = 0;
89 
90  virtual std::vector<HOM_ElemPtr<HOM_ParmTuple> > parmTuplesInFolder(
91  const std::vector<std::string> &folder_names) = 0;
92 
93  virtual std::vector<HOM_ElemPtr<HOM_Parm> > parmsInFolder(
94  const std::vector<std::string> &folder_names) = 0;
95 
96  SWIGOUT(%newobject parmTemplateGroup;)
97  virtual HOM_ParmTemplateGroup *parmTemplateGroup() = 0;
98 
99  virtual std::vector<std::string> localVariables() = 0;
100  virtual std::vector<std::string> localAttributes() = 0;
101 
102  SWIGOUT(%kwargs reorderChild;)
103  virtual void reorderChild(int src, int dest) = 0;
104  SWIGOUT(%newobject copyNetworkBox;)
105  virtual HOM_NetworkBox *copyNetworkBox(HOM_NetworkBox &network_box_to_copy,
106  const char *new_name=NULL, bool channel_reference_original=false) = 0;
107  SWIGOUT(%newobject copyStickyNote;)
108  virtual HOM_StickyNote *copyStickyNote(HOM_StickyNote &sticky_note_to_copy,
109  const char *new_name=NULL) = 0;
110 
111  // Dependency information.
112  SWIGOUT(%kwargs references;)
113  virtual std::vector<HOM_ElemPtr<HOM_Node> >
114  references(bool include_children=true) = 0;
115  SWIGOUT(%kwargs dependents;)
116  virtual std::vector<HOM_ElemPtr<HOM_Node> >
117  dependents(bool include_children=true) = 0;
118  SWIGOUT(%kwargs fileReferences;)
119  SWIGOUT(%newobject fileReferences;)
120  virtual std::vector<std::pair<HOM_ElemPtr<HOM_Parm>, std::string> >
121  fileReferences(bool recurse = true,
122  const char* project_dir_variable = "HIP",
123  bool include_all_refs = true) = 0;
124  virtual bool isTimeDependent(bool for_last_cook=false) = 0;
125 
126  // If propagate==true, unlock will be propagated to ancestors
127  SWIGOUT(%kwargs allowEditingOfContents;)
128  virtual void allowEditingOfContents(bool propagate=false) = 0;
129  virtual void matchCurrentDefinition() = 0;
130  virtual bool matchesCurrentDefinition() = 0;
131 
132  virtual void syncDelayedDefinition() = 0;
133  virtual bool isDelayedDefinition() = 0;
134 
135  SWIGOUT(%kwargs parmAliases;)
136  virtual std::map<HOM_ElemPtr<HOM_Parm>, std::string>
137  parmAliases(bool recurse=false) = 0;
138  virtual void clearParmAliases() = 0;
139 
140  SWIGOUT(%kwargs createCompiledDigitalAsset);
141  virtual void createCompiledDigitalAsset(const char *name=NULL,
142  const char *hda_file_name=NULL, const char *description=NULL) = 0;
143  virtual bool isInsideLockedHDA() = 0;
144  virtual bool isEditableInsideLockedHDA() = 0;
145  virtual bool isLockedHDA() = 0;
146  virtual bool isCompiled() = 0;
147  virtual bool isMaterialManager() = 0;
148 
149  virtual std::string outputLabel(int output_index) = 0;
150  virtual std::map<std::string, std::string> editableInputStrings(
151  int input_index) = 0;
152  virtual std::string editableInputString(int input_index,
153  const char *key) = 0;
154  virtual void setEditableInputString(int input_index,
155  const char *key, const char *value) = 0;
156 
157  virtual int outputForViewFlag() = 0;
158  virtual void setOutputForViewFlag(int output) = 0;
159  virtual bool toggleChildExportFlag() = 0;
160 
161  SWIGOUT(%newobject hdaModule;)
162  virtual HOM_HDAModule *hdaModule() = 0;
163  SWIGOUT(%newobject hdaViewerStateModule;)
164  virtual HOM_HDAViewerStateModule *hdaViewerStateModule() = 0;
165  SWIGOUT(%newobject hdaViewerHandleModule;)
166  virtual HOM_HDAViewerHandleModule *hdaViewerHandleModule() = 0;
167  // hm is an alias for hdaModule.
168  SWIGOUT(%newobject hm;)
169  virtual HOM_HDAModule *hm()
170  { return hdaModule(); }
171  SWIGOUT(%kwargs createDigitalAsset);
172  SWIGOUT(%newobject createDigitalAsset;)
173  virtual HOM_Node *createDigitalAsset(const char *name=NULL,
174  const char *hda_file_name=NULL, const char *description=NULL,
175  int min_num_inputs=0, int max_num_inputs=0,
176  bool compress_contents=false, const char *comment=NULL,
177  const char *version=NULL, bool save_as_embedded=false,
178  bool ignore_external_references=false,
179  bool compile_asset = false,
180  bool change_node_type = true,
181  bool create_backup = true,
182  const char *install_path=NULL) = 0;
183 
184  SWIGOUT(%kwargs changeNodeType);
185  SWIGOUT(%newobject changeNodeType;)
186  virtual HOM_Node *changeNodeType(const char *new_node_type,
187  bool keep_name=true, bool keep_parms=true,
188  bool keep_network_contents=true,
189  bool force_change_on_node_type_match=false) = 0;
190 
191  // TOPs work item navigation, these are here
192  // so both TopNode and SopNode (for sop top networks)
193  // can call them
194  virtual void selectNextVisibleWorkItem() = 0;
195  virtual void selectPreviousVisibleWorkItem() = 0;
196  virtual void deselectWorkItem() = 0;
197  virtual void setCurrentTOPPage(int page) = 0;
198 
199  virtual bool canGenerateCookCode(bool check_parent=false,
200  bool check_auto_shader=true) = 0;
201  SWIGOUT(%newobject cookCodeGeneratorNode;)
202  virtual HOM_Node *cookCodeGeneratorNode() = 0;
203  virtual std::string cookCodeLanguage() = 0;
204  virtual bool supportsMultiCookCodeContexts() = 0;
205 
206  SWIGOUT(%kwargs saveCookCodeToFile;)
207  virtual void saveCookCodeToFile(
208  const char *file_name, bool skip_header=false,
209  const char *context_name = NULL) = 0;
210 
211  // This method is deprecated.
212  void saveCodeToFile(const char *file_name, bool skip_header=false,
213  const char *context_name = NULL)
214  { saveCookCodeToFile(file_name, skip_header, context_name); }
215 
216  virtual void saveCompiledCookCodeToFile(const char *file_name,
217  const char *context_name = NULL) = 0;
218 
219  // This method is deprecated.
220  void saveToCompiledVexFile(const char *file_name,
221  const char *context_name = NULL)
222  { saveCompiledCookCodeToFile(file_name, context_name); }
223 
224  SWIGOUT(%kwargs cook;)
225  virtual void cook(
226  bool force = false,
227  const std::vector<double> frame_range = std::vector<double>()) = 0;
228 
229  SWIGOUT(%kwargs cookNoInterruptInternal;)
230  virtual void _cookNoInterruptInternal(
231  bool force = false,
232  const std::vector<double> frame_range = std::vector<double>()) = 0;
233 
234  /// Determine if this node to cook at the current evaluation time
235  virtual bool needsToCook() = 0;
236  /// Determine if this node to cook at the given time
237  virtual bool needsToCook(double time) = 0;
238 
239  virtual void invalidateOutput() = 0;
240 
241  virtual int cookCount() = 0;
242 
243  virtual std::vector<HOM_ElemPtr<HOM_Node> > cookPathNodes() = 0;
244 
245  SWIGOUT(%kwargs infoTree;)
246  virtual HOM_NodeInfoTree infoTree(
247  bool verbose = false,
248  bool debug = false,
249  int output_index = 0,
250  bool force_cook = false) = 0;
251 
252  virtual std::map<std::string, hboost::any> infoData() = 0;
253 
254  virtual void updateParmStates() = 0;
255 
256  virtual void runInitScripts() = 0;
257  virtual std::string deleteScript() = 0;
258  virtual void setDeleteScript(const std::string &script_text,
259  HOM_EnumValue &language = HOM_scriptLanguage::Python) = 0;
260 
261  SWIGOUT(%newobject addNodeGroup;)
262  virtual HOM_NodeGroup *addNodeGroup(const char *name = NULL) = 0;
263 
264  virtual std::vector<HOM_ElemPtr<HOM_NodeGroup> > nodeGroups() = 0;
265 
266  SWIGOUT(%newobject nodeGroup;)
267  virtual HOM_NodeGroup *nodeGroup(const char *name) = 0;
268 
269  virtual std::string motionEffectsNetworkPath() = 0;
270  SWIGOUT(%newobject findOrCreateMotionEffectsNetwork;)
271  virtual HOM_Node *findOrCreateMotionEffectsNetwork(bool create=true) = 0;
272  virtual void createOrMoveVisualizer(int output_index) = 0;
273 
274  SWIGOUT(%kwargs saveItemsToFile;)
275  virtual void saveItemsToFile(
276  const std::vector<HOM_NetworkMovableItem *> &items,
277  const char *file_name,
278  bool save_hda_fallbacks = false) = 0;
279  SWIGOUT(%kwargs loadItemsFromFile;)
280  virtual void loadItemsFromFile(
281  const char *file_name, bool ignore_load_warnings=false) = 0;
282 
283  SWIGOUT(%ignore addOpaqueEventCallback;)
284  virtual void addOpaqueEventCallback(
285  const std::vector<HOM_EnumValue *> &event_types,
286  void *py_callback) = 0;
287  SWIGOUT(%ignore addOpaqueParmCallback;)
288  virtual void addOpaqueParmCallback(
289  void *py_callback,
290  const std::vector<std::string> &names) = 0;
291  SWIGOUT(%ignore removeOpaqueEventCallback;)
292  virtual void removeOpaqueEventCallback(
293  const std::vector<HOM_EnumValue *> &event_types,
294  void *py_callback) = 0;
295  virtual void removeAllEventCallbacks() = 0;
296  SWIGOUT(%ignore opaqueEventCallbacks;)
297  virtual std::vector<std::pair<std::vector<HOM_EnumValue *>, void *> >
298  opaqueEventCallbacks() = 0;
299 
300  SWIGOUT(%ignore getUniqueId;)
301  virtual int getUniqueId() = 0;
302 
303  virtual double stampValue(const char *name, double default_value) = 0;
304  virtual std::string stampValue(
305  const char *name, const char *default_value) = 0;
306 
307  // asCode methods:
308  SWIGOUT(%kwargs asCode;)
309  virtual std::string asCode(bool brief=false,
310  bool recurse=false,
311  bool save_channels_only=false,
312  bool save_creation_commands=true,
313  bool save_keys_in_frames=false,
314  bool save_outgoing_wires=false,
315  bool save_parm_values_only=false,
316  bool save_spare_parms=true,
317  bool save_box_membership=true,
318  const char *function_name=NULL) = 0;
319 
320  // Data Block methods (like user data, but bigger blobs with associated
321  // data types).
322  virtual std::vector<std::string> dataBlockKeys(
323  const char *blocktype = nullptr) = 0;
324  virtual std::string dataBlockType(const char *key) = 0;
325  virtual HOM_BinaryString dataBlock(const char *key) = 0;
326  SWIGOUT(%kwargs setDataBlock;)
327  virtual void setDataBlock(const char *key, HOM_BinaryString data,
328  const char *block_type = nullptr) = 0;
329  virtual void removeDataBlock(const char *key) = 0;
330 
331  // Cached user data methods:
332  SWIGOUT(%ignore setOpaqueCachedUserData;)
333  virtual void setOpaqueCachedUserData(
334  const char *name, void *opaque_py_object) = 0;
335  SWIGOUT(%ignore opaqueCachedUserData;)
336  virtual void *opaqueCachedUserData(const char *name) = 0;
337  virtual void destroyCachedUserData(
338  const char *name, bool must_exist=true) = 0;
339  virtual void clearCachedUserDataDict() = 0;
340  virtual std::map<std::string, PY_OpaqueObject> cachedUserDataDict() = 0;
341 
342 #ifdef SWIG
343 %extend
344 {
345  void setCachedUserData(const char *name, InterpreterObject value)
346  { return self->setOpaqueCachedUserData(name, value); }
347 
348  InterpreterObject cachedUserData(const char *name)
349  { return HOMincRef((InterpreterObject)self->opaqueCachedUserData(name)); }
350 }
351 #endif
352 
353  SWIGOUT(%newobject simulation;)
354  virtual HOM_DopSimulation *simulation() = 0;
355 
356  virtual std::vector<HOM_ElemPtr<HOM_Node> >
357  findNodesThatProcessedObject(HOM_DopObject &dop_object) = 0;
358 
359  virtual HOM_BinaryString _parmClipData(double start,
360  double end,
361  bool binary = true,
362  bool use_blosc_compression = true,
363  double sample_rate = 0,
364  bool scoped_only = false) = 0;
365 
366  SWIGOUT(%kwargs _setParmClipData;)
367  virtual void _setParmClipData(HOM_BinaryString data,
368  bool binary = true,
369  bool blosc_compressed = true,
370  double sample_rate = 0,
371  double start = HOM_MIN_NEGATIVE_DOUBLE) = 0;
372 
373  virtual void _saveParmClip(std::string file_name,
374  double start,
375  double end,
376  double sample_rate = 0,
377  bool scoped_only = false) = 0;
378 
379  SWIGOUT(%kwargs _loadParmClip;)
380  virtual void _loadParmClip(std::string file_name,
381  double sample_rate = 0,
382  double start = HOM_MIN_NEGATIVE_DOUBLE) = 0;
383 
384  virtual int __creationTime() = 0;
385  virtual int __modificationTime() = 0;
386  virtual void *_asVoidPointer() = 0;
387 
388  SWIGOUT(%kwargs addError;)
389  virtual void addError(const char *message = 0,
391  SWIGOUT(%kwargs addWarning;)
392  virtual void addWarning(const char *message = 0) = 0;
393  SWIGOUT(%kwargs addMessage;)
394  virtual void addMessage(const char *message = 0) = 0;
395 
396  virtual float lastCookTime() = 0;
397  virtual std::map<std::string, hboost::any> lastCookContextOptions(
398  bool only_used_options = false) = 0;
399 
400  virtual HOM_EnumValue *graphEditorPaneTabType(bool allow_cook=false) = 0;
401 
402 #ifdef SWIG
403 %extend
404 {
405  // evalParm() and evalParmTuple() need to be special methods because
406  // their return types can vary.
407  InterpreterObject evalParm(const char *parm_path)
408  {
409  HOM_Parm *parm = self->parm(parm_path);
410 
411  if (!parm)
412  throw HOM_OperationFailed("Invalid parm name");
413 
414  InterpreterObject result = HOMevalParm(*parm);
415  delete parm;
416  return result;
417  }
418 
419  InterpreterObject evalParmTuple(const char *parm_path)
420  {
421  HOM_ParmTuple *parm_tuple = self->parmTuple(parm_path);
422 
423  if (!parm_tuple)
424  throw HOM_OperationFailed("Invalid parm tuple name");
425 
426  InterpreterObject result = HOMevalParmTuple(*parm_tuple);
427  delete parm_tuple;
428  return result;
429  }
430 
431  void addEventCallback(
432  const std::vector<HOM_EnumValue *> &event_types,
433  InterpreterObject callback)
434  { self->addOpaqueEventCallback(event_types, callback); }
435 
436  void addParmCallback(
437  InterpreterObject callback,
438  const std::vector<std::string> &names)
439  { self->addOpaqueParmCallback(callback,names); }
440 
441  void removeEventCallback(
442  const std::vector<HOM_EnumValue *> &event_types,
443  InterpreterObject callback)
444  { self->removeOpaqueEventCallback(event_types, callback); }
445 
446 
447  std::vector<std::pair<std::vector<HOM_EnumValue *>, InterpreterObject> >
448  eventCallbacks()
449  {
450  std::vector<std::pair<std::vector<HOM_EnumValue *>, void *> >
451  opaque_callbacks(self->opaqueEventCallbacks());
452 
453  std::vector<std::pair<std::vector<HOM_EnumValue *>, InterpreterObject> >
454  callbacks;
455  for (int i=0; i< opaque_callbacks.size(); ++i)
456  callbacks.push_back(std::make_pair(
457  opaque_callbacks[i].first,
458  (InterpreterObject)opaque_callbacks[i].second));
459  return callbacks;
460  }
461 }
462 #endif
463 };
464 
465 #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:1398
GT_API const UT_StringHolder time
GLuint start
Definition: glcorearb.h:475
GLsizei const GLfloat * value
Definition: glcorearb.h:824
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:312
**But if you need a result
Definition: thread.h:622
void saveCodeToFile(const char *file_name, bool skip_header=false, const char *context_name=NULL)
Definition: HOM_OpNode.h:212
#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:1397
#define HOM_MIN_NEGATIVE_DOUBLE
Definition: HOM_Defines.h:53
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)
GA_API const UT_StringHolder parms
HOM_OpNode(const HOM_OpNode &node)
Definition: HOM_OpNode.h:23
Error
Definition: oidn.hpp:578
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:169
void saveToCompiledVexFile(const char *file_name, const char *context_name=NULL)
Definition: HOM_OpNode.h:220
state
Definition: core.h:2289
~HOM_OpNode() override
Definition: HOM_OpNode.h:27
Definition: format.h:1821
GLenum src
Definition: glcorearb.h:1793